From 2fb7ccc8f0e7d6878c7279535fad5a47cb8e8019 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sun, 1 May 2011 10:43:50 -0400 Subject: [PATCH] Revert "Fix for #1304 ... but disallows an alternative syntax." This reverts commit 31bfe50831e3e7ac621fec77be69453d9d31bb73. --- lib/rewriter.js | 2 +- src/rewriter.coffee | 2 +- test/function_invocation.coffee | 16 +--------------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/rewriter.js b/lib/rewriter.js index d5fdf825..f4c4003b 100644 --- a/lib/rewriter.js +++ b/lib/rewriter.js @@ -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; diff --git a/src/rewriter.coffee b/src/rewriter.coffee index 6ef87033..c738e4a1 100644 --- a/src/rewriter.coffee +++ b/src/rewriter.coffee @@ -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 diff --git a/test/function_invocation.coffee b/test/function_invocation.coffee index 5c7c51be..ff39304a 100644 --- a/test/function_invocation.coffee +++ b/test/function_invocation.coffee @@ -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.", ->