Closed pepe closed 2 years ago
I found some issues with array type definition I need to investigate.
So it looks to me that the problem was present before changes from this PR. With the code from the current master, when I run:
janet -l /jpm/cgen -e "(ir (defn fun [] int (def a (array int) (array 1)) (return (index a 0))))"
The script prints:
int fun() {
(int[]) a = {1};
return a[0];
}
The result does not seem to be the correct array type declaration.
The last commit redoes the array variable definition:
janet -l /jpm/cgen -e "(ir (defn fun [] int (def (array a) int) (return (index a 0))))"
# prints
int fun() {
int a[];
return a[0];
}
But I have feeling I fight the original intentions
I guess let's see
After #43, where I used
match
for resolving in theemit-janet
function, I examined where we are resolving actions and concluded that for many of them, usage ofmatch
with the new& rest
is a better choice.This PR also adds the implicit block for
while
when more than one statement is in its body.