1
0

Add Undefined Label Error

This commit is contained in:
otya128
2016-12-04 16:30:31 +09:00
parent 46fb83483b
commit bd352d81f3
2 changed files with 24 additions and 2 deletions

View File

@@ -1167,11 +1167,21 @@ class Compiler
auto label = cast(GotoS)c;
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
{
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)