type go/ast.Expr
268 uses
go/ast (current package)
ast.go#L42: type Expr interface {
ast.go#L204: Type Expr // field/method/parameter type; or nil
ast.go#L302: Elt Expr // ellipsis element type (parameter lists only); or nil
ast.go#L331: Type Expr // literal type; or nil
ast.go#L333: Elts []Expr // list of composite elements; or nil
ast.go#L341: X Expr // parenthesized expression
ast.go#L347: X Expr // expression
ast.go#L353: X Expr // expression
ast.go#L355: Index Expr // index expression
ast.go#L362: X Expr // expression
ast.go#L364: Indices []Expr // index expressions
ast.go#L370: X Expr // expression
ast.go#L372: Low Expr // begin of slice range; or nil
ast.go#L373: High Expr // end of slice range; or nil
ast.go#L374: Max Expr // maximum capacity of slice; or nil
ast.go#L383: X Expr // expression
ast.go#L385: Type Expr // asserted type; nil means type switch X.(type)
ast.go#L391: Fun Expr // function expression
ast.go#L393: Args []Expr // function arguments; or nil
ast.go#L403: X Expr // operand
ast.go#L412: X Expr // operand
ast.go#L417: X Expr // left operand
ast.go#L420: Y Expr // right operand
ast.go#L427: Key Expr
ast.go#L429: Value Expr
ast.go#L449: Len Expr // Ellipsis node for [...]T array types, nil for slice types
ast.go#L450: Elt Expr // element type
ast.go#L480: Key Expr
ast.go#L481: Value Expr
ast.go#L489: Value Expr // value type
ast.go#L657: X Expr // expression
ast.go#L662: Chan Expr
ast.go#L664: Value Expr
ast.go#L669: X Expr
ast.go#L678: Lhs []Expr
ast.go#L681: Rhs []Expr
ast.go#L699: Results []Expr // result expressions; or nil
ast.go#L722: Cond Expr // condition
ast.go#L730: List []Expr // list of expressions or types; nil means default case
ast.go#L739: Tag Expr // tag expression; or nil
ast.go#L769: Cond Expr // condition; or nil
ast.go#L777: Key, Value Expr // Key, Value may be nil
ast.go#L781: X Expr // value to range over
ast.go#L923: Type Expr // value type; or nil
ast.go#L924: Values []Expr // initial values; or nil
ast.go#L934: Type Expr // *Ident, *ParenExpr, *SelectorExpr, *StarExpr, or any of the *XxxTypes
ast.go#L1147: func Unparen(e Expr) Expr {
filter.go#L63: func fieldName(x Expr) *Ident {
filter.go#L120: func filterExprList(list []Expr, filter Filter, export bool) []Expr {
filter.go#L153: func filterType(typ Expr, f Filter, export bool) bool {
go/doc
exports.go#L37: func filterExprList(list []ast.Expr, filter Filter, export bool) []ast.Expr {
exports.go#L170: func (r *reader) filterType(parent *namedType, typ ast.Expr) {
exports.go#L253: func copyConstType(typ ast.Expr, pos token.Pos) ast.Expr {
exports.go#L273: var prevType ast.Expr
reader.go#L32: func recvString(recv ast.Expr) string {
reader.go#L59: func recvParam(p ast.Expr) string {
reader.go#L83: var typ ast.Expr
reader.go#L125: func baseTypeName(x ast.Expr) (name string, imported bool) {
reader.go#L231: func (r *reader) recordAnonymousField(parent *namedType, fieldType ast.Expr) (fname string) {
reader.go#L347: func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) {
reader.go#L707: var typ ast.Expr = newIdent
go/parser
interface.go#L203: func ParseExprFrom(fset *token.FileSet, filename string, src any, mode Mode) (expr ast.Expr, err error) {
interface.go#L251: func ParseExpr(x string) (ast.Expr, error) {
parser.go#L496: func (p *parser) parseExprList() (list []ast.Expr) {
parser.go#L510: func (p *parser) parseList(inRhs bool) []ast.Expr {
parser.go#L521: func (p *parser) parseType() ast.Expr {
parser.go#L538: func (p *parser) parseQualifiedIdent(ident *ast.Ident) ast.Expr {
parser.go#L552: func (p *parser) parseTypeName(ident *ast.Ident) ast.Expr {
parser.go#L573: func (p *parser) parseArrayType(lbrack token.Pos, len ast.Expr) *ast.ArrayType {
parser.go#L601: func (p *parser) parseArrayFieldOrTypeInstance(x *ast.Ident) (*ast.Ident, ast.Expr) {
parser.go#L608: var args []ast.Expr
parser.go#L656: var typ ast.Expr
parser.go#L789: typ ast.Expr
parser.go#L875: func (p *parser) parseParameterList(name0 *ast.Ident, typ0 ast.Expr, closing token.Token, dddok bool) (params []*ast.Field) {
parser.go#L961: var typ ast.Expr // current type (from right to left)
parser.go#L1043: var typ ast.Expr
parser.go#L1135: var typ ast.Expr
parser.go#L1167: list := []ast.Expr{x}
parser.go#L1210: func (p *parser) embeddedElem(x ast.Expr) ast.Expr {
parser.go#L1229: func (p *parser) embeddedTerm() ast.Expr {
parser.go#L1341: func (p *parser) parseTypeInstance(typ ast.Expr) ast.Expr {
parser.go#L1348: var list []ast.Expr
parser.go#L1373: func (p *parser) tryIdentOrType() ast.Expr {
parser.go#L1452: func (p *parser) parseFuncTypeOrLit() ast.Expr {
parser.go#L1472: func (p *parser) parseOperand() ast.Expr {
parser.go#L1518: func (p *parser) parseSelector(x ast.Expr) ast.Expr {
parser.go#L1528: func (p *parser) parseTypeAssertion(x ast.Expr) ast.Expr {
parser.go#L1534: var typ ast.Expr
parser.go#L1546: func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
parser.go#L1568: var args []ast.Expr
parser.go#L1569: var index [N]ast.Expr
parser.go#L1630: func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
parser.go#L1637: var list []ast.Expr
parser.go#L1656: func (p *parser) parseValue() ast.Expr {
parser.go#L1670: func (p *parser) parseElement() ast.Expr {
parser.go#L1685: func (p *parser) parseElementList() (list []ast.Expr) {
parser.go#L1701: func (p *parser) parseLiteralValue(typ ast.Expr) ast.Expr {
parser.go#L1709: var elts []ast.Expr
parser.go#L1719: func (p *parser) parsePrimaryExpr(x ast.Expr) ast.Expr {
parser.go#L1792: func (p *parser) parseUnaryExpr() ast.Expr {
parser.go#L1875: func (p *parser) parseBinaryExpr(x ast.Expr, prec1 int) ast.Expr {
parser.go#L1901: func (p *parser) parseExpr() ast.Expr {
parser.go#L1909: func (p *parser) parseRhs() ast.Expr {
parser.go#L1947: var y []ast.Expr
parser.go#L1952: y = []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2057: var x []ast.Expr
parser.go#L2081: func (p *parser) makeExpr(s ast.Stmt, want string) ast.Expr {
parser.go#L2099: func (p *parser) parseIfHeader() (init ast.Stmt, cond ast.Expr) {
parser.go#L2197: var list []ast.Expr
parser.go#L2211: func isTypeSwitchAssert(x ast.Expr) bool {
parser.go#L2323: comm = &ast.AssignStmt{Lhs: lhs, TokPos: pos, Tok: tok, Rhs: []ast.Expr{rhs}}
parser.go#L2378: y := []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2406: var key, value ast.Expr
parser.go#L2557: var typ ast.Expr
parser.go#L2558: var values []ast.Expr
parser.go#L2592: func (p *parser) parseGenericType(spec *ast.TypeSpec, openPos token.Pos, name0 *ast.Ident, typ0 ast.Expr) {
parser.go#L2637: var x ast.Expr = p.parseIdent()
parser.go#L2701: func extractName(x ast.Expr, force bool) (*ast.Ident, ast.Expr) {
parser.go#L2739: func isTypeElem(x ast.Expr) bool {
parser.go#L2948: func packIndexExpr(x ast.Expr, lbrack token.Pos, exprs []ast.Expr, rbrack token.Pos) ast.Expr {
resolver.go#L229: func (r *resolver) walkExprs(list []ast.Expr) {
resolver.go#L235: func (r *resolver) walkLHS(list []ast.Expr) {
resolver.go#L419: var lhs []ast.Expr
resolver.go#L436: Rhs: []ast.Expr{&ast.UnaryExpr{Op: token.RANGE, X: n.X}},
resolver.go#L555: var declareExprs []ast.Expr // exprs to declare
resolver.go#L556: var resolveExprs []ast.Expr // exprs to resolve
resolver.go#L559: declareExprs = []ast.Expr{typ.Index}
go/types
api.go#L238: Types map[ast.Expr]TypeAndValue
api.go#L346: func (info *Info) TypeOf(e ast.Expr) Type {
api.go#L463: Rhs ast.Expr
assignments.go#L188: func (check *Checker) lhsVar(lhs ast.Expr) Type {
assignments.go#L252: func (check *Checker) assignVar(lhs, rhs ast.Expr, x *operand, context string) {
assignments.go#L354: func (check *Checker) assignError(rhs []ast.Expr, l, r int) {
assignments.go#L388: func (check *Checker) initVars(lhs []*Var, orig_rhs []ast.Expr, returnStmt ast.Stmt) {
assignments.go#L472: func (check *Checker) assignVars(lhs, orig_rhs []ast.Expr) {
assignments.go#L526: func (check *Checker) shortVarDecl(pos positioner, lhs, rhs []ast.Expr) {
call.go#L48: var xlist []ast.Expr
call.go#L132: func (check *Checker) instantiateSignature(pos token.Pos, expr ast.Expr, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L267: var xlist []ast.Expr
call.go#L343: func (check *Checker) exprList(elist []ast.Expr) (xlist []*operand) {
call.go#L365: func (check *Checker) genericExprList(elist []ast.Expr) (resList []*operand, targsList [][]Type) {
call.go#L462: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, xlist []ast.Expr, args []*operand, atargs [][]Type) (rsig *Signature) {
call.go#L716: check.errorf(e.Sel, UndeclaredImportedName, "undefined: %s", ast.Expr(e)) // cast to ast.Expr to silence vet
call.go#L729: check.errorf(e.Sel, UndeclaredImportedName, "undefined: %s (but have %s)", ast.Expr(e), exps[0].Name())
call.go#L731: check.errorf(e.Sel, UndeclaredImportedName, "undefined: %s", ast.Expr(e))
call.go#L805: check.errorf(e.Sel, NotAType, "%s is not a type", ast.Expr(e))
call.go#L985: func (check *Checker) use(args ...ast.Expr) bool { return check.useN(args, false) }
call.go#L990: func (check *Checker) useLHS(args ...ast.Expr) bool { return check.useN(args, true) }
call.go#L992: func (check *Checker) useN(args []ast.Expr, lhs bool) bool {
call.go#L1002: func (check *Checker) use1(e ast.Expr, lhs bool) bool {
check.go#L196: untyped map[ast.Expr]exprInfo // map of expressions without final type
check.go#L251: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L254: m = make(map[ast.Expr]exprInfo)
check.go#L617: func (check *Checker) recordTypeAndValueInSyntax(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L623: func (check *Checker) recordCommaOkTypesInSyntax(x ast.Expr, t0, t1 Type) {
check.go#L629: func instantiatedIdent(expr ast.Expr) *ast.Ident {
check.go#L630: var selOrIdent ast.Expr
decl.go#L343: typ ast.Expr
decl.go#L344: init []ast.Expr
decl.go#L408: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L454: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L504: check.initVars(lhs, []ast.Expr{init}, nil)
decl.go#L690: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L857: var init ast.Expr
decl.go#L888: var init ast.Expr
eval.go#L32: Types: make(map[ast.Expr]TypeAndValue),
eval.go#L56: func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
expr.go#L88: func opPos(x ast.Expr) token.Pos {
expr.go#L101: func opName(e ast.Expr) string {
expr.go#L260: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L374: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L617: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L779: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L972: func (check *Checker) rawExpr(T *target, x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L1045: func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1256: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1275: func (check *Checker) expr(T *target, x *operand, e ast.Expr) {
expr.go#L1282: func (check *Checker) genericExpr(x *operand, e ast.Expr) {
expr.go#L1293: func (check *Checker) multiExpr(e ast.Expr, allowCommaOk bool) (list []*operand, commaOk bool) {
expr.go#L1324: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1335: func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {
exprstring.go#L18: func ExprString(x ast.Expr) string {
exprstring.go#L27: func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
exprstring.go#L230: func writeExprList(buf *bytes.Buffer, list []ast.Expr) {
format.go#L42: case ast.Expr:
format.go#L44: case []ast.Expr:
index.go#L328: for i, expr := range []ast.Expr{e.Low, e.High, e.Max} {
index.go#L362: at := []ast.Expr{e.Low, e.High, e.Max}[i+1+j]
index.go#L374: func (check *Checker) singleIndex(expr *indexedExpr) ast.Expr {
index.go#L390: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L463: orig ast.Expr // the wrapped expr, which may be distinct from the IndexListExpr below.
index.go#L464: x ast.Expr // expression
index.go#L466: indices []ast.Expr // index expressions
index.go#L481: indices: []ast.Expr{e.Index},
literals.go#L325: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
mono.go#L176: func (w *monoGraph) recordInstance(pkg *Package, pos token.Pos, tparams []*TypeParam, targs []Type, xlist []ast.Expr) {
operand.go#L61: expr ast.Expr
range.go#L26: func (check *Checker) rangeStmt(inner stmtContext, rangeStmt *ast.RangeStmt, noNewVarPos positioner, sKey, sValue, sExtra, rangeVar ast.Expr, isDef bool) {
range.go#L95: lhs := [2]ast.Expr{sKey, sValue} // sKey, sValue may be nil
recording.go#L59: func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
recording.go#L77: func (check *Checker) recordBuiltinType(f ast.Expr, sig *Signature) {
recording.go#L97: func (check *Checker) recordCommaOkTypes(x ast.Expr, a []*operand) {
recording.go#L132: func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
resolver.go#L25: vtyp ast.Expr // type, or nil (for const and var declarations only)
resolver.go#L26: init ast.Expr // init/orig expression, or nil (for const and var declarations only)
resolver.go#L357: var init ast.Expr
resolver.go#L388: var init ast.Expr
resolver.go#L524: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, base ast.Expr, tparams []*ast.Ident) {
signature.go#L378: func (check *Checker) recordParenthesizedRecvTypes(expr ast.Expr, typ Type) {
stmt.go#L237: func (check *Checker) caseValues(x *operand, values []ast.Expr, seen valueMap) {
stmt.go#L277: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L307: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) Type {
stmt.go#L359: func (check *Checker) caseTypes_currently_unused(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) Type {
stmt.go#L689: var rhs ast.Expr
stmt.go#L745: seen := make(map[Type]ast.Expr) // map of seen types to positions
stmt.go#L799: var rhs ast.Expr // rhs of RecvStmt, or nil
struct.go#L181: func embeddedFieldIdent(e ast.Expr) *ast.Ident {
typexpr.go#L150: func (check *Checker) typ(e ast.Expr) Type {
typexpr.go#L157: func (check *Checker) varType(e ast.Expr) Type {
typexpr.go#L165: func (check *Checker) validVarType(e ast.Expr, typ Type) {
typexpr.go#L192: func (check *Checker) declaredType(e ast.Expr, def *TypeName) Type {
typexpr.go#L210: func (check *Checker) genericType(e ast.Expr, cause *string) Type {
typexpr.go#L232: func (check *Checker) typInternal(e0 ast.Expr, def *TypeName) (T Type) {
typexpr.go#L473: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L521: func (check *Checker) typeList(list []ast.Expr) []Type {
union.go#L54: func parseUnion(check *Checker, uexpr ast.Expr) Type {
union.go#L139: func parseTilde(check *Checker, tx ast.Expr) *Term {
union.go#L193: func flattenUnion(list []ast.Expr, x ast.Expr) (blist, tlist []ast.Expr) {
golang.org/x/tools/go/packages
packages.go#L1187: Types: make(map[ast.Expr]types.TypeAndValue),
golang.org/x/tools/go/types/typeutil
callee.go#L52: func usedIdent(info *types.Info, e ast.Expr) *ast.Ident {
golang.org/x/tools/internal/typeparams
common.go#L30: func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) {
common.go#L33: return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack
common.go#L43: func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr {
golang.org/x/tools/internal/typesinternal
classify_call.go#L129: func UsedIdent(info *types.Info, e ast.Expr) *ast.Ident {
classify_call.go#L134: func usedIdent(info *types.Info, e ast.Expr) *ast.Ident
types.go#L146: Types: map[ast.Expr]types.TypeAndValue{},
zerovalue.go#L127: func ZeroExpr(t types.Type, qual types.Qualifier) (_ ast.Expr, isValid bool) {
zerovalue.go#L186: Args: []ast.Expr{
zerovalue.go#L210: func IsZeroExpr(expr ast.Expr) bool {
zerovalue.go#L224: func TypeExpr(t types.Type, qual types.Qualifier) ast.Expr {
zerovalue.go#L316: var expr ast.Expr = ast.NewIdent(t.Obj().Name())
zerovalue.go#L328: var indices []ast.Expr
zerovalue.go#L364: var union ast.Expr