mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-28 01:29:44 +00:00
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 ...
This commit is contained in:
parent
152832fd4e
commit
5fefeac7b6
@ -34,7 +34,7 @@ public class Procedure extends Scope {
|
|||||||
/** Reserved zeropage addresses. */
|
/** Reserved zeropage addresses. */
|
||||||
private List<Integer> reservedZps;
|
private List<Integer> reservedZps;
|
||||||
/** The code segment to put the procedure into. */
|
/** 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. */
|
/** The list of constructor procedures for this procedure. The constructor procedures are called during program initialization. */
|
||||||
private final List<ProcedureRef> constructorRefs;
|
private final List<ProcedureRef> constructorRefs;
|
||||||
/** Is this procedure declared as a constructor procedure. */
|
/** Is this procedure declared as a constructor procedure. */
|
||||||
@ -117,6 +117,10 @@ public class Procedure extends Scope {
|
|||||||
return codeSegment;
|
return codeSegment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCodeSegment(String codeSegment) {
|
||||||
|
this.codeSegment = codeSegment;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getParameterNames() {
|
public List<String> getParameterNames() {
|
||||||
return parameterNames;
|
return parameterNames;
|
||||||
}
|
}
|
||||||
|
@ -548,6 +548,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
|
|||||||
parameterList.add(paramVar);
|
parameterList.add(paramVar);
|
||||||
}
|
}
|
||||||
procedure.setParameters(parameterList);
|
procedure.setParameters(parameterList);
|
||||||
|
procedure.setCodeSegment(currentCodeSegment); // When a procedure is defined, the currentCodeSegment is to be set.
|
||||||
// Add return variable
|
// Add return variable
|
||||||
if(!SymbolType.VOID.equals(procedure.getReturnType())) {
|
if(!SymbolType.VOID.equals(procedure.getReturnType())) {
|
||||||
final VariableBuilder builder = new VariableBuilder("return", procedure, false, false, procedure.getReturnType(), varDecl.getDeclDirectives(), currentDataSegment, program.getTargetPlatform().getVariableBuilderConfig());
|
final VariableBuilder builder = new VariableBuilder("return", procedure, false, false, procedure.getReturnType(), varDecl.getDeclDirectives(), currentDataSegment, program.getTargetPlatform().getVariableBuilderConfig());
|
||||||
|
Loading…
Reference in New Issue
Block a user