Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra JIT features #2313

Closed
3 tasks done
gfwilliams opened this issue Jan 11, 2023 · 2 comments
Closed
3 tasks done

Extra JIT features #2313

gfwilliams opened this issue Jan 11, 2023 · 2 comments

Comments

@gfwilliams
Copy link
Member

gfwilliams commented Jan 11, 2023

  • a && b/a || b

Discussed at https://forum.espruino.com/conversations/382898/#comment16823779

It's not a bug, it's just not implemented yet. Because && is a short-circuiting operator it's not quite as simple as doing & with booleans, but it shouldn't be a huge problem (it's just the 'if' code).

  • array creation a = [1,2,3]

This one shouldn't be too hard, and is very useful when trying to do stuff like draw polylines

  • object creation a = { b : 42 }

Again, pretty useful especially when calling some built-in functions. Probably not that hard either.

@gfwilliams gfwilliams changed the title JIT should handle &&/|| Extra JIT features Jan 11, 2023
@fanoush
Copy link
Contributor

fanoush commented Jan 15, 2023

also array index access

>(function(){"jit";var i=0,a=Uint8Array(1);a[0]=1;return a[i];})();
Uncaught Error: Field or method "i" does not already exist, and can't create it on Uint8Array
 at line 1 col 65
...y(1);a[0]=1;return a[i];})();

workaround is using a[i.ToString()]

@gfwilliams
Copy link
Member Author

Thanks @fanoush - just fixed that too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants