1
0

SPANIMをループや非線形補完に対応,関数内でグローバル変数が使えなかったバグを修正

This commit is contained in:
otya128
2015-08-23 10:53:58 +09:00
parent 5ce3342dde
commit 5852e38cdb
3 changed files with 141 additions and 53 deletions

View File

@@ -200,11 +200,6 @@ class Compiler
void genCodePushVar(wstring name, Scope sc)
{
auto global = hasGlobalVarIndex(name);
if(sc.func)
{
code ~= new PushL(sc.func.getLocalVarIndex(name, this));
return;
}
if(global)
{
if(global < 0)
@@ -215,16 +210,16 @@ class Compiler
code ~= new PushG(global);
return;
}
if(sc.func)
{
code ~= new PushL(sc.func.getLocalVarIndex(name, this));
return;
}
code ~= new PushG(getGlobalVarIndex(name));
}
void genCodePopVar(wstring name, Scope sc)
{
auto global = hasGlobalVarIndex(name);
if(sc.func)
{
code ~= new PopL(sc.func.getLocalVarIndex(name, this));
return;
}
if(global)
{
if(global < 0)
@@ -235,6 +230,11 @@ class Compiler
code ~= new PopG(global);
return;
}
if(sc.func)
{
code ~= new PopL(sc.func.getLocalVarIndex(name, this));
return;
}
code ~= new PopG(getGlobalVarIndex(name));
}
void getVarIndex(wstring name, Scope sc, out int index, out bool isLocal)