EspruinoCompiler
EspruinoCompiler copied to clipboard
Infer argument types
Currently if I write:
function a(x) {
"compiled";
print(x|0);
}
You get something a bit like like:
void a(JsVar *x) {
print(jsvGetInteger(x)|0);
}
We know that x|0 is an integer already, so ideally:
- x itself would get converted to an integer, which would change the argument type
x|0then detected as a no-op and removed (although the compiler would do this so do we care?)
void a(int x) {
print(x);
}