diff --git a/pkg/compiler/debug.go b/pkg/compiler/debug.go index 7b297298d..5aad14726 100644 --- a/pkg/compiler/debug.go +++ b/pkg/compiler/debug.go @@ -85,14 +85,15 @@ type DebugParam struct { } func (c *codegen) saveSequencePoint(n ast.Node) { - if c.scope == nil { - // do not save globals for now - return + name := "init" + if c.scope != nil { + name = c.scope.name } + fset := c.buildInfo.program.Fset start := fset.Position(n.Pos()) end := fset.Position(n.End()) - c.sequencePoints[c.scope.name] = append(c.sequencePoints[c.scope.name], DebugSeqPoint{ + c.sequencePoints[name] = append(c.sequencePoints[name], DebugSeqPoint{ Opcode: c.prog.Len(), Document: c.docIndex[start.Filename], StartLine: start.Line, @@ -122,6 +123,7 @@ func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo { End: uint16(c.initEndOffset), }, ReturnType: "Void", + SeqPoints: c.sequencePoints["init"], }) } for name, scope := range c.funcs {