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
|
// Special handling of negative literal number
|
||||||
if(child instanceof ConstantInteger && operator.equals(Operators.NEG)) {
|
if(child instanceof ConstantInteger && operator.equals(Operators.NEG)) {
|
||||||
return new ConstantInteger(-((ConstantInteger) child).getInteger(), ((ConstantInteger) child).getType());
|
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) {
|
} else if(child instanceof ConstantValue) {
|
||||||
return new ConstantUnary((OperatorUnary) operator, (ConstantValue) child);
|
return new ConstantUnary((OperatorUnary) operator, (ConstantValue) child);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2710,7 +2710,8 @@ public class TestPrograms {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddressOf1() throws IOException, URISyntaxException {
|
public void testAddressOf1() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("address-of-1");
|
compileAndCompare("address-of-1", log().verboseCreateSsa());
|
||||||
|
fail("Address-of-not detected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
// Tests calling into arrays of pointers to non-args no-return functions
|
// 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() {
|
void fn1() {
|
||||||
const byte* BORDERCOL = $d020;
|
const byte* BORDERCOL = $d020;
|
||||||
(*BORDERCOL)++;
|
(*BORDERCOL)++;
|
||||||
@ -21,3 +10,13 @@ void fn2() {
|
|||||||
(*BGCOL)++;
|
(*BGCOL)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void()*[2] fns = { &fn1, &fn2 };
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
byte i = 0;
|
||||||
|
while(true) {
|
||||||
|
void()* f = fns[++i&1];
|
||||||
|
(*f)();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user