mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: revert "typecheck types and funcs before consts"
This reverts commit 9ce87a63b9.
The fix addresses the specific test case, but not the general
problem.
Updates #24755.
Change-Id: I0ba8463b41b099b1ebf49759f88a423b40f70d58
Reviewed-on: https://go-review.googlesource.com/c/145617
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
8fc99d20f3
commit
70dd90c4a9
2 changed files with 4 additions and 33 deletions
|
|
@ -480,7 +480,7 @@ func Main(archInit func(*Arch)) {
|
|||
|
||||
// Process top-level declarations in phases.
|
||||
|
||||
// Phase 1: type, and names and types of funcs.
|
||||
// Phase 1: const, type, and names and types of funcs.
|
||||
// This will gather all the information about types
|
||||
// and methods but doesn't depend on any of it.
|
||||
defercheckwidth()
|
||||
|
|
@ -489,29 +489,16 @@ func Main(archInit func(*Arch)) {
|
|||
timings.Start("fe", "typecheck", "top1")
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
n := xtop[i]
|
||||
if op := n.Op; op != ODCL && op != OAS && op != OAS2 && op != ODCLCONST {
|
||||
if op := n.Op; op != ODCL && op != OAS && op != OAS2 {
|
||||
xtop[i] = typecheck(n, Etop)
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: Constant declarations.
|
||||
// To have named types fully type checked, depends on phase 1.
|
||||
// Phase 2: Variable assignments.
|
||||
// To check interface assignments, depends on phase 1.
|
||||
|
||||
// Don't use range--typecheck can add closures to xtop.
|
||||
timings.Start("fe", "typecheck", "top2")
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
n := xtop[i]
|
||||
if op := n.Op; op == ODCLCONST {
|
||||
xtop[i] = typecheck(n, Etop)
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 3: Variable assignments.
|
||||
// To check interface assignments, depends on phase 1.
|
||||
// To use constants, depends on phase 2.
|
||||
|
||||
// Don't use range--typecheck can add closures to xtop.
|
||||
timings.Start("fe", "typecheck", "top3")
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
n := xtop[i]
|
||||
if op := n.Op; op == ODCL || op == OAS || op == OAS2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue