compiler: emit all used files in DebugInfo.Documents

This commit is contained in:
Evgenii Stratonikov 2020-08-10 13:10:35 +03:00
parent 057e1c6e3c
commit 40fa7c0f6e
5 changed files with 25 additions and 10 deletions

View file

@ -94,6 +94,7 @@ func (c *codegen) saveSequencePoint(n ast.Node) {
end := fset.Position(n.End())
c.sequencePoints[c.scope.name] = append(c.sequencePoints[c.scope.name], DebugSeqPoint{
Opcode: c.prog.Len(),
Document: c.docIndex[start.Filename],
StartLine: start.Line,
StartCol: start.Offset,
EndLine: end.Line,
@ -103,9 +104,10 @@ func (c *codegen) saveSequencePoint(n ast.Node) {
func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
d := &DebugInfo{
MainPkg: c.mainPkg.Pkg.Name(),
Hash: hash.Hash160(contract),
Events: []EventDebugInfo{},
MainPkg: c.mainPkg.Pkg.Name(),
Hash: hash.Hash160(contract),
Events: []EventDebugInfo{},
Documents: c.documents,
}
if c.initEndOffset > 0 {
d.Methods = append(d.Methods, MethodDebugInfo{