fixing implicit invocations against inline try/catch.
This commit is contained in:
parent
cd5c41f351
commit
9e32a5bfa1
|
@ -190,7 +190,7 @@
|
|||
if (!seenSingle && token.fromThen) {
|
||||
return true;
|
||||
}
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === '->' || tag === '=>') {
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>') {
|
||||
seenSingle = true;
|
||||
}
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY') {
|
||||
|
|
|
@ -155,7 +155,7 @@ class exports.Rewriter
|
|||
@detectEnd i + 1, (token, i) ->
|
||||
[tag] = token
|
||||
return yes if not seenSingle and token.fromThen
|
||||
seenSingle = yes if tag in ['IF', 'ELSE', '->', '=>']
|
||||
seenSingle = yes if tag in ['IF', 'ELSE', 'CATCH', '->', '=>']
|
||||
seenControl = yes if tag in ['IF', 'ELSE', 'SWITCH', 'TRY']
|
||||
return yes if tag in ['.', '?.', '::'] and @tag(i - 1) is 'OUTDENT'
|
||||
not token.generated and @tag(i - 1) isnt ',' and (tag in IMPLICIT_END or
|
||||
|
|
|
@ -476,6 +476,10 @@ test "implicit call against control structures", ->
|
|||
'caught'
|
||||
|
||||
eq result, 'caught'
|
||||
|
||||
save try doesnt(exist) catch error then 'caught2'
|
||||
|
||||
eq result, 'caught2'
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue