diff --git a/ssc/ast/nodes.variables.cs b/ssc/ast/nodes.variables.cs index d464db4..8dee9f0 100644 --- a/ssc/ast/nodes.variables.cs +++ b/ssc/ast/nodes.variables.cs @@ -39,7 +39,6 @@ public override void Compile(sunContext context) { var variableInfo = context.DeclareVariable(Variable); - context.Text.DeclareLocal(1); } } @@ -54,7 +53,6 @@ public override void Compile(sunContext context) { var variableInfo = context.DeclareVariable(Variable); - context.Text.DeclareLocal(1); base.Compile(context); } } diff --git a/ssc/symbol table.cs b/ssc/symbol table.cs index ec870c8..5ebf2a5 100644 --- a/ssc/symbol table.cs +++ b/ssc/symbol table.cs @@ -135,6 +135,7 @@ namespace arookas context.DeclareParameter(parameter); } context.Text.StoreDisplay(1); + context.Text.DeclareLocal(CalculateMaxLocalCount(Body)); Body.Compile(context); context.Text.ReturnVoid(); context.Scopes.Pop();