ratel-rust / ratel-core

High performance JavaScript to JavaScript compiler with a Rust core
Apache License 2.0
435 stars 17 forks source link

Paren expression is missing #107

Open kdy1 opened 5 years ago

kdy1 commented 5 years ago

Note: It's not cst vs ast problem.

For class transformation, this is necessary.

Example usecase:

(Bar.__proto__ || Object.getPrototypeOf(Bar))
maciejhirsz commented 5 years ago

If you really need it, you can use SequenceExpression with a single item.

You shouldn't have to do that though. The code generator should be able to check the operator precedence of things vs how they are nested in the AST, and insert parens around binary expressions that need them.