From 5fefeac7b6974932e19648fb53261396ce79e35f Mon Sep 17 00:00:00 2001 From: Flight_Control Date: Mon, 21 Nov 2022 20:11:25 +0100 Subject: [PATCH] Fixes functions declared in header files not assigned the correct code segment. So the declarations of the functions receive also the currentCodeSegment, but only when the function is defined, the currentCodeSegment is to be assigned to the function (procedure!). During declaration of functions the code segment is likely Code ... --- .../java/dk/camelot64/kickc/model/symbols/Procedure.java | 6 +++++- .../kickc/passes/Pass0GenerateStatementSequence.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java b/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java index 71e1b667c..ce46bb5f1 100644 --- a/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java +++ b/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java @@ -34,7 +34,7 @@ public class Procedure extends Scope { /** Reserved zeropage addresses. */ private List reservedZps; /** The code segment to put the procedure into. */ - private final String codeSegment; + private String codeSegment; /** The list of constructor procedures for this procedure. The constructor procedures are called during program initialization. */ private final List constructorRefs; /** Is this procedure declared as a constructor procedure. */ @@ -117,6 +117,10 @@ public class Procedure extends Scope { return codeSegment; } + public void setCodeSegment(String codeSegment) { + this.codeSegment = codeSegment; + } + public List getParameterNames() { return parameterNames; } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java index 50a51154a..e7a343ac6 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java @@ -548,6 +548,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor