Skip to content

Commit 29e1720

Browse files
author
Zdenko Vujasinovic
committed
tests; improved implicit call recognition with dots on the left in the
1 parent 3fbbe93 commit 29e1720

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

lib/coffeescript/rewriter.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rewriter.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ exports.Rewriter = class Rewriter
268268
if (tag in IMPLICIT_FUNC and token.spaced or
269269
tag is '?' and i > 0 and not tokens[i - 1].spaced) and
270270
(nextTag in IMPLICIT_CALL or
271-
(nextTag is '...' and not @findTagsBackwards(i, ['INDEX_START', '['])) or
271+
(nextTag is '...' and @tag(i + 2) in IMPLICIT_CALL and not @findTagsBackwards(i, ['INDEX_START', '['])) or
272272
nextTag in IMPLICIT_UNSPACED_CALL and
273273
not nextToken.spaced and not nextToken.newLine)
274274
tag = token[0] = 'FUNC_EXIST' if tag is '?'

test/slicing_and_splicing.coffee

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ test "#1722: operator precedence in unbounded slice compilation", ->
6464
test "#2349: inclusive slicing to numeric strings", ->
6565
arrayEq [0, 1], [0..10][.."1"]
6666

67+
test "#4631: slicing with space before and/or after the dots", ->
68+
a = (s) -> s
69+
b = [4, 5, 6]
70+
c = [7, 8, 9]
71+
arrayEq [2, 3, 4], shared[2 ... 5]
72+
arrayEq [3, 4, 5], shared[3... 6]
73+
arrayEq [4, 5, 6], shared[4 ...7]
74+
arrayEq shared[(a b...)...(a c...)] , shared[(a ...b)...(a ...c)]
75+
arrayEq shared[(a b...) ... (a c...)], shared[(a ...b) ... (a ...c)]
76+
arrayEq shared[(a b...)... (a c...)] , shared[(a ...b)... (a ...c)]
77+
arrayEq shared[(a b...) ...(a c...)] , shared[(a ...b) ...(a ...c)]
78+
6779

6880
# Splicing
6981

0 commit comments

Comments
 (0)