mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Revert "Fixes Issue #618. Close implicit arguments in the middle of param lists."
This reverts commit 474c372b17.
This commit is contained in:
@@ -160,7 +160,7 @@
|
||||
tok.generated = true;
|
||||
this.tokens.splice(idx, 0, tok);
|
||||
condition = function(token, i) {
|
||||
var _c, _d, _e, _f, one, three, two;
|
||||
var _c, _d, _e, one, three, two;
|
||||
_c = this.tokens.slice(i + 1, i + 4);
|
||||
one = _c[0];
|
||||
two = _c[1];
|
||||
@@ -168,10 +168,7 @@
|
||||
if ((this.tag(i + 1) === 'HERECOMMENT' || this.tag(i - 1) === 'HERECOMMENT')) {
|
||||
return false;
|
||||
}
|
||||
if (token[0] === ',' && one && (('TERMINATOR' === (_d = one[0]) || 'OUTDENT' === _d))) {
|
||||
return false;
|
||||
}
|
||||
return ((('TERMINATOR' === (_e = token[0]) || 'OUTDENT' === _e || ',' === _e)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_f = one[0]) || 'STRING' === _f || '@' === _f || 'TERMINATOR' === _f || 'OUTDENT' === _f)));
|
||||
return ((('TERMINATOR' === (_d = token[0]) || 'OUTDENT' === _d)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_e = one[0]) || 'STRING' === _e || '@' === _e || 'TERMINATOR' === _e || 'OUTDENT' === _e)));
|
||||
};
|
||||
action = function(token, i) {
|
||||
return this.tokens.splice(i, 0, ['}', '}', token[2]]);
|
||||
|
||||
@@ -140,8 +140,7 @@ exports.Rewriter = class Rewriter
|
||||
condition = (token, i) ->
|
||||
[one, two, three] = @tokens.slice(i + 1, i + 4)
|
||||
return false if 'HERECOMMENT' in [@tag(i + 1), @tag(i - 1)]
|
||||
return false if token[0] is ',' and one and (one[0] in ['TERMINATOR', 'OUTDENT'])
|
||||
((token[0] in ['TERMINATOR', 'OUTDENT', ',']) and not ((two and two[0] is ':') or (one and one[0] is '@' and three and three[0] is ':'))) or
|
||||
((token[0] in ['TERMINATOR', 'OUTDENT']) and not ((two and two[0] is ':') or (one and one[0] is '@' and three and three[0] is ':'))) or
|
||||
(token[0] is ',' and one and (one[0] not in ['IDENTIFIER', 'STRING', '@', 'TERMINATOR', 'OUTDENT']))
|
||||
action = (token, i) ->
|
||||
@tokens.splice i, 0, ['}', '}', token[2]]
|
||||
|
||||
@@ -152,13 +152,6 @@ ok obj.a is 1
|
||||
ok obj.b is 2
|
||||
|
||||
|
||||
# Implicit objects may close in the middle of argument lists.
|
||||
result = null
|
||||
func = (one, two) -> result = two
|
||||
func a: 1, b: 2, 3, 4
|
||||
ok result is 3
|
||||
|
||||
|
||||
# Implicit objects nesting.
|
||||
obj =
|
||||
options:
|
||||
|
||||
Reference in New Issue
Block a user