mirror of
https://github.com/golang/go
synced 2024-11-11 23:50:22 -07:00
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: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
6c8100270c
commit
011ea87921
@ -46,9 +46,7 @@ func expandDecl(n *Node) {
|
||||
return
|
||||
}
|
||||
|
||||
inimport = true
|
||||
r.doDecl(n)
|
||||
inimport = false
|
||||
}
|
||||
|
||||
func expandInline(fn *Node) {
|
||||
|
@ -37,7 +37,12 @@ func resolve(n *Node) *Node {
|
||||
}
|
||||
|
||||
if n.Sym.Pkg != localpkg {
|
||||
if inimport {
|
||||
Fatalf("recursive inimport")
|
||||
}
|
||||
inimport = true
|
||||
expandDecl(n)
|
||||
inimport = false
|
||||
return n
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user