1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-08 17:54:40 +00:00

Fixed ClassCastException when attempting to removing a procedure with an empty start. Added a pointer conter increment test.

This commit is contained in:
jespergravgaard 2017-10-19 09:12:46 +02:00
parent 5a4388d6d3
commit b4abb9394e
4 changed files with 20 additions and 6 deletions

View File

@ -43,11 +43,14 @@ public class Pass1EliminateEmptyBlocks {
}
}
for (LabelRef labelRef : removeList) {
Symbol removeSymbol = program.getScope().getSymbol(labelRef);
if(removeSymbol instanceof Label) {
Label label = (Label) removeSymbol;
graph.remove(labelRef);
Label label = program.getScope().getLabel(labelRef);
label.getScope().remove(label);
log.append("Removing empty block "+labelRef);
}
}
return removeList.size()>0;
}

View File

@ -24,6 +24,10 @@ public class TestCompilationOutput extends TestCase {
helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
}
public void testIncD020() throws IOException, URISyntaxException {
compileAndCompare("incd020");
}
public void testScroll() throws IOException, URISyntaxException {
compileAndCompare("scroll");
}

View File

@ -0,0 +1,8 @@
byte* BGCOL = $d020;
main();
void main() {
do {
++*BGCOL;
(*BGCOL)++;
} while (true)
}

View File

@ -2,8 +2,7 @@ byte* SCREEN = $0400;
byte* RASTER = $d012;
byte* BGCOL = $d020;
byte* SCROLL = $d016;
byte* TEXT = "this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. ";
byte[] STOP = { 0 };
byte* TEXT = "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =- @";
main();
void main() {