mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +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:
parent
5a4388d6d3
commit
b4abb9394e
@ -43,10 +43,13 @@ public class Pass1EliminateEmptyBlocks {
|
||||
}
|
||||
}
|
||||
for (LabelRef labelRef : removeList) {
|
||||
graph.remove(labelRef);
|
||||
Label label = program.getScope().getLabel(labelRef);
|
||||
label.getScope().remove(label);
|
||||
log.append("Removing empty block "+labelRef);
|
||||
Symbol removeSymbol = program.getScope().getSymbol(labelRef);
|
||||
if(removeSymbol instanceof Label) {
|
||||
Label label = (Label) removeSymbol;
|
||||
graph.remove(labelRef);
|
||||
label.getScope().remove(label);
|
||||
log.append("Removing empty block "+labelRef);
|
||||
}
|
||||
}
|
||||
return removeList.size()>0;
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
8
src/main/java/dk/camelot64/kickc/test/incd020.kc
Normal file
8
src/main/java/dk/camelot64/kickc/test/incd020.kc
Normal file
@ -0,0 +1,8 @@
|
||||
byte* BGCOL = $d020;
|
||||
main();
|
||||
void main() {
|
||||
do {
|
||||
++*BGCOL;
|
||||
(*BGCOL)++;
|
||||
} while (true)
|
||||
}
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user