From 2c970f6dea383c20eed2de05b9ed7cd45544b56e Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 24 Dec 2016 19:40:24 +0900 Subject: [PATCH] Fix GotoExpr to use VM.currentFunction --- SMILEBASIC/VM.d | 8 +++----- SMILEBASIC/compiler.d | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/SMILEBASIC/VM.d b/SMILEBASIC/VM.d index b9f4e1c..6ead2bb 100644 --- a/SMILEBASIC/VM.d +++ b/SMILEBASIC/VM.d @@ -927,10 +927,8 @@ class GotoFalse : Code } class GotoExpr : Code { - Scope sc; - this(Scope sc) + this() { - this.sc = sc; } override void execute(VM vm) { @@ -939,9 +937,9 @@ class GotoExpr : Code if(label.isString) { int pc; - if (sc && sc.func) + if (vm.currentFunction) { - pc = sc.func.label.get(label.castDString, int.min); + pc = vm.currentFunction.label.get(label.castDString, int.min); } else { diff --git a/SMILEBASIC/compiler.d b/SMILEBASIC/compiler.d index 0465ac0..5cbb315 100644 --- a/SMILEBASIC/compiler.d +++ b/SMILEBASIC/compiler.d @@ -1007,7 +1007,7 @@ class Compiler if(!gotou.label) { compileExpression(gotou.labelexpr, s); - genCode(new GotoExpr(s)); + genCode(new GotoExpr()); } else {