Implement CHKLABEL(label,global)
This commit is contained in:
@@ -438,7 +438,7 @@ class VM
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool chklabel(wstring label)
|
bool chklabel(wstring label, bool global)
|
||||||
{
|
{
|
||||||
auto name = parse(label);
|
auto name = parse(label);
|
||||||
VMSlot slot;
|
VMSlot slot;
|
||||||
@@ -454,10 +454,15 @@ class VM
|
|||||||
{
|
{
|
||||||
slot = currentSlot;
|
slot = currentSlot;
|
||||||
}
|
}
|
||||||
|
if (currentFunction)
|
||||||
|
{
|
||||||
|
if (name.name in currentFunction.label)
|
||||||
|
return true;
|
||||||
|
if (!global)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (name.name in slot.globalLabel)
|
if (name.name in slot.globalLabel)
|
||||||
return true;
|
return true;
|
||||||
if (currentFunction && name.name in currentFunction.label)
|
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool chkvar(wstring var)
|
bool chkvar(wstring var)
|
||||||
|
|||||||
@@ -3079,10 +3079,11 @@ class BuiltinFunction
|
|||||||
func = func.toUpper;
|
func = func.toUpper;
|
||||||
return p.vm.chkcall(func);
|
return p.vm.chkcall(func);
|
||||||
}
|
}
|
||||||
static int CHKLABEL(PetitComputer p, wstring label)
|
static int CHKLABEL(PetitComputer p, wstring label, DefaultValue!(int, false) global)
|
||||||
{
|
{
|
||||||
label = label.toUpper;
|
label = label.toUpper;
|
||||||
return p.vm.chklabel(label);
|
global.setDefaultValue(0);
|
||||||
|
return p.vm.chklabel(label, cast(bool)global);
|
||||||
}
|
}
|
||||||
static int CHKVAR(PetitComputer p, wstring var)
|
static int CHKVAR(PetitComputer p, wstring var)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user