effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
335 stars 24 forks source link

JS: Parenthesize arguments of raw expresions #531

Closed marzipankaiser closed 4 months ago

marzipankaiser commented 4 months ago

Fixes #505 by parenthesizing the arguments of RawExprs unless they are already atomic expressions.

Also tries to add few parentheses into the generated code.

marzipankaiser commented 4 months ago

Future work:

marzipankaiser commented 4 months ago

Future work:

  • [x] Double-check whether we need to parenthesize objects or literals in certain places.

Update: You were right btw, that the receiver in a method call has to be parenthesized even if it is an object or number literal (but it seems to work for arrays).