diff --git a/src/cmd/compile/internal/gc/parser.go b/src/cmd/compile/internal/gc/parser.go index 3d5e0b6d181..6a5bb66542a 100644 --- a/src/cmd/compile/internal/gc/parser.go +++ b/src/cmd/compile/internal/gc/parser.go @@ -2087,10 +2087,6 @@ func (p *parser) xdcl_list() (l []*Node) { continue } - if nsyntaxerrors == 0 { - testdclstack() - } - // Reset p.pragma BEFORE advancing to the next token (consuming ';') // since comments before may set pragmas for the next function decl. p.pragma = 0 @@ -2100,6 +2096,10 @@ func (p *parser) xdcl_list() (l []*Node) { p.advance(LVAR, LCONST, LTYPE, LFUNC) } } + + if nsyntaxerrors == 0 { + testdclstack() + } return }