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 <ljharb@gmail.com>

---------

Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
Philip Chimento 2024-07-24 10:29:51 -07:00 committed by GitHub
parent 29fe58bc8f
commit 50b023e6c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -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) {}