mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-09 20:31:44 +00:00
Working on catching all declared constants in parse 0.
This commit is contained in:
parent
6b15bedde0
commit
162fb7f1e5
@ -2018,6 +2018,8 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
|
||||
// Special handling of negative literal number
|
||||
if(child instanceof ConstantInteger && operator.equals(Operators.NEG)) {
|
||||
return new ConstantInteger(-((ConstantInteger) child).getInteger(), ((ConstantInteger) child).getType());
|
||||
} else if(operator.equals(Operators.ADDRESS_OF) && child instanceof SymbolRef) {
|
||||
return new ConstantSymbolPointer((SymbolRef) child);
|
||||
} else if(child instanceof ConstantValue) {
|
||||
return new ConstantUnary((OperatorUnary) operator, (ConstantValue) child);
|
||||
} else {
|
||||
|
@ -2710,7 +2710,8 @@ public class TestPrograms {
|
||||
|
||||
@Test
|
||||
public void testAddressOf1() throws IOException, URISyntaxException {
|
||||
compileAndCompare("address-of-1");
|
||||
compileAndCompare("address-of-1", log().verboseCreateSsa());
|
||||
fail("Address-of-not detected!");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1,16 +1,5 @@
|
||||
// Tests calling into arrays of pointers to non-args no-return functions
|
||||
|
||||
|
||||
void()*[2] fns = { &fn1, &fn2 };
|
||||
|
||||
void main() {
|
||||
byte i = 0;
|
||||
while(true) {
|
||||
void()* f = fns[++i&1];
|
||||
(*f)();
|
||||
}
|
||||
}
|
||||
|
||||
void fn1() {
|
||||
const byte* BORDERCOL = $d020;
|
||||
(*BORDERCOL)++;
|
||||
@ -21,3 +10,13 @@ void fn2() {
|
||||
(*BGCOL)++;
|
||||
}
|
||||
|
||||
void()*[2] fns = { &fn1, &fn2 };
|
||||
|
||||
void main() {
|
||||
byte i = 0;
|
||||
while(true) {
|
||||
void()* f = fns[++i&1];
|
||||
(*f)();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user