Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

correct spacing around operators in slice output

  • Loading branch information...
commit 972a5299d54d75aefaba941472736e22191448a6 1 parent b814981
@michaelficarra michaelficarra authored
View
2  lib/coffee-script/lexer.js
@@ -535,7 +535,7 @@
case end:
stack.pop();
if (!stack.length) {
- return str.slice(0, +i+1 || 9e9);
+ return str.slice(0, +i + 1 || 9e9);
}
end = stack[stack.length - 1];
continue;
View
2  lib/coffee-script/nodes.js
@@ -1151,7 +1151,7 @@
fromStr = from && from.compile(o, LEVEL_PAREN) || '0';
compiled = to && to.compile(o, LEVEL_PAREN);
if (to && !(!this.range.exclusive && +compiled === -1)) {
- toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? "" + (+compiled + 1) : (compiled = to.compile(o, LEVEL_ACCESS), "+" + compiled + "+1 || 9e9"));
+ toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? "" + (+compiled + 1) : (compiled = to.compile(o, LEVEL_ACCESS), "+" + compiled + " + 1 || 9e9"));
}
return ".slice(" + fromStr + (toStr || '') + ")";
};
View
4 lib/coffee-script/rewriter.js
@@ -121,7 +121,7 @@
startIndex = 0;
condition = function(token, i) {
var one, tag, three, two, _ref, _ref1;
- _ref = this.tokens.slice(i + 1, +(i + 3)+1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
+ _ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) {
return false;
}
@@ -196,7 +196,7 @@
if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') {
noCall = true;
}
- _ref = tokens.slice(i - 1, +(i + 1)+1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
+ _ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0);
seenSingle = false;
seenControl = false;
View
2  src/nodes.coffee
@@ -787,7 +787,7 @@ exports.Slice = class Slice extends Base
"#{+compiled + 1}"
else
compiled = to.compile o, LEVEL_ACCESS
- "+#{compiled}+1 || 9e9"
+ "+#{compiled} + 1 || 9e9"
".slice(#{ fromStr }#{ toStr or '' })"
#### Obj
View
2  test/slicing_and_splicing.coffee
@@ -61,7 +61,7 @@ test "#1722: operator precedence in unbounded slice compilation", ->
arrayEq [0..n], list[..n or 0]
arrayEq [0..n], list[..if n then n else 0]
-test "#2349: slicing to numeric strings", ->
+test "#2349: inclusive slicing to numeric strings", ->
arrayEq [0, 1], [0..10][.."1"]
Please sign in to comment.
Something went wrong with that request. Please try again.