compiler: save sequence points for init
function
This commit is contained in:
parent
40fa7c0f6e
commit
128626de5c
1 changed files with 6 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue