type go/ast.Expr
284 uses
go/ast (current package)
ast.go#L39: type Expr interface {
ast.go#L199: Type Expr // field/method/parameter type; or nil
ast.go#L298: Elt Expr // ellipsis element type (parameter lists only); or nil
ast.go#L316: Type Expr // literal type; or nil
ast.go#L318: Elts []Expr // list of composite elements; or nil
ast.go#L326: X Expr // parenthesized expression
ast.go#L332: X Expr // expression
ast.go#L338: X Expr // expression
ast.go#L340: Index Expr // index expression
ast.go#L347: X Expr // expression
ast.go#L349: Indices []Expr // index expressions
ast.go#L355: X Expr // expression
ast.go#L357: Low Expr // begin of slice range; or nil
ast.go#L358: High Expr // end of slice range; or nil
ast.go#L359: Max Expr // maximum capacity of slice; or nil
ast.go#L368: X Expr // expression
ast.go#L370: Type Expr // asserted type; nil means type switch X.(type)
ast.go#L376: Fun Expr // function expression
ast.go#L378: Args []Expr // function arguments; or nil
ast.go#L388: X Expr // operand
ast.go#L397: X Expr // operand
ast.go#L402: X Expr // left operand
ast.go#L405: Y Expr // right operand
ast.go#L412: Key Expr
ast.go#L414: Value Expr
ast.go#L436: Len Expr // Ellipsis node for [...]T array types, nil for slice types
ast.go#L437: Elt Expr // element type
ast.go#L467: Key Expr
ast.go#L468: Value Expr
ast.go#L476: Value Expr // value type
ast.go#L641: X Expr // expression
ast.go#L646: Chan Expr
ast.go#L648: Value Expr
ast.go#L653: X Expr
ast.go#L662: Lhs []Expr
ast.go#L665: Rhs []Expr
ast.go#L683: Results []Expr // result expressions; or nil
ast.go#L706: Cond Expr // condition
ast.go#L714: List []Expr // list of expressions or types; nil means default case
ast.go#L723: Tag Expr // tag expression; or nil
ast.go#L753: Cond Expr // condition; or nil
ast.go#L761: Key, Value Expr // Key, Value may be nil
ast.go#L764: X Expr // value to range over
ast.go#L908: Type Expr // value type; or nil
ast.go#L909: Values []Expr // initial values; or nil
ast.go#L919: Type Expr // *Ident, *ParenExpr, *SelectorExpr, *StarExpr, or any of the *XxxTypes
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 {
walk.go#L24: func walkExprList(v Visitor, list []Expr) {
go/doc
exports.go#L38: func filterExprList(list []ast.Expr, filter Filter, export bool) []ast.Expr {
exports.go#L175: func (r *reader) filterType(parent *namedType, typ ast.Expr) {
exports.go#L259: func copyConstType(typ ast.Expr, pos token.Pos) ast.Expr {
exports.go#L279: var prevType ast.Expr
reader.go#L30: func recvString(recv ast.Expr) string {
reader.go#L57: func recvParam(p ast.Expr) string {
reader.go#L82: var typ ast.Expr
reader.go#L126: func baseTypeName(x ast.Expr) (name string, imported bool) {
reader.go#L233: func (r *reader) recordAnonymousField(parent *namedType, fieldType ast.Expr) (fname string) {
reader.go#L351: func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) {
reader.go#L673: var typ ast.Expr = newIdent
go/internal/typeparams
typeparams.go#L12: func PackIndexExpr(x ast.Expr, lbrack token.Pos, exprs []ast.Expr, rbrack token.Pos) ast.Expr {
typeparams.go#L37: Orig ast.Expr // the wrapped expr, which may be distinct from the IndexListExpr below.
typeparams.go#L47: Indices: []ast.Expr{e.Index},
go/parser
interface.go#L191: func ParseExprFrom(fset *token.FileSet, filename string, src any, mode Mode) (expr ast.Expr, err error) {
interface.go#L236: func ParseExpr(x string) (ast.Expr, error) {
parser.go#L453: func (p *parser) parseExprList() (list []ast.Expr) {
parser.go#L467: func (p *parser) parseList(inRhs bool) []ast.Expr {
parser.go#L478: func (p *parser) parseType() ast.Expr {
parser.go#L495: func (p *parser) parseQualifiedIdent(ident *ast.Ident) ast.Expr {
parser.go#L509: func (p *parser) parseTypeName(ident *ast.Ident) ast.Expr {
parser.go#L530: func (p *parser) parseArrayType(lbrack token.Pos, len ast.Expr) *ast.ArrayType {
parser.go#L558: func (p *parser) parseArrayFieldOrTypeInstance(x *ast.Ident) (*ast.Ident, ast.Expr) {
parser.go#L566: var args []ast.Expr
parser.go#L624: var typ ast.Expr
parser.go#L721: typ ast.Expr
parser.go#L807: func (p *parser) parseParameterList(name0 *ast.Ident, typ0 ast.Expr, closing token.Token) (params []*ast.Field) {
parser.go#L872: var typ ast.Expr
parser.go#L914: var typ ast.Expr
parser.go#L1010: var typ ast.Expr
parser.go#L1042: list := []ast.Expr{x}
parser.go#L1085: func (p *parser) embeddedElem(x ast.Expr) ast.Expr {
parser.go#L1104: func (p *parser) embeddedTerm() ast.Expr {
parser.go#L1221: func (p *parser) parseTypeInstance(typ ast.Expr) ast.Expr {
parser.go#L1229: var list []ast.Expr
parser.go#L1254: func (p *parser) tryIdentOrType() ast.Expr {
parser.go#L1332: func (p *parser) parseFuncTypeOrLit() ast.Expr {
parser.go#L1353: func (p *parser) parseOperand() ast.Expr {
parser.go#L1395: func (p *parser) parseSelector(x ast.Expr) ast.Expr {
parser.go#L1405: func (p *parser) parseTypeAssertion(x ast.Expr) ast.Expr {
parser.go#L1411: var typ ast.Expr
parser.go#L1423: func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
parser.go#L1445: var args []ast.Expr
parser.go#L1446: var index [N]ast.Expr
parser.go#L1514: func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
parser.go#L1521: var list []ast.Expr
parser.go#L1540: func (p *parser) parseValue() ast.Expr {
parser.go#L1554: func (p *parser) parseElement() ast.Expr {
parser.go#L1569: func (p *parser) parseElementList() (list []ast.Expr) {
parser.go#L1585: func (p *parser) parseLiteralValue(typ ast.Expr) ast.Expr {
parser.go#L1591: var elts []ast.Expr
parser.go#L1602: func (p *parser) checkExpr(x ast.Expr) ast.Expr {
parser.go#L1634: func unparen(x ast.Expr) ast.Expr {
parser.go#L1644: func (p *parser) checkExprOrType(x ast.Expr) ast.Expr {
parser.go#L1659: func (p *parser) parsePrimaryExpr(x ast.Expr) ast.Expr {
parser.go#L1726: func (p *parser) parseUnaryExpr() ast.Expr {
parser.go#L1808: func (p *parser) parseBinaryExpr(x ast.Expr, prec1 int, check bool) ast.Expr {
parser.go#L1833: func (p *parser) checkBinaryExpr(x ast.Expr) {
parser.go#L1851: func (p *parser) parseExpr() ast.Expr {
parser.go#L1859: func (p *parser) parseRhs() ast.Expr {
parser.go#L1867: func (p *parser) parseRhsOrType() ast.Expr {
parser.go#L1905: var y []ast.Expr
parser.go#L1910: y = []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2023: var x []ast.Expr
parser.go#L2047: func (p *parser) makeExpr(s ast.Stmt, want string) ast.Expr {
parser.go#L2065: func (p *parser) parseIfHeader() (init ast.Stmt, cond ast.Expr) {
parser.go#L2155: func (p *parser) parseTypeList() (list []ast.Expr) {
parser.go#L2175: var list []ast.Expr
parser.go#L2193: func isTypeSwitchAssert(x ast.Expr) bool {
parser.go#L2305: as := &ast.AssignStmt{Lhs: lhs, TokPos: pos, Tok: tok, Rhs: []ast.Expr{rhs}}
parser.go#L2364: y := []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}}
parser.go#L2392: var key, value ast.Expr
parser.go#L2550: var values []ast.Expr
parser.go#L2579: func (p *parser) parseGenericType(spec *ast.TypeSpec, openPos token.Pos, name0 *ast.Ident, typ0 ast.Expr) {
parser.go#L2626: var x ast.Expr = p.parseIdent()
parser.go#L2639: var ptype ast.Expr // ptype != nil means ptype is the type parameter type; pname != nil in this case
parser.go#L2711: func isTypeLit(x ast.Expr) bool {
resolver.go#L225: func (r *resolver) walkExprs(list []ast.Expr) {
resolver.go#L231: func (r *resolver) walkLHS(list []ast.Expr) {
resolver.go#L415: var lhs []ast.Expr
resolver.go#L432: Rhs: []ast.Expr{&ast.UnaryExpr{Op: token.RANGE, X: n.X}},
resolver.go#L551: var declareExprs []ast.Expr // exprs to declare
resolver.go#L552: var resolveExprs []ast.Expr // exprs to resolve
resolver.go#L555: declareExprs = []ast.Expr{typ.Index}
go/printer
nodes.go#L110: xlist := make([]ast.Expr, len(list))
nodes.go#L130: func (p *printer) exprList(prev0 token.Pos, list []ast.Expr, depth int, mode exprListMode, next0 token.Pos, isIncomplete bool) {
nodes.go#L406: func isTypeLit(x ast.Expr) bool {
nodes.go#L697: func diffPrec(expr ast.Expr, prec int) int {
nodes.go#L788: func isBinary(expr ast.Expr) bool {
nodes.go#L793: func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
nodes.go#L902: indices := []ast.Expr{x.Low, x.High}
nodes.go#L1098: func (p *printer) possibleSelectorExpr(expr ast.Expr, prec1, depth int) bool {
nodes.go#L1122: func (p *printer) expr0(x ast.Expr, depth int) {
nodes.go#L1126: func (p *printer) expr(x ast.Expr) {
nodes.go#L1182: func isTypeName(x ast.Expr) bool {
nodes.go#L1192: func stripParens(x ast.Expr) ast.Expr {
nodes.go#L1218: func stripParensAlways(x ast.Expr) ast.Expr {
nodes.go#L1225: func (p *printer) controlClause(isForStmt bool, init ast.Stmt, expr ast.Expr, post ast.Stmt) {
nodes.go#L1263: func (p *printer) indentList(list []ast.Expr) bool {
printer.go#L1134: case ast.Expr:
go/types
api.go#L200: Types map[ast.Expr]TypeAndValue
api.go#L286: func (info *Info) TypeOf(e ast.Expr) Type {
api.go#L387: Rhs ast.Expr
assignments.go#L167: func (check *Checker) assignVar(lhs ast.Expr, x *operand) Type {
assignments.go#L300: func (check *Checker) assignError(rhs []ast.Expr, nvars, nvals int) {
assignments.go#L316: func (check *Checker) initVars(lhs []*Var, origRHS []ast.Expr, returnStmt ast.Stmt) {
assignments.go#L376: func (check *Checker) assignVars(lhs, origRHS []ast.Expr) {
assignments.go#L409: func (check *Checker) shortVarDecl(pos positioner, lhs, rhs []ast.Expr) {
builtins.go#L903: func unparen(e ast.Expr) ast.Expr {
call.go#L63: func (check *Checker) instantiateSignature(pos token.Pos, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L183: var xlist []ast.Expr
call.go#L244: func (check *Checker) exprList(elist []ast.Expr, allowCommaOk bool) (xlist []*operand, commaOk bool) {
call.go#L288: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, args []*operand, xlist []ast.Expr) (rsig *Signature) {
call.go#L730: func (check *Checker) use(arg ...ast.Expr) {
call.go#L745: func (check *Checker) useLHS(arg ...ast.Expr) {
check.go#L133: untyped map[ast.Expr]exprInfo // map of expressions without final type
check.go#L179: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L182: m = make(map[ast.Expr]exprInfo)
check.go#L444: func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L461: func (check *Checker) recordBuiltinType(f ast.Expr, sig *Signature) {
check.go#L479: func (check *Checker) recordCommaOkTypes(x ast.Expr, a [2]Type) {
check.go#L511: func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
check.go#L520: func instantiatedIdent(expr ast.Expr) *ast.Ident {
check.go#L521: var selOrIdent ast.Expr
decl.go#L352: typ ast.Expr
decl.go#L353: init []ast.Expr
decl.go#L417: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L463: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L520: check.initVars(lhs, []ast.Expr{init}, nil)
decl.go#L651: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L826: var init ast.Expr
decl.go#L857: var init ast.Expr
errors.go#L90: case ast.Expr:
errors.go#L92: case []ast.Expr:
eval.go#L32: Types: make(map[ast.Expr]TypeAndValue),
eval.go#L57: func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
expr.go#L120: func opName(e ast.Expr) string {
expr.go#L475: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L479: func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool) {
expr.go#L597: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L896: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L1062: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L1198: func (check *Checker) rawExpr(x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L1246: func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1684: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1704: func (check *Checker) expr(x *operand, e ast.Expr) {
expr.go#L1711: func (check *Checker) multiExpr(x *operand, e ast.Expr) {
expr.go#L1720: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1732: func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {
exprstring.go#L19: func ExprString(x ast.Expr) string {
exprstring.go#L28: func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
exprstring.go#L228: func writeExprList(buf *bytes.Buffer, list []ast.Expr) {
index.go#L285: for i, expr := range []ast.Expr{e.Low, e.High, e.Max} {
index.go#L319: at := []ast.Expr{e.Low, e.High, e.Max}[i+1+j]
index.go#L331: func (check *Checker) singleIndex(expr *typeparams.IndexExpr) ast.Expr {
index.go#L347: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L415: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
mono.go#L170: func (w *monoGraph) recordInstance(pkg *Package, pos token.Pos, tparams []*TypeParam, targs []Type, xlist []ast.Expr) {
operand.go#L55: expr ast.Expr
resolver.go#L23: vtyp ast.Expr // type, or nil (for const and var declarations only)
resolver.go#L24: init ast.Expr // init/orig expression, or nil (for const and var declarations only)
resolver.go#L343: var init ast.Expr
resolver.go#L374: var init ast.Expr
resolver.go#L497: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, rname *ast.Ident, tparams []*ast.Ident) {
resolver.go#L560: var typ ast.Expr = name
stmt.go#L237: func (check *Checker) caseValues(x *operand, values []ast.Expr, seen valueMap) {
stmt.go#L275: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L285: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) (T Type) {
stmt.go#L645: var rhs ast.Expr
stmt.go#L702: seen := make(map[Type]ast.Expr) // map of seen types to positions
stmt.go#L765: var rhs ast.Expr // rhs of RecvStmt, or nil
stmt.go#L867: lhs := [2]ast.Expr{s.Key, s.Value}
struct.go#L179: func embeddedFieldIdent(e ast.Expr) *ast.Ident {
typexpr.go#L138: func (check *Checker) typ(e ast.Expr) Type {
typexpr.go#L145: func (check *Checker) varType(e ast.Expr) Type {
typexpr.go#L153: func (check *Checker) validVarType(e ast.Expr, typ Type) {
typexpr.go#L181: func (check *Checker) definedType(e ast.Expr, def *Named) Type {
typexpr.go#L195: func (check *Checker) genericType(e ast.Expr, reason *string) Type {
typexpr.go#L218: func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
typexpr.go#L497: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L541: func (check *Checker) typeList(list []ast.Expr) []Type {
union.go#L53: func parseUnion(check *Checker, uexpr ast.Expr) Type {
union.go#L138: func parseTilde(check *Checker, tx ast.Expr) *Term {
union.go#L188: func flattenUnion(list []ast.Expr, x ast.Expr) (blist, tlist []ast.Expr) {
golang.org/x/tools/go/packages
packages.go#L996: Types: make(map[ast.Expr]types.TypeAndValue),
golang.org/x/tools/internal/typeparams
common.go#L40: func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) {
common.go#L43: return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack
common.go#L53: func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) 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) {