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 692e7f96a..805daac86 100644 --- a/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java +++ b/src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java @@ -136,6 +136,10 @@ public class Procedure extends Scope { this.segmentCode = segmentCode; } + public void setCodeSegment(String codeSegment) { + this.codeSegment = codeSegment; + } + public List getParameterNames() { return parameterNames; } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index 73adc21e5..07fa70e5f 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -865,7 +865,14 @@ public class Pass4CodeGeneration { if (assignment.getOperator() == null && assignment.getrValue1() == null && isRegisterCopy(lValue, assignment.getrValue2())) { //asm.addComment(lValue.toString(program) + " = " + assignment.getrValue2().toString(program) + " // register copy " + getRegister(lValue)); } else { - AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.assignment(assignment, program), program); + // sven - catch this error decently, it sometimes throws an exception! + try { + AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.assignment(assignment, program), program); + } catch( AsmFragmentTemplateSynthesizer.UnknownFragmentException e) { + throw new AsmFragmentTemplateSynthesizer.UnknownFragmentException(e.getMessage()); + } catch( RuntimeException e) { + throw new CompileError("Problem with source, runtime Exception: " + e.getMessage(), statement); + } } } else if (statement instanceof StatementConditionalJump) { AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.conditionalJump((StatementConditionalJump) statement, block, program), program);