Add Undefined Label Error
This commit is contained in:
@@ -1167,11 +1167,21 @@ class Compiler
|
|||||||
auto label = cast(GotoS)c;
|
auto label = cast(GotoS)c;
|
||||||
if(label.sc.func)
|
if(label.sc.func)
|
||||||
{
|
{
|
||||||
code[i] = new GotoAddr(label.sc.func.label[label.label]);
|
int addr = label.sc.func.label.get(label.label, int.min);
|
||||||
|
if (addr == int.min)
|
||||||
|
{
|
||||||
|
throw new UndefinedLabel(label.label);
|
||||||
|
}
|
||||||
|
code[i] = new GotoAddr(addr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
code[i] = new GotoAddr(globalLabel[label.label]);
|
int addr = globalLabel.get(label.label, int.min);
|
||||||
|
if (addr == int.min)
|
||||||
|
{
|
||||||
|
throw new UndefinedLabel(label.label);
|
||||||
|
}
|
||||||
|
code[i] = new GotoAddr(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(c.type == CodeType.GosubS)
|
if(c.type == CodeType.GosubS)
|
||||||
|
|||||||
@@ -96,6 +96,18 @@ class OutOfDATA : SmileBasicError
|
|||||||
super("Out of DATA");
|
super("Out of DATA");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class UndefinedLabel : SmileBasicError
|
||||||
|
{
|
||||||
|
this()
|
||||||
|
{
|
||||||
|
this.errnum = 14;
|
||||||
|
super("Undefined label");
|
||||||
|
}
|
||||||
|
this(wstring label)
|
||||||
|
{
|
||||||
|
this();
|
||||||
|
}
|
||||||
|
}
|
||||||
class UndefinedVariable : SmileBasicError
|
class UndefinedVariable : SmileBasicError
|
||||||
{
|
{
|
||||||
this()
|
this()
|
||||||
|
|||||||
Reference in New Issue
Block a user