変数を使う時の捜索順を変更

This commit is contained in:
otya128 committed 2015-07-06 22:14:55 +09:00
1 parent c466670b5f
commit 3c14a80890
5 files changed
+51 -16

No files matched your search

+10 -10
View File
@@ -154,31 +154,31 @@ class Compiler
void genCodePushVar(wstring name, Scope sc)
{
auto global = hasGlobalVarIndex(name);
if(global)
{
code ~= new PushG(global);
return;
}
if(sc.func)
{
code ~= new PushL(sc.func.getLocalVarIndex(name, this));
return;
}
if(global)
{
code ~= new PushG(global);
return;
}
code ~= new PushG(getGlobalVarIndex(name));
}
void genCodePopVar(wstring name, Scope sc)
{
auto global = hasGlobalVarIndex(name);
if(global)
{
code ~= new PopG(global);
return;
}
if(sc.func)
{
code ~= new PopL(sc.func.getLocalVarIndex(name, this));
return;
}
if(global)
{
code ~= new PopG(global);
return;
}
code ~= new PopG(getGlobalVarIndex(name));
}
void genCodeOP(TokenType op)