Skip to content

Commit

Permalink
reduce parentheses around %% operator
Browse files Browse the repository at this point in the history
Back when I wrote 4cbbd93, I didn't know about `o.level`. Now I do.
  • Loading branch information
rhendric committed Jun 27, 2018
1 parent dcbbcb5 commit 61afa79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/ast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/ast.ls
Expand Up @@ -1527,9 +1527,11 @@ class exports.Binary extends Node

compileMod: (o) ->
ref = o.scope.temporary!
code = [sn(this, "((("), (@first.compile o), sn(this, ") % ("), sn(this, ref, " = "), (@second.compile o), sn(this, ") + ", ref, ") % ", ref, ")")]
code = [sn(this, "(("), (@first.compile o), sn(this, ") % ("), sn(this, ref, " = "), (@second.compile o), sn(this, ") + ", ref, ") % ", ref)]
o.scope.free ref
sn(null, ...code)
if o.level < LEVEL_OP + PREC\%
then sn(null, ...code)
else sn(null, "(", ...code, ")")

compilePartial: (o) ->
vit = Var \it
Expand Down

0 comments on commit 61afa79

Please sign in to comment.