From d40631fd44165936158633cc81c4d62cc2a6a5a9 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 28 May 2021 18:47:54 +0100 Subject: fix corner cases in `awaits` (#4976) fixes #4974 fixes #4975 --- test/compress/awaits.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'test/compress') diff --git a/test/compress/awaits.js b/test/compress/awaits.js index e1b2805c..612cf8b5 100644 --- a/test/compress/awaits.js +++ b/test/compress/awaits.js @@ -1682,3 +1682,47 @@ issue_4972_3: { ] node_version: ">=8" } + +issue_4974: { + options = { + awaits: true, + side_effects: true, + } + input: { + (async function f() { + return 42 in f(); + })(); + console.log("PASS"); + } + expect: { + (async function f() { + return 42 in f(); + })(); + console.log("PASS"); + } + expect_stdout: true + node_version: ">=8" +} + +issue_4975: { + options = { + awaits: true, + side_effects: true, + } + input: { + (async function f(a) { + try { + if (a) console.log(typeof f()); + } catch (e) {} + })(42); + } + expect: { + (async function f(a) { + try { + if (a) console.log(typeof f()); + } catch (e) {} + })(42); + } + expect_stdout: "object" + node_version: ">=8" +} -- cgit v1.2.3