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

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

No files matched your search

+10 -10
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)