Now that checknil has only a single caller, inline it.
Passes toolstash-check.
Change-Id: I5b13596bef84dd9a3e7f4bff8560903f1e54acfb
Reviewed-on: https://go-review.googlesource.com/c/148829
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
// Trigger panic for method on nil interface now.
// Otherwise it happens in the wrapper and is confusing.
n.Left = cheapexpr(n.Left, init)
+ n.Left = walkexpr(n.Left, nil)
- checknil(n.Left, init)
+ tab := nod(OITAB, n.Left, nil)
+ tab = typecheck(tab, ctxExpr)
+
+ c := nod(OCHECKNIL, tab, nil)
+ c.SetTypecheck(1)
+ init.Append(c)
}
typ := partialCallType(n)
return false
}
-func checknil(x *Node, init *Nodes) {
- x = walkexpr(x, nil) // caller has not done this yet
- if x.Type.IsInterface() {
- x = nod(OITAB, x, nil)
- x = typecheck(x, ctxExpr)
- }
-
- n := nod(OCHECKNIL, x, nil)
- n.SetTypecheck(1)
- init.Append(n)
-}
-
// Can this type be stored directly in an interface word?
// Yes, if the representation is a single pointer.
func isdirectiface(t *types.Type) bool {