]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile: fix TestUnifiedCompare
authorMatthew Dempsky <mdempsky@google.com>
Fri, 25 Jun 2021 08:49:26 +0000 (01:49 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 25 Jun 2021 09:33:03 +0000 (09:33 +0000)
We need to start the capture walk from expr.Body, not expr, otherwise
in quirks mode we'll set all of the captured variables' positions to
expr.Body.Rbrace.

Change-Id: Ic93f2773ae3756c2ec88dac17b4e9fb5a0771734
Reviewed-on: https://go-review.googlesource.com/c/go/+/330889
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>
src/cmd/compile/internal/noder/writer.go

index cc44a80a42e07836ffda9d85a25381110f5409bc..8765f8536235d557e0a8cb4dbc357556f6610e44 100644 (file)
@@ -1281,7 +1281,7 @@ func (w *writer) captureVars(expr *syntax.FuncLit) (closureVars []posObj, locals
                localsIdx: make(map[types2.Object]int),
        }
 
-       syntax.Walk(expr, &v)
+       syntax.Walk(expr.Body, &v)
 
        return v.closureVars, v.localsIdx
 }