Fix local restore
This commit is contained in:
@@ -1777,9 +1777,11 @@ class ReadCode : Code
|
|||||||
class RestoreCodeS : Code
|
class RestoreCodeS : Code
|
||||||
{
|
{
|
||||||
wstring label;
|
wstring label;
|
||||||
this(wstring label)
|
Scope scope_;
|
||||||
|
this(wstring label, Scope s)
|
||||||
{
|
{
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
scope_ = s;
|
||||||
this.type = CodeType.RestoreCodeS;
|
this.type = CodeType.RestoreCodeS;
|
||||||
}
|
}
|
||||||
override void execute(VM vm)
|
override void execute(VM vm)
|
||||||
|
|||||||
@@ -1170,7 +1170,7 @@ class Compiler
|
|||||||
Constant cons = cast(Constant)label;
|
Constant cons = cast(Constant)label;
|
||||||
if(cons.value.isString)
|
if(cons.value.isString)
|
||||||
{
|
{
|
||||||
genCode(new RestoreCodeS(cons.value.stringValue));
|
genCode(new RestoreCodeS(cons.value.stringValue, s));
|
||||||
break;
|
break;
|
||||||
//文字列じゃないならば定数でも実行時エラー
|
//文字列じゃないならば定数でも実行時エラー
|
||||||
}
|
}
|
||||||
@@ -1302,7 +1302,7 @@ class Compiler
|
|||||||
if(c.type == CodeType.RestoreCodeS)
|
if(c.type == CodeType.RestoreCodeS)
|
||||||
{
|
{
|
||||||
auto restore = cast(RestoreCodeS)c;
|
auto restore = cast(RestoreCodeS)c;
|
||||||
auto label = s.data.label.get(restore.label, int.min);
|
auto label = restore.scope_.data.label.get(restore.label, int.min);
|
||||||
if (label == int.min)
|
if (label == int.min)
|
||||||
{
|
{
|
||||||
code[i] = new RestoreUndefinedLabelCode(restore.label);
|
code[i] = new RestoreUndefinedLabelCode(restore.label);
|
||||||
|
|||||||
Reference in New Issue
Block a user