Commit 1e58bb14 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: inline checknil

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e90e7a59
...@@ -523,8 +523,14 @@ func walkpartialcall(n *Node, init *Nodes) *Node { ...@@ -523,8 +523,14 @@ func walkpartialcall(n *Node, init *Nodes) *Node {
// Trigger panic for method on nil interface now. // Trigger panic for method on nil interface now.
// Otherwise it happens in the wrapper and is confusing. // Otherwise it happens in the wrapper and is confusing.
n.Left = cheapexpr(n.Left, init) 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) typ := partialCallType(n)
......
...@@ -1829,18 +1829,6 @@ func isbadimport(path string, allowSpace bool) bool { ...@@ -1829,18 +1829,6 @@ func isbadimport(path string, allowSpace bool) bool {
return false 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? // Can this type be stored directly in an interface word?
// Yes, if the representation is a single pointer. // Yes, if the representation is a single pointer.
func isdirectiface(t *types.Type) bool { func isdirectiface(t *types.Type) bool {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment