compiler: emit debug variable info for init()

This commit is contained in:
Evgeniy Stratonikov 2021-05-12 15:08:22 +03:00
parent 7afca7f8e5
commit b72f6be9e9
3 changed files with 18 additions and 1 deletions

View file

@ -46,6 +46,8 @@ type codegen struct {
globals map[string]int
// staticVariables contains global (static in NDX-DN11) variable names and types.
staticVariables []string
// initVariables contains variables local to `_initialize` method.
initVariables []string
// A mapping from label's names to their ids.
labels map[labelWithType]uint16
@ -460,6 +462,10 @@ func (c *codegen) convertFuncDecl(file ast.Node, decl *ast.FuncDecl, pkg *types.
emit.Opcodes(c.prog.BinWriter, opcode.RET)
}
if isInit {
c.initVariables = append(c.initVariables, f.variables...)
}
f.rng.End = uint16(c.prog.Len() - 1)
if !isLambda {