github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/typecheck/expr.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package typecheck 6 7 import ( 8 "github.com/shogo82148/std/cmd/compile/internal/ir" 9 "github.com/shogo82148/std/cmd/compile/internal/types" 10 "github.com/shogo82148/std/cmd/internal/src" 11 ) 12 13 // DotField returns a field selector expression that selects the 14 // index'th field of the given expression, which must be of struct or 15 // pointer-to-struct type. 16 func DotField(pos src.XPos, x ir.Node, index int) *ir.SelectorExpr 17 18 // XDotMethod returns an expression representing the field selection 19 // x.sym. If any implicit field selection are necessary, those are 20 // inserted too. 21 func XDotField(pos src.XPos, x ir.Node, sym *types.Sym) *ir.SelectorExpr 22 23 // XDotMethod returns an expression representing the method value 24 // x.sym (i.e., x is a value, not a type). If any implicit field 25 // selection are necessary, those are inserted too. 26 // 27 // If callee is true, the result is an ODOTMETH/ODOTINTER, otherwise 28 // an OMETHVALUE. 29 func XDotMethod(pos src.XPos, x ir.Node, sym *types.Sym, callee bool) *ir.SelectorExpr