fix: handle bailed when recursive convert (#5499)

This commit is contained in:
Sven SAULEAU
2017-03-22 09:18:37 +01:00
committed by GitHub
parent 7d37017a5f
commit 2b774f46fb
3 changed files with 14 additions and 1 deletions

View File

@@ -65,7 +65,10 @@ export function toSequenceExpression(nodes: Array<Object>, scope: Scope): ?Objec
} else if (t.isIfStatement(node)) {
const consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode();
const alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode();
if (!consequent || !alternate) return bailed = true;
if (consequent === true || alternate === true) {
return bailed = true;
}
exprs.push(t.conditionalExpression(node.test, consequent, alternate));
} else if (t.isBlockStatement(node)) {