mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixing issue #454 single-line function with single-line if/else
This commit is contained in:
parent
f7345ffaac
commit
698784e103
2 changed files with 2 additions and 2 deletions
|
@ -246,7 +246,7 @@
|
|||
idx += 1;
|
||||
tok = this.tokens[idx];
|
||||
pre = this.tokens[idx - 1];
|
||||
if ((!tok || (include(SINGLE_CLOSERS, tok[0]) && tok[1] !== ';' && parens === 0) || (tok[0] === ')' && parens === 0)) && !(starter === 'ELSE' && tok[0] === 'ELSE')) {
|
||||
if ((!tok || (include(SINGLE_CLOSERS, tok[0]) && tok[1] !== ';' && parens === 0) || (tok[0] === ')' && parens === 0)) && !(tok[0] === 'ELSE' && !('IF' === starter || 'THEN' === starter))) {
|
||||
insertion = pre[0] === "," ? idx - 1 : idx;
|
||||
outdent = ['OUTDENT', 2, token[2]];
|
||||
outdent.generated = true;
|
||||
|
|
|
@ -174,7 +174,7 @@ exports.Rewriter: class Rewriter
|
|||
if (not tok or
|
||||
(include(SINGLE_CLOSERS, tok[0]) and tok[1] isnt ';' and parens is 0) or
|
||||
(tok[0] is ')' and parens is 0)) and
|
||||
not (starter is 'ELSE' and tok[0] is 'ELSE')
|
||||
not (tok[0] is 'ELSE' and starter not in ['IF', 'THEN'])
|
||||
insertion: if pre[0] is "," then idx - 1 else idx
|
||||
outdent: ['OUTDENT', 2, token[2]]
|
||||
outdent.generated: true
|
||||
|
|
Loading…
Reference in a new issue