Add tests for Source Phase Imports (#3980)

This commit is contained in:
Chengzhong Wu 2024-06-27 13:58:04 +01:00 committed by GitHub
parent c3a326ace8
commit 8a2229cde8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
284 changed files with 10329 additions and 26 deletions

View File

@ -107,6 +107,7 @@ properties of the global scope prior to test execution.
- **`sleep`** - a function that takes a millisecond argument and
sleeps the execution for approximately that duration.
- **`monotonicNow`** - a function that returns a value that conforms to [`DOMHighResTimeStamp`][] and is produced in such a way that its semantics conform to **[Monotonic Clock][]**.
- **`AbstractModuleSource`** - a reference to the `%AbstractModuleSource%` constructor which does not appear as a property of the global object.
In addition, consumers may choose to override any of [the functions defined by test harness files](https://github.com/tc39/test262/blob/HEAD/CONTRIBUTING.md#test-environment) as they see fit. See [the documentation on handling errors and negative test cases](https://github.com/tc39/test262/blob/HEAD/CONTRIBUTING.md#handling-errors-and-negative-test-cases) for a useful example of this.
@ -160,6 +161,12 @@ located at `test/language/import/nested/dep.js`.
Files bearing a name ending in `.json` are intended to be interpreted as JSON.
Implementers should resolve the specifier `<module source>` to a module that
provides a valid [Module Source](https://tc39.es/proposal-source-phase-imports/#sec-module-source-objects),
such as a [WebAssembly module](https://webassembly.github.io/esm-integration/js-api/index.html#webassembly-module-record).
Tests use `<module source>` specifier are guarded with a feature flag
`source-phase-imports-module-source`.
### Staging
Tests in the `test/staging/` folder are expected to be executed just like all the other tests, in order to promote interoperability as soon as possible.

View File

@ -121,6 +121,12 @@ explicit-resource-management
# https://github.com/tc39/proposal-float16array
Float16Array
# Source Phase Imports
## https://github.com/tc39/proposal-source-phase-imports
source-phase-imports
## test262 special specifier
source-phase-imports-module-source
## Standard language features
#
# Language features that have been included in a published version of the

View File

@ -0,0 +1,25 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-static-semantics-static-semantics-assignmenttargettype
desc: >
Static Semantics AssignmentTargetType, Return invalid.
info: |
ImportCall
Static Semantics AssignmentTargetType, Return invalid.
template: invalid
flags: [module]
features: [source-phase-imports]
negative:
phase: parse
type: SyntaxError
---*/
//- assignmenttarget
import.source()
//- operator
=
//- value
1

View File

@ -0,0 +1,15 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError on unknown import call
template: syntax/invalid
info: |
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
features: [source-phase-imports]
---*/
//- import
import.UNKNOWN('./empty_FIXTURE.js')
//- teardown
/* The params region intentionally empty */

View File

@ -0,0 +1,16 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if AssignmentExpression is omitted
template: syntax/invalid
info: |
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
features: [source-phase-imports]
---*/
//- import
import.source()
//- teardown
/* The params region intentionally empty */

View File

@ -0,0 +1,12 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Calling import.source('')
template: syntax/valid
features: [source-phase-imports, source-phase-imports-module-source]
---*/
//- import
import.source('<module source>')

View File

@ -0,0 +1,18 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: ImportCall is a CallExpression, it can't be preceded by the new keyword
template: syntax/invalid
info: |
CallExpression:
ImportCall
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
features: [source-phase-imports, source-phase-imports-module-source]
---*/
//- import
new import.source('<module source>')

View File

@ -0,0 +1,22 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: ImportCall is not extensible - no rest parameter
template: syntax/invalid
info: |
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Forbidden Extensions
- ImportCall must not be extended.
This production doesn't allow the following production from ArgumentsList:
... AssignmentExpression
features: [source-phase-imports, source-phase-imports-module-source]
---*/
//- import
import.source(...['<module source>'])

View File

@ -0,0 +1,16 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: import.source() can be used in script code
template: syntax/valid
features: [source-phase-imports, source-phase-imports-module-source]
---*/
//- setup
// This is still valid in script code, and should not be valid for module code
// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames
var smoosh; function smoosh() {}
//- import
import.source('<module source>')

View File

@ -0,0 +1,38 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
GetModuleSource of SourceTextModule always returns an abrupt completion.
esid: sec-moduleevaluation
info: |
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
template: catch
features: [source-phase-imports]
---*/
//- import
import.source('./empty_FIXTURE.js')
//- body
assert.sameValue(error.name, 'ReferenceError');

View File

@ -0,0 +1,42 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Abrupt from ToString(specifier) rejects the promise
esid: sec-moduleevaluation
info: |
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
template: catch
features: [source-phase-imports]
---*/
//- setup
const obj = {
toString() {
throw 'custom error';
}
};
//- import
import.source(obj)
//- body
assert.sameValue(error, 'custom error');

View File

@ -0,0 +1,50 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
ToString value of specifier
esid: sec-moduleevaluation
info: |
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
template: catch
features: [source-phase-imports]
---*/
//- setup
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
//- import
import.source(obj)
//- body
assert.sameValue(error.name, 'ReferenceError');

View File

@ -0,0 +1,15 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError on unexpected import source property
template: syntax/invalid
info: |
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
features: [source-phase-imports]
---*/
//- import
typeof import.source.UNKNOWN
//- teardown
/* The params region intentionally empty */

View File

@ -0,0 +1,14 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if '()' is omitted
template: syntax/invalid
info: |
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
features: [source-phase-imports]
---*/
//- import
typeof import.source
//- teardown
/* The params region intentionally empty */

View File

@ -0,0 +1,13 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if '()' is omitted
template: syntax/invalid
info: |
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
//- import
typeof import
//- teardown
/* The params region intentionally empty */

View File

@ -0,0 +1,21 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-%abstractmodulesource%25-intrinsic-object
description: >
%AbstractModuleSource%.length property descriptor
info: |
28.1.1.1 %AbstractModuleSource% ( )
includes: [propertyHelper.js]
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
verifyProperty($262.AbstractModuleSource, 'length', {
value: 0,
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,24 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-%abstractmodulesource%25-intrinsic-object
description: >
%AbstractModuleSource%.name property descriptor
info: |
The %AbstractModuleSource% intrinsic object has a "name" property whose value is "AbstractModuleSource".
Unless otherwise specified, the name property of a built-in function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
verifyProperty($262.AbstractModuleSource, 'name', {
value: 'AbstractModuleSource',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,19 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-%abstractmodulesource%25-intrinsic-object
description: >
The prototype of %AbstractModuleSource% is Object.prototype
info: |
The value of the [[Prototype]] internal slot of the %AbstractModuleSource% object is the
intrinsic object %FunctionPrototype%.
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
assert.sameValue(
Object.getPrototypeOf($262.AbstractModuleSource),
Function.prototype,
'Object.getPrototypeOf(AbstractModuleSource) returns the value of `Function.prototype`'
);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%abstractmodulesource%25.prototype
description: >
%AbstractModuleSource%.prototype property descriptor
info: |
28.3.2.1 %AbstractModuleSource%.prototype
The initial value of %AbstractModuleSource%.prototype is the %AbstractModuleSource% prototype object.
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
verifyProperty($262.AbstractModuleSource, 'prototype', {
value: $262.AbstractModuleSource.prototype,
writable: false,
enumerable: false,
configurable: false
});

View File

@ -0,0 +1,34 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-%abstractmodulesource%25.prototype.@@tostringtag
description: >
%AbstractModuleSource%.prototype[@@toStringTag] property descriptor
info: |
28.3.3.2 get %AbstractModuleSource%.prototype [ @@toStringTag ]
1. Let O be the this value.
2. If O is not an Object, return undefined.
3. If O does not have a [[ModuleSourceClassName]] internal slot, return undefined.
4. Let name be O.[[ModuleSourceClassName]].
5. Assert: name is a String.
6. Return name.
This property has the attributes { [[Enumerable]]: false, [[Configurable]]: true }.
flags: [module]
features: [source-phase-imports]
includes: [propertyHelper.js]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
verifyProperty($262.AbstractModuleSource.prototype, Symbol.toStringTag, {
enumerable: false,
configurable: false,
writable: false,
});
// Return undefined if this value does not have a [[ModuleSourceClassName]] internal slot.
const ToStringTag = Object.getOwnPropertyDescriptor($262.AbstractModuleSource.prototype, Symbol.toStringTag).get;
assert.sameValue(typeof ToStringTag, 'function');
assert.sameValue(ToStringTag.call(262), undefined);
assert.sameValue(ToStringTag.call($262.AbstractModuleSource.prototype), undefined);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-%abstractmodulesource%25-prototype-object
description: >
%AbstractModuleSource%.prototype.constructor property descriptor
info: |
%AbstractModuleSource%.prototype.constructor
The initial value of %AbstractModuleSource%.prototype.constructor is %AbstractModuleSource%.
includes: [propertyHelper.js]
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
verifyProperty($262.AbstractModuleSource.prototype, 'constructor', {
value: $262.AbstractModuleSource,
writable: true,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,15 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-%abstractmodulesource%25-prototype-object
description: The prototype of %AbstractModuleSource%.prototype is Object.prototype
info: |
The %AbstractModuleSource% prototype object has a [[Prototype]] internal slot whose value is %Object.prototype%.
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
var proto = Object.getPrototypeOf($262.AbstractModuleSource.prototype);
assert.sameValue(proto, Object.prototype);

View File

@ -0,0 +1,18 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%abstractmodulesource%25-constructor
description: The %AbstractModuleSource% constructor will throw an error when invoked
info: |
28.1.1.1 %AbstractModuleSource% ( )
This function performs the following steps when called:
1. Throw a TypeError exception.
features: [source-phase-imports]
flags: [module]
---*/
assert.sameValue(typeof $262.AbstractModuleSource, 'function');
assert.throws(TypeError, function() {
new $262.AbstractModuleSource();
}, '%AbstractModuleSource%() should throw TypeError');

View File

@ -0,0 +1,21 @@
// This file was procedurally generated from the following sources:
// - src/assignment-target-type/importcall-source.case
// - src/assignment-target-type/invalid/direct.template
/*---
description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment)
features: [source-phase-imports]
flags: [generated, module]
negative:
phase: parse
type: SyntaxError
info: |
Direct assignment
ImportCall
Static Semantics AssignmentTargetType, Return invalid.
---*/
$DONOTEVALUATE();
import.source() = 1;

View File

@ -0,0 +1,24 @@
// This file was procedurally generated from the following sources:
// - src/assignment-target-type/importcall-source.case
// - src/assignment-target-type/invalid/parenthesized.template
/*---
description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression)
esid: sec-grouping-operator-static-semantics-assignmenttargettype
features: [source-phase-imports]
flags: [generated, module]
negative:
phase: parse
type: SyntaxError
info: |
ParenthesizedExpression: (Expression)
Return AssignmentTargetType of Expression.
ImportCall
Static Semantics AssignmentTargetType, Return invalid.
---*/
$DONOTEVALUATE();
(import.source()) = 1;

View File

@ -0,0 +1,4 @@
// Copyright (C) 2024 Chengzhong Wu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// empty code

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-arrow.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested arrow)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
let f = () => {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};
f();

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-arrow.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested arrow)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
let f = () => {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};
f();

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-arrow.template
/*---
description: ToString value of specifier (nested arrow)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
let f = () => {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};
f();

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-arrow-fn-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const f = async () => {
await import.source('./empty_FIXTURE.js');
}
f().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-arrow-fn-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
const f = async () => {
await import.source(obj);
}
f().catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-arrow-fn-await.template
/*---
description: ToString value of specifier (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
const f = async () => {
await import.source(obj);
}
f().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const f = async () => await import.source('./empty_FIXTURE.js');
f().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
const f = async () => await import.source(obj);
f().catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template
/*---
description: ToString value of specifier (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
const f = async () => await import.source(obj);
f().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-function-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
async function f() {
await import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
await import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-function-await.template
/*---
description: ToString value of specifier (nested in async function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
async function f() {
await import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,58 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-function.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
async function f() {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,60 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,67 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-function.template
/*---
description: ToString value of specifier (nested in async function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
async function f() {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-function-return-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async function, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
async function f() {
return await import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function-return-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
return await import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-function-return-await.template
/*---
description: ToString value of specifier (nested in async function, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
async function f() {
return await import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-generator-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async generator, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
async function * f() {
await import.source('./empty_FIXTURE.js');
}
f().next().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-generator-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async generator, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function * f() {
await import.source(obj);
}
f().next().catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-generator-await.template
/*---
description: ToString value of specifier (nested in async generator, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
async function * f() {
await import.source(obj);
}
f().next().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-async-generator-return-await.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested in async generator, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
async function * f() {
return await import.source('./empty_FIXTURE.js');
}
f().next().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-generator-return-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async generator, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function * f() {
return await import.source(obj);
}
f().next().catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-async-generator-return-await.template
/*---
description: ToString value of specifier (nested in async generator, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import, async-iteration]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
async function * f() {
return await import.source(obj);
}
f().next().catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-block.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested block)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
{
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-block.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested block)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
{
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-block.template
/*---
description: ToString value of specifier (nested block)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
{
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-block-labeled.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested block syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
label: {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-block-labeled.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested block syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
label: {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-block-labeled.template
/*---
description: ToString value of specifier (nested block syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
label: {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-do-while.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested do while syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
do {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
} while (false);

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-do-while.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested do while syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
do {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
} while (false);

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-do-while.template
/*---
description: ToString value of specifier (nested do while syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
do {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
} while (false);

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-else.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested else)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
if (false) {
} else {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-else.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested else)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
if (false) {
} else {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-else.template
/*---
description: ToString value of specifier (nested else)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
if (false) {
} else {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,56 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-function.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
function f() {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,58 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-function.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
function f() {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,65 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-function.template
/*---
description: ToString value of specifier (nested function)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
function f() {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-if.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested if)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
if (true) {
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-if.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested if)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
if (true) {
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-if.template
/*---
description: ToString value of specifier (nested if)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
if (true) {
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/nested-while.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested while)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
let x = 0;
while (!x) {
x++;
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-while.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested while)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
let x = 0;
while (!x) {
x++;
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/nested-while.template
/*---
description: ToString value of specifier (nested while)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
let x = 0;
while (!x) {
x++;
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-source-text-module.case
// - src/dynamic-import/catch/top-level.template
/*---
description: GetModuleSource of SourceTextModule always returns an abrupt completion. (top level)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
import.source('./empty_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/top-level.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (top level)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
import.source(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,62 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-specifier-tostring.case
// - src/dynamic-import/catch/top-level.template
/*---
description: ToString value of specifier (top level)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import . source ( AssignmentExpression )
1. Return ? EvaluateImportCall(AssignmentExpression, source).
13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
1. Let referrer be GetActiveScriptOrModule().
2. If referrer is null, set referrer to the current Realm Record.
3. Let specifierRef be ? Evaluation of specifierExpression.
4. Let specifier be ? GetValue(specifierRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be Completion(ToString(specifier)).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
10. Return promiseCapability.[[Promise]].
16.2.1.7.2 GetModuleSource ( )
Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
1. Throw a ReferenceError exception.
---*/
// The following case is equivalent of the call of:
// import.source('./empty_FIXTURE.js')
const obj = {
toString() {
return './empty_FIXTURE.js';
}
};
import.source(obj).catch(error => {
assert.sameValue(error.name, 'ReferenceError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-call-unknown.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: It's a SyntaxError on unknown import call (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => import.UNKNOWN('./empty_FIXTURE.js');
/* The params region intentionally empty */

View File

@ -0,0 +1,36 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-assignment-expr-not-optional.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => import.source();
/* The params region intentionally empty */

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-new-call-expression.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
CallExpression:
ImportCall
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => new import.source('<module source>');

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-rest-param.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: ImportCall is not extensible - no rest parameter (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Forbidden Extensions
- ImportCall must not be extended.
This production doesn't allow the following production from ArgumentsList:
... AssignmentExpression
---*/
$DONOTEVALUATE();
let f = () => import.source(...['<module source>']);

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-call-source-property.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: It's a SyntaxError on unexpected import source property (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => typeof import.source.UNKNOWN;
/* The params region intentionally empty */

View File

@ -0,0 +1,36 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-source.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: It's a SyntaxError if '()' is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => typeof import.source;
/* The params region intentionally empty */

View File

@ -0,0 +1,35 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import.case
// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template
/*---
description: It's a SyntaxError if '()' is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => typeof import;
/* The params region intentionally empty */

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-call-unknown.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: It's a SyntaxError on unknown import call (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
import.UNKNOWN('./empty_FIXTURE.js');
};
/* The params region intentionally empty */

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-assignment-expr-not-optional.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
import.source();
};
/* The params region intentionally empty */

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-new-call-expression.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
CallExpression:
ImportCall
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
new import.source('<module source>');
};

View File

@ -0,0 +1,44 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-rest-param.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: ImportCall is not extensible - no rest parameter (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Forbidden Extensions
- ImportCall must not be extended.
This production doesn't allow the following production from ArgumentsList:
... AssignmentExpression
---*/
$DONOTEVALUATE();
let f = () => {
import.source(...['<module source>']);
};

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-call-source-property.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: It's a SyntaxError on unexpected import source property (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
typeof import.source.UNKNOWN;
};
/* The params region intentionally empty */

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-source.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: It's a SyntaxError if '()' is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
typeof import.source;
};
/* The params region intentionally empty */

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import.case
// - src/dynamic-import/syntax/invalid/nested-arrow.template
/*---
description: It's a SyntaxError if '()' is omitted (nested arrow syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
let f = () => {
typeof import;
};
/* The params region intentionally empty */

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-call-unknown.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: It's a SyntaxError on unknown import call (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await import.UNKNOWN('./empty_FIXTURE.js')
});
/* The params region intentionally empty */

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-assignment-expr-not-optional.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: It's a SyntaxError if AssignmentExpression is omitted (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await import.source()
});
/* The params region intentionally empty */

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-new-call-expression.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
CallExpression:
ImportCall
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await new import.source('<module source>')
});

View File

@ -0,0 +1,44 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-rest-param.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: ImportCall is not extensible - no rest parameter (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Forbidden Extensions
- ImportCall must not be extended.
This production doesn't allow the following production from ArgumentsList:
... AssignmentExpression
---*/
$DONOTEVALUATE();
(async () => {
await import.source(...['<module source>'])
});

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-call-source-property.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: It's a SyntaxError on unexpected import source property (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await typeof import.source.UNKNOWN
});
/* The params region intentionally empty */

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-source.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: It's a SyntaxError if '()' is omitted (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await typeof import.source
});
/* The params region intentionally empty */

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template
/*---
description: It's a SyntaxError if '()' is omitted (nested in async arrow function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => {
await typeof import
});
/* The params region intentionally empty */

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-call-unknown.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template
/*---
description: It's a SyntaxError on unknown import call (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => await import.UNKNOWN('./empty_FIXTURE.js'))
/* The params region intentionally empty */

View File

@ -0,0 +1,36 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-assignment-expr-not-optional.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template
/*---
description: It's a SyntaxError if AssignmentExpression is omitted (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => await import.source())
/* The params region intentionally empty */

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-new-call-expression.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template
/*---
description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
CallExpression:
ImportCall
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => await new import.source('<module source>'))

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/import-source-no-rest-param.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template
/*---
description: ImportCall is not extensible - no rest parameter (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, source-phase-imports-module-source, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Forbidden Extensions
- ImportCall must not be extended.
This production doesn't allow the following production from ArgumentsList:
... AssignmentExpression
---*/
$DONOTEVALUATE();
(async () => await import.source(...['<module source>']))

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/typeof-import-call-source-property.case
// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template
/*---
description: It's a SyntaxError on unexpected import source property (nested in async arrow function, returned)
esid: sec-import-call-runtime-semantics-evaluation
features: [source-phase-imports, dynamic-import]
flags: [generated]
negative:
phase: parse
type: SyntaxError
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
ImportCall[Yield, Await] :
import ( AssignmentExpression[+In, ?Yield, ?Await] )
import . source ( AssignmentExpression[+In, ?Yield, ?Await] )
---*/
$DONOTEVALUATE();
(async () => await typeof import.source.UNKNOWN)
/* The params region intentionally empty */

Some files were not shown because too many files have changed in this diff Show More