1
0

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

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

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)