diff --git a/app/astride/sandbox.js b/app/astride/sandbox.js index daa2952..342ce1f 100644 --- a/app/astride/sandbox.js +++ b/app/astride/sandbox.js @@ -294,10 +294,14 @@ export default class Sandbox { if (test.yield) { return test; } + result = { + yield: YIELD_NONE, + value: undefined, + }; if (test.value) { result = this.executeSync(node.consequent, depth + 1); } - else { + else if (node.alternate) { result = this.executeSync(node.alternate, depth + 1); } if (result.yield) { diff --git a/app/astride/sandbox.test.js b/app/astride/sandbox.test.js index 6a5e335..5914443 100644 --- a/app/astride/sandbox.test.js +++ b/app/astride/sandbox.test.js @@ -135,6 +135,9 @@ test('evaluates conditional branches', async () => { else { bar = 2; } + if (await false) { + bar = 1; + } `), ); await finish(sandbox);