diff --git a/lib/coffee-script/nodes.js b/lib/coffee-script/nodes.js index 5f115d72..c61159a1 100644 --- a/lib/coffee-script/nodes.js +++ b/lib/coffee-script/nodes.js @@ -2472,9 +2472,9 @@ parts.push(this.first.expression.compileToFragments(o, LEVEL_OP)); } } else { - parts.push([this.makeCode(op)]); - parts.push([this.makeCode(' ')]); + parts.push([this.makeCode("(" + op + " ")]); parts.push(this.first.compileToFragments(o, LEVEL_OP)); + parts.push([this.makeCode(")")]); } return this.joinFragmentArrays(parts, ''); }; diff --git a/src/nodes.coffee b/src/nodes.coffee index dc01e364..72162242 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -1760,9 +1760,9 @@ exports.Op = class Op extends Base if 'expression' in Object.keys @first parts.push @first.expression.compileToFragments o, LEVEL_OP if @first.expression? else - parts.push [@makeCode op] - parts.push [@makeCode(' ')] + parts.push [@makeCode "(#{op} "] parts.push @first.compileToFragments o, LEVEL_OP + parts.push [@makeCode ")"] @joinFragmentArrays parts, '' compilePower: (o) ->