mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-15 01:38:13 -05:00
Spacing only + and - and only in a row.
This commit is contained in:
@@ -1290,8 +1290,8 @@
|
||||
return new Existence(fst).compile(o) + (" ? " + ref + " : " + (this.second.compile(o, LVL_LIST)));
|
||||
};
|
||||
Op.prototype.compileUnary = function(o) {
|
||||
var _ref2, parts, space;
|
||||
space = (_ref2 = this.operator, __indexOf.call(this.PREFIX_OPERATORS, _ref2) >= 0) || this.first instanceof Op ? ' ' : '';
|
||||
var _ref2, _ref3, parts, space;
|
||||
space = (_ref2 = this.operator, __indexOf.call(this.PREFIX_OPERATORS, _ref2) >= 0) || this.first instanceof Op && this.first.operator === this.operator && ((_ref3 = this.operator) === '+' || _ref3 === '-') ? ' ' : '';
|
||||
parts = [this.operator, space, this.first.compile(o, LVL_OP)];
|
||||
return (this.flip ? parts.reverse() : parts).join('');
|
||||
};
|
||||
|
||||
@@ -1108,7 +1108,8 @@ exports.Op = class Op extends Base
|
||||
|
||||
# Compile a unary **Op**.
|
||||
compileUnary: (o) ->
|
||||
space = if @operator in @PREFIX_OPERATORS or @first instanceof Op then ' ' else ''
|
||||
space = if @operator in @PREFIX_OPERATORS or @first instanceof Op and
|
||||
@first.operator is @operator and @operator in ['+', '-'] then ' ' else ''
|
||||
parts = [@operator, space, @first.compile(o, LVL_OP)]
|
||||
(if @flip then parts.reverse() else parts).join ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user