Moved mkfr compilation to before the function body.

This commit is contained in:
arookas 2015-12-18 19:52:23 -05:00
parent 7c7ab8790e
commit d804f7dd66
2 changed files with 1 additions and 2 deletions

View file

@ -39,7 +39,6 @@
public override void Compile(sunContext context) public override void Compile(sunContext context)
{ {
var variableInfo = context.DeclareVariable(Variable); var variableInfo = context.DeclareVariable(Variable);
context.Text.DeclareLocal(1);
} }
} }
@ -54,7 +53,6 @@
public override void Compile(sunContext context) public override void Compile(sunContext context)
{ {
var variableInfo = context.DeclareVariable(Variable); var variableInfo = context.DeclareVariable(Variable);
context.Text.DeclareLocal(1);
base.Compile(context); base.Compile(context);
} }
} }

View file

@ -135,6 +135,7 @@ namespace arookas
context.DeclareParameter(parameter); context.DeclareParameter(parameter);
} }
context.Text.StoreDisplay(1); context.Text.StoreDisplay(1);
context.Text.DeclareLocal(CalculateMaxLocalCount(Body));
Body.Compile(context); Body.Compile(context);
context.Text.ReturnVoid(); context.Text.ReturnVoid();
context.Scopes.Pop(); context.Scopes.Pop();