1
0

Fix RESTORE...?

This commit is contained in:
otya128
2016-12-06 18:47:02 +09:00
parent b2b9779eea
commit 55fc5c169b
2 changed files with 25 additions and 1 deletions

View File

@@ -1665,6 +1665,22 @@ class RestoreCode : Code
return "restore " ~ label.to!string;
}
}
class RestoreUndefinedLabelCode : Code
{
wstring label;
this(wstring label)
{
this.label = label;
}
override void execute(VM vm)
{
throw new UndefinedLabel();
}
override string toString(VM vm)
{
return "restoreundeflabel " ~ label.to!string;
}
}
class RestoreExprCode : Code
{
DataTable datatable;

View File

@@ -1236,7 +1236,15 @@ class Compiler
if(c.type == CodeType.RestoreCodeS)
{
auto restore = cast(RestoreCodeS)c;
code[i] = new RestoreCode(s.data.label[restore.label], s.data);
auto label = s.data.label.get(restore.label, int.min);
if (label != int.min)
{
code[i] = new RestoreUndefinedLabelCode(restore.label);
}
else
{
code[i] = new RestoreCode(label, s.data);
}
}
}
genCode(new EndVM());