compiler: calculate local variables properly

In case when right-hand side of an assignment is a function,
left-hand side should be used.
This commit is contained in:
Evgenii Stratonikov 2020-08-20 15:35:02 +03:00
parent 84c36326f5
commit b18a7f200c
2 changed files with 13 additions and 1 deletions

View file

@ -124,7 +124,7 @@ func (c *funcScope) countLocals() int {
}
case *ast.AssignStmt:
if n.Tok == token.DEFINE {
size += len(n.Rhs)
size += len(n.Lhs)
}
case *ast.ReturnStmt, *ast.IfStmt:
size++