Skip to content

Commit

Permalink
Fixed missing parentheses on a binary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Anantachai Saothong (Manta) committed Jun 19, 2017
1 parent 9ca4b5b commit 8f1be61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ function format(content, options = {}) {
outputBuffer.append(travel(inputNode, inputNode.val, indentLevel, true))

} else {
const insideUnaryOp = inputNode.parent instanceof Stylus.nodes.Expression && inputNode.parent.parent instanceof Stylus.nodes.UnaryOp
const insideUnaryOp = inputNode.parent instanceof Stylus.nodes.Expression && (inputNode.parent.parent instanceof Stylus.nodes.UnaryOp || inputNode.parent.parent instanceof Stylus.nodes.BinOp)
const escapeDivider = inputNode.op === '/'
if (insideUnaryOp || escapeDivider) {
outputBuffer.append(openParen)
Expand Down
1 change: 1 addition & 0 deletions spec/property/input.styl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ body
padding 1 \+ 2
top 14px-@padding
bottom -(14px-@padding)
height (1+2- 3)*4
font 14px/1.4
font (14px/1.4)
transition .3s opacity
Expand Down
1 change: 1 addition & 0 deletions spec/property/output.styl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ body {
padding: 1 \+ 2;
top: 14px - @padding;
bottom: -(14px - @padding);
height: (1 + 2 - 3) * 4;
font: 14px / 1.4;
font: (14px / 1.4);
transition: 0.3s opacity;
Expand Down

0 comments on commit 8f1be61

Please sign in to comment.