fixing implicit-call-in-function-in-parens bug.

This commit is contained in:
Jeremy Ashkenas 2010-04-10 18:56:46 -04:00
parent 8317960f81
commit df97effb9c
3 changed files with 11 additions and 2 deletions

View File

@ -162,7 +162,7 @@
stack[stack.length - 1] += last;
}
open = stack[stack.length - 1] > 0;
if (!(typeof post !== "undefined" && post !== null) || (start_parens > parens) || (parens === 0 && include(IMPLICIT_END, tag))) {
if (!(typeof post !== "undefined" && post !== null) || (start_parens > parens) || (start_parens === parens && include(IMPLICIT_END, tag))) {
if (tag === 'INDENT' && prev && include(IMPLICIT_BLOCK, prev[0])) {
return 1;
}

View File

@ -124,7 +124,7 @@ exports.Rewriter: class Rewriter
last: stack.pop()
stack[stack.length - 1]: + last
open: stack[stack.length - 1] > 0
if !post? or (start_parens > parens) or (parens is 0 and include IMPLICIT_END, tag)
if !post? or (start_parens > parens) or (start_parens is parens 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'

View File

@ -129,3 +129,12 @@ result: (f 1).toString()
.length
ok result is 1
# Test implicit calls in functions in parens:
result: ((val) ->
[].push val
val
)(10)
ok result is 10