type go/ast.Expr
311 uses
go/ast (current package)
ast.go#L38: type Expr interface {
ast.go#L200: Type Expr // field/method/parameter type; or nil
ast.go#L298: Elt Expr // ellipsis element type (parameter lists only); or nil
ast.go#L328: Type Expr // literal type; or nil
ast.go#L330: Elts []Expr // list of composite elements; or nil
ast.go#L338: X Expr // parenthesized expression
ast.go#L344: X Expr // expression
ast.go#L350: X Expr // expression
ast.go#L352: Index Expr // index expression
ast.go#L359: X Expr // expression
ast.go#L361: Indices []Expr // index expressions
ast.go#L367: X Expr // expression
ast.go#L369: Low Expr // begin of slice range; or nil
ast.go#L370: High Expr // end of slice range; or nil
ast.go#L371: Max Expr // maximum capacity of slice; or nil
ast.go#L380: X Expr // expression
ast.go#L382: Type Expr // asserted type; nil means type switch X.(type)
ast.go#L388: Fun Expr // function expression
ast.go#L390: Args []Expr // function arguments; or nil
ast.go#L400: X Expr // operand
ast.go#L409: X Expr // operand
ast.go#L414: X Expr // left operand
ast.go#L417: Y Expr // right operand
ast.go#L424: Key Expr
ast.go#L426: Value Expr
ast.go#L446: Len Expr // Ellipsis node for [...]T array types, nil for slice types
ast.go#L447: Elt Expr // element type
ast.go#L477: Key Expr
ast.go#L478: Value Expr
ast.go#L486: Value Expr // value type
ast.go#L646: X Expr // expression
ast.go#L651: Chan Expr
ast.go#L653: Value Expr
ast.go#L658: X Expr
ast.go#L667: Lhs []Expr
ast.go#L670: Rhs []Expr
ast.go#L688: Results []Expr // result expressions; or nil
ast.go#L711: Cond Expr // condition
ast.go#L719: List []Expr // list of expressions or types; nil means default case
ast.go#L728: Tag Expr // tag expression; or nil
ast.go#L758: Cond Expr // condition; or nil
ast.go#L766: Key, Value Expr // Key, Value may be nil
ast.go#L770: X Expr // value to range over
ast.go#L912: Type Expr // value type; or nil
ast.go#L913: Values []Expr // initial values; or nil
ast.go#L923: Type Expr // *Ident, *ParenExpr, *SelectorExpr, *StarExpr, or any of the *XxxTypes
ast.go#L1136: func Unparen(e Expr) Expr {
filter.go#L60: func fieldName(x Expr) *Ident {
filter.go#L117: func filterExprList(list []Expr, filter Filter, export bool) []Expr {
filter.go#L150: 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#L198: func ParseExprFrom(fset *token.FileSet, filename string, src any, mode Mode) (expr ast.Expr, err error) {
interface.go#L246: 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) (params []*ast.Field) {
parser.go#L961: var typ ast.Expr // current type (from right to left)
parser.go#L1023: var typ ast.Expr
parser.go#L1119: var typ ast.Expr
parser.go#L1151: list := []ast.Expr{x}
parser.go#L1194: func (p *parser) embeddedElem(x ast.Expr) ast.Expr {
parser.go#L1213: func (p *parser) embeddedTerm() ast.Expr {
parser.go#L1325: func (p *parser) parseTypeInstance(typ ast.Expr) ast.Expr {
parser.go#L1332: var list []ast.Expr
parser.go#L1357: func (p *parser) tryIdentOrType() ast.Expr {
parser.go#L1436: func (p *parser) parseFuncTypeOrLit() ast.Expr {
parser.go#L1456: func (p *parser) parseOperand() ast.Expr {
parser.go#L1498: func (p *parser) parseSelector(x ast.Expr) ast.Expr {
parser.go#L1508: func (p *parser) parseTypeAssertion(x ast.Expr) ast.Expr {
parser.go#L1514: var typ ast.Expr
parser.go#L1526: func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
parser.go#L1548: var args []ast.Expr
parser.go#L1549: var index [N]ast.Expr
parser.go#L1610: func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
parser.go#L1617: var list []ast.Expr
parser.go#L1636: func (p *parser) parseValue() ast.Expr {
parser.go#L1650: func (p *parser) parseElement() ast.Expr {
parser.go#L1665: func (p *parser) parseElementList() (list []ast.Expr) {
parser.go#L1681: func (p *parser) parseLiteralValue(typ ast.Expr) ast.Expr {
parser.go#L1689: var elts []ast.Expr
parser.go#L1699: func (p *parser) parsePrimaryExpr(x ast.Expr) ast.Expr {
parser.go#L1772: func (p *parser) parseUnaryExpr() ast.Expr {
parser.go#L1855: func (p *parser) parseBinaryExpr(x ast.Expr, prec1 int) ast.Expr {
parser.go#L1881: func (p *parser) parseExpr() ast.Expr {
parser.go#L1889: func (p *parser) parseRhs() ast.Expr {
parser.go#L1927: var y []ast.Expr
parser.go#L1932: y = []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2037: var x []ast.Expr
parser.go#L2061: func (p *parser) makeExpr(s ast.Stmt, want string) ast.Expr {
parser.go#L2079: func (p *parser) parseIfHeader() (init ast.Stmt, cond ast.Expr) {
parser.go#L2177: var list []ast.Expr
parser.go#L2191: func isTypeSwitchAssert(x ast.Expr) bool {
parser.go#L2303: comm = &ast.AssignStmt{Lhs: lhs, TokPos: pos, Tok: tok, Rhs: []ast.Expr{rhs}}
parser.go#L2358: y := []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2386: var key, value ast.Expr
parser.go#L2535: var typ ast.Expr
parser.go#L2536: var values []ast.Expr
parser.go#L2570: func (p *parser) parseGenericType(spec *ast.TypeSpec, openPos token.Pos, name0 *ast.Ident, typ0 ast.Expr) {
parser.go#L2617: var x ast.Expr = p.parseIdent()
parser.go#L2681: func extractName(x ast.Expr, force bool) (*ast.Ident, ast.Expr) {
parser.go#L2719: func isTypeElem(x ast.Expr) bool {
parser.go#L2924: 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/printer
nodes.go#L105: xlist := make([]ast.Expr, len(list))
nodes.go#L126: func (p *printer) exprList(prev0 token.Pos, list []ast.Expr, depth int, mode exprListMode, next0 token.Pos, isIncomplete bool) {
nodes.go#L406: func combinesWithName(x ast.Expr) bool {
nodes.go#L421: func isTypeElem(x ast.Expr) bool {
nodes.go#L716: func diffPrec(expr ast.Expr, prec int) int {
nodes.go#L808: func isBinary(expr ast.Expr) bool {
nodes.go#L813: func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
nodes.go#L933: indices := []ast.Expr{x.Low, x.High}
nodes.go#L1147: func (p *printer) possibleSelectorExpr(expr ast.Expr, prec1, depth int) bool {
nodes.go#L1174: func (p *printer) expr0(x ast.Expr, depth int) {
nodes.go#L1178: func (p *printer) expr(x ast.Expr) {
nodes.go#L1236: func isTypeName(x ast.Expr) bool {
nodes.go#L1246: func stripParens(x ast.Expr) ast.Expr {
nodes.go#L1272: func stripParensAlways(x ast.Expr) ast.Expr {
nodes.go#L1279: func (p *printer) controlClause(isForStmt bool, init ast.Stmt, expr ast.Expr, post ast.Stmt) {
nodes.go#L1316: func (p *printer) indentList(list []ast.Expr) bool {
printer.go#L1147: case ast.Expr:
go/types
api.go#L233: Types map[ast.Expr]TypeAndValue
api.go#L338: func (info *Info) TypeOf(e ast.Expr) Type {
api.go#L455: 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#L35: func (check *Checker) funcInst(T *target, pos token.Pos, x *operand, ix *indexedExpr, infer bool) ([]Type, []ast.Expr) {
call.go#L49: var xlist []ast.Expr
call.go#L133: func (check *Checker) instantiateSignature(pos token.Pos, expr ast.Expr, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L261: var xlist []ast.Expr
call.go#L337: func (check *Checker) exprList(elist []ast.Expr) (xlist []*operand) {
call.go#L359: func (check *Checker) genericExprList(elist []ast.Expr) (resList []*operand, targsList [][]Type, xlistList [][]ast.Expr) {
call.go#L394: xlistList = [][]ast.Expr{xlist}
call.go#L422: xlistList = make([][]ast.Expr, n)
call.go#L462: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, xlist []ast.Expr, args []*operand, atargs [][]Type, atxlist [][]ast.Expr) (rsig *Signature) {
call.go#L716: check.errorf(e.Sel, UndeclaredImportedName, "undefined: %s", ast.Expr(e)) // cast to ast.Expr to silence vet
call.go#L725: check.errorf(e.Sel, UndeclaredImportedName, "undefined: %s", ast.Expr(e))
call.go#L804: check.errorf(e.Sel, NotAType, "%s is not a type", ast.Expr(e))
call.go#L983: func (check *Checker) use(args ...ast.Expr) bool { return check.useN(args, false) }
call.go#L988: func (check *Checker) useLHS(args ...ast.Expr) bool { return check.useN(args, true) }
call.go#L990: func (check *Checker) useN(args []ast.Expr, lhs bool) bool {
call.go#L1000: func (check *Checker) use1(e ast.Expr, lhs bool) bool {
check.go#L191: untyped map[ast.Expr]exprInfo // map of expressions without final type
check.go#L244: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L247: m = make(map[ast.Expr]exprInfo)
check.go#L572: func (check *Checker) recordTypeAndValueInSyntax(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L578: func (check *Checker) recordCommaOkTypesInSyntax(x ast.Expr, t0, t1 Type) {
check.go#L584: func instantiatedIdent(expr ast.Expr) *ast.Ident {
check.go#L585: var selOrIdent ast.Expr
decl.go#L367: typ ast.Expr
decl.go#L368: init []ast.Expr
decl.go#L432: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L478: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L528: check.initVars(lhs, []ast.Expr{init}, nil)
decl.go#L711: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L887: var init ast.Expr
decl.go#L918: 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#L230: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L344: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L591: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L753: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L942: func (check *Checker) rawExpr(T *target, x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L995: func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1207: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1226: func (check *Checker) expr(T *target, x *operand, e ast.Expr) {
expr.go#L1233: func (check *Checker) genericExpr(x *operand, e ast.Expr) {
expr.go#L1244: func (check *Checker) multiExpr(e ast.Expr, allowCommaOk bool) (list []*operand, commaOk bool) {
expr.go#L1275: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1286: 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#L31: case ast.Expr:
format.go#L33: case []ast.Expr:
index.go#L287: for i, expr := range []ast.Expr{e.Low, e.High, e.Max} {
index.go#L321: at := []ast.Expr{e.Low, e.High, e.Max}[i+1+j]
index.go#L333: func (check *Checker) singleIndex(expr *indexedExpr) ast.Expr {
index.go#L349: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L422: orig ast.Expr // the wrapped expr, which may be distinct from the IndexListExpr below.
index.go#L423: x ast.Expr // expression
index.go#L425: indices []ast.Expr // index expressions
index.go#L440: indices: []ast.Expr{e.Index},
literals.go#L353: 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
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#L513: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, base ast.Expr, tparams []*ast.Ident) {
signature.go#L330: func (check *Checker) recordParenthesizedRecvTypes(expr ast.Expr, typ Type) {
stmt.go#L235: func (check *Checker) caseValues(x *operand, values []ast.Expr, seen valueMap) {
stmt.go#L275: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L305: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) Type {
stmt.go#L357: func (check *Checker) caseTypes_currently_unused(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) Type {
stmt.go#L699: var rhs ast.Expr
stmt.go#L755: seen := make(map[Type]ast.Expr) // map of seen types to positions
stmt.go#L809: var rhs ast.Expr // rhs of RecvStmt, or nil
stmt.go#L877: type Expr = ast.Expr
stmt.go#L881: var sExtra ast.Expr = nil // (used only in types2 fork)
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) definedType(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#L508: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L556: 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
gotest.tools/v3/assert/cmp
result.go#L64: func (r templatedResult) FailureMessage(args []ast.Expr) string {
result.go#L85: func renderMessage(result templatedResult, args []ast.Expr) (string, error) {
result.go#L88: "callArg": func(index int) ast.Expr {
gotest.tools/v3/internal/assert
assert.go#L117: func boolFailureMessage(expr ast.Expr) (string, error) {
result.go#L65: FailureMessage(args []ast.Expr) string
result.go#L84: func filterPrintableExpr(args []ast.Expr) []ast.Expr {
result.go#L85: result := make([]ast.Expr, len(args))
result.go#L100: func isShortPrintableExpr(expr ast.Expr) bool {
result.go#L112: type argSelector func([]ast.Expr) []ast.Expr
result.go#L116: func ArgsAfterT(args []ast.Expr) []ast.Expr {
result.go#L126: func ArgsFromComparisonCall(args []ast.Expr) []ast.Expr {
result.go#L138: func ArgsAtZeroIndex(args []ast.Expr) []ast.Expr {
gotest.tools/v3/internal/source
source.go#L31: func CallExprArgs(stackIndex int) ([]ast.Expr, error) {
source.go#L79: func getCallExprArgs(fileset *token.FileSet, astFile ast.Node, line int) ([]ast.Expr, error) {
update.go#L141: func getIdentForExpectedValueArg(expr []ast.Expr) (int, *ast.Ident) {