mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixing parens-around-implicit-function-with-multiline-chained-chaser bug
This commit is contained in:
@@ -111,6 +111,7 @@ exports.Rewriter: class Rewriter
|
||||
stack: [0]
|
||||
calls: 0
|
||||
parens: 0
|
||||
start_parens: 0
|
||||
@scan_tokens (prev, token, post, i) =>
|
||||
tag: token[0]
|
||||
switch tag
|
||||
@@ -123,7 +124,7 @@ exports.Rewriter: class Rewriter
|
||||
last: stack.pop()
|
||||
stack[stack.length - 1]: + last
|
||||
open: stack[stack.length - 1] > 0
|
||||
if !post? or (parens is 0 and include IMPLICIT_END, tag)
|
||||
if !post? or (start_parens > parens) or (parens is 0 and include IMPLICIT_END, tag)
|
||||
return 1 if tag is 'INDENT' and prev and include IMPLICIT_BLOCK, prev[0]
|
||||
return 1 if tag is 'OUTDENT' and token.generated
|
||||
if open or tag is 'INDENT'
|
||||
@@ -136,6 +137,7 @@ exports.Rewriter: class Rewriter
|
||||
return size
|
||||
return 1 unless prev and include(IMPLICIT_FUNC, prev[0]) and include(IMPLICIT_CALL, tag)
|
||||
calls: 0
|
||||
start_parens: if tag is '(' then parens - 1 else parens
|
||||
@tokens.splice i, 0, ['CALL_START', '(', token[2]]
|
||||
stack[stack.length - 1]: + 1
|
||||
return 2
|
||||
|
||||
Reference in New Issue
Block a user