From f5d59d0e382dc59195537a128fe9423a49a4cea8 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 16 Sep 2020 15:41:47 -0700 Subject: [PATCH] cmd/compile: skip looking for OCLOSURE nodes in xtop 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 Run-TryBot: Matthew Dempsky Reviewed-by: Cuong Manh Le TryBot-Result: Go Bot --- src/cmd/compile/internal/gc/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 8783cb4e46..7ad3bfe0c8 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -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() -- 2.50.0