aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2023-08-11 18:21:22 -0700
committerGopher Robot <gobot@golang.org>2023-08-15 20:43:50 +0000
commit3be2176d92ad318b9085980b0b7f09f30541afb3 (patch)
tree644a1d7dca7398cae3a039c0526d0b35773d0059 /src/cmd/compile/internal/noder
parente95ca9154a6d326248357e87caa4e24368bcb68b (diff)
downloadgo-3be2176d92ad318b9085980b0b7f09f30541afb3.tar.xz
cmd/compile: improve ir.StaticValue and extract ir.StaticCalleeName
This CL extends ir.StaticValue to also work on closure variables. Also, it extracts the code from escape analysis that's responsible for determining the static callee of a function. This will be useful when go/defer statement normalization is moved to typecheck. Change-Id: I69e1f7fb185658dc9fbfdc69d0f511c84df1d3ac Reviewed-on: https://go-review.googlesource.com/c/go/+/518959 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder')
-rw-r--r--src/cmd/compile/internal/noder/reader.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go
index 9448f234b7..42794da042 100644
--- a/src/cmd/compile/internal/noder/reader.go
+++ b/src/cmd/compile/internal/noder/reader.go
@@ -3483,6 +3483,11 @@ func unifiedInlineCall(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.Inlined
r.closureVars = make([]*ir.Name, len(r.inlFunc.ClosureVars))
for i, cv := range r.inlFunc.ClosureVars {
+ // TODO(mdempsky): It should be possible to support this case, but
+ // for now we rely on the inliner avoiding it.
+ if cv.Outer.Curfn != callerfn {
+ base.FatalfAt(call.Pos(), "inlining closure call across frames")
+ }
r.closureVars[i] = cv.Outer
}
if len(r.closureVars) != 0 && r.hasTypeParams() {