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) {
|
func (c *codegen) saveSequencePoint(n ast.Node) {
|
||||||
if c.scope == nil {
|
name := "init"
|
||||||
// do not save globals for now
|
if c.scope != nil {
|
||||||
return
|
name = c.scope.name
|
||||||
}
|
}
|
||||||
|
|
||||||
fset := c.buildInfo.program.Fset
|
fset := c.buildInfo.program.Fset
|
||||||
start := fset.Position(n.Pos())
|
start := fset.Position(n.Pos())
|
||||||
end := fset.Position(n.End())
|
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(),
|
Opcode: c.prog.Len(),
|
||||||
Document: c.docIndex[start.Filename],
|
Document: c.docIndex[start.Filename],
|
||||||
StartLine: start.Line,
|
StartLine: start.Line,
|
||||||
|
@ -122,6 +123,7 @@ func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
|
||||||
End: uint16(c.initEndOffset),
|
End: uint16(c.initEndOffset),
|
||||||
},
|
},
|
||||||
ReturnType: "Void",
|
ReturnType: "Void",
|
||||||
|
SeqPoints: c.sequencePoints["init"],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for name, scope := range c.funcs {
|
for name, scope := range c.funcs {
|
||||||
|
|
Loading…
Reference in a new issue