compiler: make sequence points on global var/const declarations

This commit is contained in:
Evgenii Stratonikov 2020-08-10 17:43:26 +03:00
parent 128626de5c
commit 553e57c2c4

View file

@ -400,6 +400,9 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
// x = 2 // x = 2
// ) // )
case *ast.GenDecl: case *ast.GenDecl:
if n.Tok == token.VAR || n.Tok == token.CONST {
c.saveSequencePoint(n)
}
if n.Tok == token.CONST { if n.Tok == token.CONST {
for _, spec := range n.Specs { for _, spec := range n.Specs {
vs := spec.(*ast.ValueSpec) vs := spec.(*ast.ValueSpec)