compiler: count auxiliary locals introduced by inlining
During initialization of globals no function scope is present thus locals number is not saved anywere. Save it in `codegen` directly.
This commit is contained in:
parent
87a69b13f1
commit
60a3e0d778
4 changed files with 13 additions and 3 deletions
|
@ -32,7 +32,12 @@ func (c *codegen) inlineCall(f *funcScope, n *ast.CallExpr) {
|
|||
if c.scope == nil {
|
||||
c.scope = &funcScope{}
|
||||
c.scope.vars.newScope()
|
||||
defer func() { c.scope = nil }()
|
||||
defer func() {
|
||||
if cnt := c.scope.vars.localsCnt; cnt > c.globalInlineCount {
|
||||
c.globalInlineCount = cnt
|
||||
}
|
||||
c.scope = nil
|
||||
}()
|
||||
}
|
||||
|
||||
// Arguments need to be walked with the current scope,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue