From 3ab2e7c547aa213776f7847c84db1d27ab71a202 Mon Sep 17 00:00:00 2001 From: Csaba Fekete Date: Wed, 28 Oct 2020 20:46:21 +0100 Subject: [PATCH] Fixed bug in recursive proc calls --- VERSION | 2 +- source/app.d | 2 +- source/statement/call_stmt.d | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index e02d50b..ae46350 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.3.05 \ No newline at end of file +v2.3.06 \ No newline at end of file diff --git a/source/app.d b/source/app.d index 7da0bc8..8942ff3 100644 --- a/source/app.d +++ b/source/app.d @@ -27,7 +27,7 @@ string listfile=""; * Version */ -string compiler_version = "v2.3.05"; +string compiler_version = "v2.3.06"; /** * Application entry point diff --git a/source/statement/call_stmt.d b/source/statement/call_stmt.d index 055852c..a433656 100644 --- a/source/statement/call_stmt.d +++ b/source/statement/call_stmt.d @@ -25,6 +25,13 @@ class Call_stmt:Stmt } this.program.error(error); } + + bool recursive = false; + if(lbl == this.program.current_proc_name) { + recursive = true; + this.program.appendProgramSegment(this.program.push_locals()); + } + Procedure proc = this.program.findProcedure(lbl); if(this.node.children[0].children.length > 1) { ParseTree exprlist = this.node.children[0].children[1]; @@ -45,12 +52,6 @@ class Call_stmt:Stmt } } - bool recursive = false; - if(lbl == this.program.current_proc_name) { - recursive = true; - this.program.appendProgramSegment(this.program.push_locals()); - } - this.program.appendProgramSegment("\tjsr " ~ proc.getLabel() ~ "\n"); if(recursive) {