Add GosubUndefinedLabel
This commit is contained in:
@@ -2387,3 +2387,15 @@ class Use : Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GosubUndefinedLabel : Code
|
||||||
|
{
|
||||||
|
wstring label;
|
||||||
|
this(wstring label)
|
||||||
|
{
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
override void execute(VM vm)
|
||||||
|
{
|
||||||
|
throw new UndefinedLabel(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1259,13 +1259,22 @@ class Compiler
|
|||||||
if(c.type == CodeType.GosubS)
|
if(c.type == CodeType.GosubS)
|
||||||
{
|
{
|
||||||
auto label = cast(GosubS)c;
|
auto label = cast(GosubS)c;
|
||||||
|
int addr;
|
||||||
if(label.sc.func)
|
if(label.sc.func)
|
||||||
{
|
{
|
||||||
code[i] = new GosubAddr(label.sc.func.label[label.label]);
|
addr = label.sc.func.label.get(label.label, int.min);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
code[i] = new GosubAddr(globalLabel[label.label]);
|
addr = globalLabel.get(label.label, int.min);
|
||||||
|
}
|
||||||
|
if (addr == int.min)
|
||||||
|
{
|
||||||
|
code[i] = new GosubUndefinedLabel(label.label);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
code[i] = new GosubAddr(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(c.type == CodeType.OnS)
|
if(c.type == CodeType.OnS)
|
||||||
@@ -1276,7 +1285,7 @@ class Compiler
|
|||||||
{
|
{
|
||||||
if(label.sc.func)
|
if(label.sc.func)
|
||||||
{
|
{
|
||||||
addresses[index] =label.sc.func.label.get(l, int.min);
|
addresses[index] = label.sc.func.label.get(l, int.min);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user