Skip to content

Commit

Permalink
Prevent harness code not loading when async/generator/asyncGenerator …
Browse files Browse the repository at this point in the history
…not supported (#4164)

* Dont throw when async/generato/asyncGenerator not supported

* Apply suggestions from code review
  • Loading branch information
p-bakker authored Jul 24, 2024
1 parent d8aa2e4 commit f55e997
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions harness/hidden-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ defines:
- GeneratorFunction
---*/

var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
var AsyncFunction;
var AsyncGeneratorFunction;
var GeneratorFunction;

try {
AsyncFunction = Object.getPrototypeOf(new Function('async function () {}')).constructor;
} catch(e) {}

try {
AsyncGeneratorFunction = Object.getPrototypeOf(new Function('async function* () {}')).constructor;
} catch(e) {}

try {
GeneratorFunction = Object.getPrototypeOf(new Function('function* () {}')).constructor;
} catch(e) {}

0 comments on commit f55e997

Please sign in to comment.