compiler: record basic debug info

Save info about method's byte-code sections.
This commit is contained in:
Evgenii Stratonikov 2020-03-31 15:56:10 +03:00
parent b2c767e356
commit 00c40b58aa
4 changed files with 291 additions and 0 deletions

View file

@ -211,6 +211,7 @@ func (c *codegen) convertFuncDecl(file ast.Node, decl *ast.FuncDecl) {
f = c.newFunc(decl)
}
f.rng.Start = uint16(c.prog.Len())
c.scope = f
ast.Inspect(decl, c.scope.analyzeVoidCalls) // @OPTIMIZE
@ -260,6 +261,8 @@ func (c *codegen) convertFuncDecl(file ast.Node, decl *ast.FuncDecl) {
emit.Opcode(c.prog.BinWriter, opcode.DROP)
emit.Opcode(c.prog.BinWriter, opcode.RET)
}
f.rng.End = uint16(c.prog.Len() - 1)
}
func (c *codegen) Visit(node ast.Node) ast.Visitor {