From 50b023e6c9498fddbd6d11bb27be38008127b365 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 24 Jul 2024 10:29:51 -0700 Subject: [PATCH] Fix syntax error from #4164 (#4167) * Fix syntax error from #4164 Function statements require a name. See #4166 * Apply suggestions from code review Co-authored-by: Jordan Harband --------- Co-authored-by: Jordan Harband --- harness/hidden-constructors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/harness/hidden-constructors.js b/harness/hidden-constructors.js index d73facfbcf..d721379470 100644 --- a/harness/hidden-constructors.js +++ b/harness/hidden-constructors.js @@ -15,13 +15,13 @@ var AsyncGeneratorFunction; var GeneratorFunction; try { - AsyncFunction = Object.getPrototypeOf(new Function('async function () {}')).constructor; + AsyncFunction = Object.getPrototypeOf(new Function('return async function dummy() {}')()).constructor; } catch(e) {} try { - AsyncGeneratorFunction = Object.getPrototypeOf(new Function('async function* () {}')).constructor; + AsyncGeneratorFunction = Object.getPrototypeOf(new Function('return async function* dummy() {}')()).constructor; } catch(e) {} try { - GeneratorFunction = Object.getPrototypeOf(new Function('function* () {}')).constructor; + GeneratorFunction = Object.getPrototypeOf(new Function('return function* dummy() {}')()).constructor; } catch(e) {}