Commit 011ea879 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: fix recursive inimport handling

expandDecl can be called recursively, so it's not an appropriate place
to clean inimport. Instead, move this up to resolve, along with an
appropriate recursion check.

Passes toolstash-check.

Change-Id: I138d37b057dcc6525c780b4b3fbaa5e97f99655b
Reviewed-on: https://go-review.googlesource.com/120455
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 6c810027
...@@ -46,9 +46,7 @@ func expandDecl(n *Node) { ...@@ -46,9 +46,7 @@ func expandDecl(n *Node) {
return return
} }
inimport = true
r.doDecl(n) r.doDecl(n)
inimport = false
} }
func expandInline(fn *Node) { func expandInline(fn *Node) {
......
...@@ -37,7 +37,12 @@ func resolve(n *Node) *Node { ...@@ -37,7 +37,12 @@ func resolve(n *Node) *Node {
} }
if n.Sym.Pkg != localpkg { if n.Sym.Pkg != localpkg {
if inimport {
Fatalf("recursive inimport")
}
inimport = true
expandDecl(n) expandDecl(n)
inimport = false
return n return n
} }
......
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