compiler: count locals number properly

This commit is contained in:
Evgeniy Stratonikov 2021-02-05 17:26:48 +03:00
parent 57a0377c81
commit 339187a56d
3 changed files with 57 additions and 21 deletions

View file

@ -55,14 +55,14 @@ func (c *codegen) traverseGlobals() (int, int, int) {
switch n := node.(type) {
case *ast.FuncDecl:
if isInitFunc(n) {
c, _ := countLocals(n)
if c > initLocals {
initLocals = c
num, _ := c.countLocals(n)
if num > initLocals {
initLocals = num
}
} else if isDeployFunc(n) {
c, _ := countLocals(n)
if c > deployLocals {
deployLocals = c
num, _ := c.countLocals(n)
if num > deployLocals {
deployLocals = num
}
}
return !hasDefer