| 1 |
// |reftest| async |
| 2 |
// Copyright (C) 2018 Leo Balter. All rights reserved. |
| 3 |
// This code is governed by the BSD license found in the LICENSE file. |
| 4 |
/*--- |
| 5 |
description: > |
| 6 |
Dynamic Import receives an AssignmentExpression (CallExpression Arguments) |
| 7 |
esid: prod-ImportCall |
| 8 |
info: | |
| 9 |
ImportCall [Yield]: |
| 10 |
import ( AssignmentExpression[+In, ?Yield] ) |
| 11 |
|
| 12 |
AssignmentExpression[In, Yield, Await]: |
| 13 |
ConditionalExpression[?In, ?Yield, ?Await] |
| 14 |
[+Yield]YieldExpression[?In, ?Await] |
| 15 |
ArrowFunction[?In, ?Yield, ?Await] |
| 16 |
AsyncArrowFunction[?In, ?Yield, ?Await] |
| 17 |
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] |
| 18 |
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] |
| 19 |
|
| 20 |
CallExpression[Yield, Await]: |
| 21 |
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] |
| 22 |
SuperCall[?Yield, ?Await] |
| 23 |
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] |
| 24 |
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] |
| 25 |
CallExpression[?Yield, ?Await].IdentifierName |
| 26 |
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] |
| 27 |
flags: [async] |
| 28 |
features: [dynamic-import] |
| 29 |
includes: [asyncHelpers.js] |
| 30 |
---*/ |
| 31 |
|
| 32 |
const a = () => () => './module-code_FIXTURE.js'; |
| 33 |
const b = () => () => './module-code-other_FIXTURE.js'; |
| 34 |
|
| 35 |
async function fn() { |
| 36 |
const ns1 = await import(a()()); // import('./module-code_FIXTURE.js') |
| 37 |
|
| 38 |
assert.sameValue(ns1.local1, 'Test262'); |
| 39 |
assert.sameValue(ns1.default, 42); |
| 40 |
|
| 41 |
const ns2 = await import(b()()); // import('./module-code-other_FIXTURE.js') |
| 42 |
|
| 43 |
assert.sameValue(ns2.local1, 'one six one two'); |
| 44 |
assert.sameValue(ns2.default, 1612); |
| 45 |
} |
| 46 |
|
| 47 |
asyncTest(fn); |