変数を使う時の捜索順を変更
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user