]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: skip looking for OCLOSURE nodes in xtop
authorMatthew Dempsky <mdempsky@google.com>
Wed, 16 Sep 2020 22:41:47 +0000 (15:41 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 16 Sep 2020 23:00:02 +0000 (23:00 +0000)
xtop holds package's top-level declaration statements, but OCLOSURE
only appears in expression contexts. xtop will instead hold the
synthetic ODCLFUNC representing OCLOSURE's function body.

This CL makes the loop consistent with the later phases that only look
for ODCLFUNC nodes in xtop.

Passes toolstash-check.

Change-Id: I852a10ef1bf75bb3351e3da0357ca8b2e26aec6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/255340
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/compile/internal/gc/main.go

index 8783cb4e4636a1ede30f6be1ae6508dbbbbbafe8..7ad3bfe0c8bfe6234c29df287ee75002ddd648d6 100644 (file)
@@ -617,7 +617,7 @@ func Main(archInit func(*Arch)) {
        var fcount int64
        for i := 0; i < len(xtop); i++ {
                n := xtop[i]
-               if op := n.Op; op == ODCLFUNC || op == OCLOSURE {
+               if n.Op == ODCLFUNC {
                        Curfn = n
                        decldepth = 1
                        saveerrors()