1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Revert "Fix for #1304 ... but disallows an alternative syntax."

This reverts commit 31bfe50831.
This commit is contained in:
Jeremy Ashkenas 2011-05-01 10:43:50 -04:00
parent 31bfe50831
commit 2fb7ccc8f0
3 changed files with 3 additions and 17 deletions

View file

@ -118,7 +118,7 @@
return false;
}
tag = token[0];
return ((tag === 'TERMINATOR' || tag === 'OUTDENT') && !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':')) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT' && _ref2 !== '->' && _ref2 !== '=>'));
return ((tag === 'TERMINATOR' || tag === 'OUTDENT') && !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':')) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT'));
};
action = function(token, i) {
var tok;

View file

@ -103,7 +103,7 @@ class exports.Rewriter
(tag in ['TERMINATOR', 'OUTDENT'] and
not (two?[0] is ':' or one?[0] is '@' and three?[0] is ':')) or
(tag is ',' and one and
one[0] not in ['IDENTIFIER', 'NUMBER', 'STRING', '@', 'TERMINATOR', 'OUTDENT', '->', '=>'])
one[0] not in ['IDENTIFIER', 'NUMBER', 'STRING', '@', 'TERMINATOR', 'OUTDENT'])
action = (token, i) ->
tok = ['}', '}', token[2]]
tok.generated = yes

View file

@ -147,23 +147,9 @@ test "Trying an implicit object call with a trailing function.", ->
a = null
meth = (arg, obj, func) -> a = [obj.a, arg, func()].join ' '
meth 'apple', {b: 1, a: 13}, ->
meth 'apple', b: 1, a: 13, ->
'orange'
ok a is '13 apple orange'
test "Ensure that trailing calls in implicit objects can be parsed.", ->
obj =
a: id 0, ->
1
b: id 0, =>
1
eq obj.a[0], 0
eq obj.a[1](), 1
eq obj.b[0], 0
eq obj.b[1](), 1
test "Ensure that empty functions don't return mistaken values.", ->