rainforestapp / decaf

Coffeescript to ES.next transpiler. Now maintained over at
https://github.com/juliankrispel/decaf
MIT License
106 stars 10 forks source link

Modulo operator doesn't cache result #6

Closed eventualbuddha closed 8 years ago

eventualbuddha commented 8 years ago
a %% b

Throws an error:

Error: "%%" does not match field "operator": == | != | === | !== | < | <= | > | >= | << | >> | >>> | + | - | * | / | % | & | | | ^ | in | instanceof | .. of type BinaryExpression
  at add (/Users/donovan/lib/decaf/node_modules/ast-types/lib/types.js:576:27)
  at /Users/donovan/lib/decaf/node_modules/ast-types/lib/types.js:589:17
juliankrispel commented 8 years ago

@eventualbuddha awesome thanks for all the issues :)

juliankrispel commented 8 years ago

Argh this is not quite done, as @eventualbuddha noted:

This needs more work. For example, a() %% b() turns into (a() % b() + b()) % b(); which evaluates the values too many times.

juliankrispel commented 8 years ago

fixed in #93