aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iimport.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-27 11:26:12 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-28 08:09:20 +0000
commit76136be02701aab8a4b546956f1847d28dbe0ba2 (patch)
treef7512a1cfa1e337740388ba82095c807ef539f5e /src/cmd/compile/internal/typecheck/iimport.go
parentfda7ec3a3f03f95854d33e344b41d52e017e88e0 (diff)
downloadgo-76136be02701aab8a4b546956f1847d28dbe0ba2.tar.gz
go-76136be02701aab8a4b546956f1847d28dbe0ba2.zip
[dev.regabi] cmd/compile: check for recursive import in ImportBody
After earlier importer refactorings, most of the importer is now reentrant, so we don't need to guard against it at Resolve. The only remaining part that is still not reentrant is inline body importing, so move the recursive-import check there. Passes toolstash -cmp. Change-Id: Ia828f880a03e6125b102668c12a155d4c253d26b Reviewed-on: https://go-review.googlesource.com/c/go/+/280515 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index cf2cf87492..546ddcba79 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -71,7 +71,12 @@ func ImportBody(fn *ir.Func) {
base.Fatalf("missing import reader for %v", fn)
}
+ if inimport {
+ base.Fatalf("recursive inimport")
+ }
+ inimport = true
r.doInline(fn)
+ inimport = false
}
func importReaderFor(sym *types.Sym, importers map[*types.Sym]iimporterAndOffset) *importReader {