}
func (n *Name) FrameOffset() int64 { return n.Offset_ }
func (n *Name) SetFrameOffset(x int64) { n.Offset_ = x }
-func (n *Name) Walkdef() uint8 { return n.bits.get2(miniWalkdefShift) }
-func (n *Name) SetWalkdef(x uint8) {
- if x > 3 {
- panic(fmt.Sprintf("cannot SetWalkdef %d", x))
- }
- n.bits.set2(miniWalkdefShift, x)
-}
func (n *Name) Linksym() *obj.LSym { return n.sym.Linksym() }
func (n *Name) LinksymABI(abi obj.ABI) *obj.LSym { return n.sym.LinksymABI(abi) }
// marks variables that escape the local frame.
// rewrites n.Op to be more specific in some cases.
-var typecheckdefstack []*ir.Name
-
// Resolve resolves an ONONAME node to a definition, if any. If n is not an ONONAME node,
// Resolve returns n unchanged. If n is an ONONAME node and not in the same package,
// then n.Sym() is resolved using import data. Otherwise, Resolve returns
// typecheck1 should ONLY be called from typecheck.
func typecheck1(n ir.Node, top int) ir.Node {
- if n, ok := n.(*ir.Name); ok {
- typecheckdef(n)
- }
-
switch n.Op() {
default:
ir.Dump("typecheck", n)
return Expr(nn)
}
-func typecheckdef(n *ir.Name) {
- if base.EnableTrace && base.Flag.LowerT {
- defer tracePrint("typecheckdef", n)(nil)
- }
-
- if n.Walkdef() == 1 {
- return
- }
-
- if n.Type() != nil { // builtin
- // Mark as Walkdef so that if n.SetType(nil) is called later, we
- // won't try walking again.
- if got := n.Walkdef(); got != 0 {
- base.Fatalf("unexpected walkdef: %v", got)
- }
- n.SetWalkdef(1)
- return
- }
-
- lno := ir.SetPos(n)
- if n.Walkdef() == 2 {
- base.Fatalf("typecheckdef loop")
- }
-
- n.SetWalkdef(2)
-
- switch n.Op() {
- default:
- base.Fatalf("typecheckdef %v", n.Op())
-
- case ir.ONAME:
- if n.BuiltinOp != 0 { // like OPRINTN
- base.Assertf(n.Ntype == nil, "unexpected Ntype: %+v", n)
- break
- }
-
- base.Assertf(n.Class == ir.PFUNC, "expected PFUNC: %+v", n)
-
- if n.Ntype != nil {
- n.Ntype = typecheckNtype(n.Ntype)
- n.SetType(n.Ntype.Type())
- }
-
- if n.Type() != nil {
- break
- }
-
- base.Fatalf("missing type: %v", n)
- }
-
- base.Pos = lno
- n.SetWalkdef(1)
-}
-
func checkmake(t *types.Type, arg string, np *ir.Node) bool {
n := *np
if !n.Type().IsInteger() && n.Type().Kind() != types.TIDEAL {