mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fixed chaining semantics after outdent
This commit is contained in:
parent
21db08a23d
commit
39cb8815f7
3 changed files with 14 additions and 16 deletions
|
@ -290,16 +290,10 @@
|
|||
startImplicitObject(s, !!startsLine);
|
||||
return forward(2);
|
||||
}
|
||||
if (inImplicitCall() && __indexOf.call(CALL_CLOSERS, tag) >= 0) {
|
||||
if (prevTag === 'OUTDENT') {
|
||||
endImplicitCall();
|
||||
return forward(1);
|
||||
}
|
||||
if (prevToken.newLine) {
|
||||
if (inImplicitCall() && __indexOf.call(CALL_CLOSERS, tag) >= 0 && (prevTag === 'OUTDENT' || prevToken.newLine)) {
|
||||
endAllImplicitCalls();
|
||||
return forward(1);
|
||||
}
|
||||
}
|
||||
if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
|
||||
stackTop()[2].sameLine = false;
|
||||
}
|
||||
|
|
|
@ -286,11 +286,8 @@ class exports.Rewriter
|
|||
# .g b
|
||||
# .h a
|
||||
#
|
||||
if inImplicitCall() and tag in CALL_CLOSERS
|
||||
if prevTag is 'OUTDENT'
|
||||
endImplicitCall()
|
||||
return forward(1)
|
||||
if prevToken.newLine
|
||||
if inImplicitCall() and tag in CALL_CLOSERS and
|
||||
(prevTag is 'OUTDENT' or prevToken.newLine)
|
||||
endAllImplicitCalls()
|
||||
return forward(1)
|
||||
|
||||
|
|
|
@ -98,6 +98,13 @@ test "#1495, method call chaining", ->
|
|||
).join ', '
|
||||
eq 'a, b, c', result
|
||||
|
||||
test "chaining after outdent", ->
|
||||
str = 'abc'
|
||||
zero = parseInt str.replace /\w/, (letter) ->
|
||||
0
|
||||
.toString()
|
||||
eq '0', zero
|
||||
|
||||
# Operators
|
||||
|
||||
test "newline suppression for operators", ->
|
||||
|
|
Loading…
Add table
Reference in a new issue