check: run some phases once not once-per-file

This commit is contained in:
Nigel Tao committed 2023-11-04 16:36:04 +11:00
1 parent 190f249031
commit b20c177a08
1 file changed
+7 -6
+7 -6
View File
@@ -166,13 +166,14 @@ func Check(tm *t.Map, files []*a.File, resolveUse func(usePath string) ([]byte,
}
for _, phase := range phases {
for _, f := range files {
if phase.kind == a.KInvalid {
if err := phase.check(c, nil); err != nil {
return nil, err
}
continue
if phase.kind == a.KInvalid {
if err := phase.check(c, nil); err != nil {
return nil, err
}
continue
}
for _, f := range files {
for _, n := range f.TopLevelDecls() {
if n.Kind() != phase.kind {
continue