Implement CHKVAR
This commit is contained in:
@@ -319,6 +319,22 @@ class VM
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool chklabel(wstring label)
|
||||
{
|
||||
if (label in currentSlot.globalLabel)
|
||||
return true;
|
||||
if (currentFunction && label in currentFunction.label)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool chkvar(wstring var)
|
||||
{
|
||||
if (var in currentSlot.globalTable)
|
||||
return true;
|
||||
if (currentFunction && var in currentFunction.variable)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
enum CodeType
|
||||
{
|
||||
|
||||
@@ -2382,7 +2382,12 @@ class BuiltinFunction
|
||||
static int CHKLABEL(PetitComputer p, wstring label)
|
||||
{
|
||||
label = label.toUpper;
|
||||
return (label in p.vm.currentSlot.globalLabel) != null;
|
||||
return p.vm.chklabel(label);
|
||||
}
|
||||
static int CHKVAR(PetitComputer p, wstring var)
|
||||
{
|
||||
var = var.toUpper;
|
||||
return p.vm.chkvar(var);
|
||||
}
|
||||
static wstring INKEY(PetitComputer p)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user