mirror of
https://github.com/tc39/test262.git
synced 2025-07-16 18:44:38 +02:00
Add tests for Assignment Expressions in Dynamic Imports (#1865)
This commit is contained in:
parent
100b3b4afe
commit
a4d102e020
@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Additive Expression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let x = './module-code';
|
||||||
|
let y = './module-code';
|
||||||
|
|
||||||
|
const a = '_FIXTURE.js';
|
||||||
|
const b = '-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(x + a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(y + b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Array Literal)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import([a]);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
Array.prototype.toString = () => b;
|
||||||
|
const ns2 = await import([]);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (ArrowFunction)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
Function.prototype.toString = () => './module-code_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns = await import(() => {});
|
||||||
|
|
||||||
|
assert.sameValue(ns.local1, 'Test262');
|
||||||
|
assert.sameValue(ns.default, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (AwaitExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(await a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(await b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (IdentifierReference: await)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const await = './module-code_FIXTURE.js';
|
||||||
|
|
||||||
|
const getpromise = () => import(await);
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await getpromise();
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (CallExpression Arguments)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
CallExpression[Yield, Await]:
|
||||||
|
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
||||||
|
SuperCall[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
||||||
|
CallExpression[?Yield, ?Await].IdentifierName
|
||||||
|
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = () => () => './module-code_FIXTURE.js';
|
||||||
|
const b = () => () => './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a()());
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(b()());
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (CallExpression [ Expression ])
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
CallExpression[Yield, Await]:
|
||||||
|
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
||||||
|
SuperCall[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
||||||
|
CallExpression[?Yield, ?Await].IdentifierName
|
||||||
|
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = () => ['./module-code_FIXTURE.js', './module-code-other_FIXTURE.js'];
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a()[0]);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(a()[0, 1]);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (CallExpression . IdentifierName)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
CallExpression[Yield, Await]:
|
||||||
|
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
||||||
|
SuperCall[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
||||||
|
CallExpression[?Yield, ?Await].IdentifierName
|
||||||
|
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = () => ({
|
||||||
|
x: './module-code_FIXTURE.js',
|
||||||
|
y: './module-code-other_FIXTURE.js'
|
||||||
|
});
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a().x);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(a().y);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (CoverCallExpressionAndAsyncArrowHeadn)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
CallExpression[Yield, Await]:
|
||||||
|
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
||||||
|
SuperCall[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
||||||
|
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
||||||
|
CallExpression[?Yield, ?Await].IdentifierName
|
||||||
|
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = () => './module-code_FIXTURE.js';
|
||||||
|
const b = () => './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a());
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(b());
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (CoverParenthesizedExpressionAndArrowParameterList)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
CoverParenthesizedExpressionAndArrowParameterList[Yield, Await]:
|
||||||
|
(Expression[+In, ?Yield, ?Await])
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import((((((('./module-code_FIXTURE.js')))))));
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import((1, 0, './module-code-other_FIXTURE.js'));
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Identifier)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (LHS Expr AssignmentOperator AssignmentExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let x = './module-code';
|
||||||
|
let y = './module-code';
|
||||||
|
|
||||||
|
const a = '_FIXTURE.js';
|
||||||
|
const b = '-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(x += a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(y += b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (LHS Expr = AssignmentExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let x = 'foo';
|
||||||
|
const y = {
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
Object.freeze(y);
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(x = a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(y.z = b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (LogicalANDExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(b && a);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
// mix it in with Unary Expressions
|
||||||
|
const ns2 = await import(delete void typeof +-~! 0 && b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (LogicalORExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(a || b);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(false || b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,41 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Object properties from MemberExpressions)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const obj = {
|
||||||
|
a: './module-code_FIXTURE.js',
|
||||||
|
b: './module-code-other_FIXTURE.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
// MemberExpression [ Expression ]
|
||||||
|
const ns1 = await import(obj['a']);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
// MemberExpression . IdentifierName
|
||||||
|
const ns2 = await import(obj.b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
// exports: default === 1612, local1 === 'one six one two', renamed === 'star', indirect === 'one six one two'
|
||||||
|
|
||||||
|
export var local1 = 'one six one two';
|
||||||
|
var local2 = 'star';
|
||||||
|
export { local2 as renamed };
|
||||||
|
export { local1 as indirect } from './module-code_FIXTURE.js';
|
||||||
|
export default 1612;
|
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262'
|
||||||
|
|
||||||
|
export var local1 = 'Test262';
|
||||||
|
var local2 = 'TC39';
|
||||||
|
export { local2 as renamed };
|
||||||
|
export { local1 as indirect } from './module-code_FIXTURE.js';
|
||||||
|
export default 42;
|
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (NewTarget)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function ctor() {
|
||||||
|
return import(new.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctor.toString = () => './module-code_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns = await new ctor();
|
||||||
|
|
||||||
|
assert.sameValue(ns.local1, 'Test262');
|
||||||
|
assert.sameValue(ns.default, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Object Literal)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import({ toString() { return a; } });
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
Object.prototype.toString = () => b;
|
||||||
|
const ns2 = await import({});
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (MemberExpression TemplateLiteral)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
function tag(arg) {
|
||||||
|
return arg[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
// MemberExpression TemplateLiteral
|
||||||
|
const ns = await import(tag`./module-code-other_FIXTURE.js`);
|
||||||
|
|
||||||
|
assert.sameValue(ns.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (Ternary)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(true ? a : b);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
const ns2 = await import(false ? a : b);
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
32
test/language/module-code/dynamic-import/assign-expr/this.js
Normal file
32
test/language/module-code/dynamic-import/assign-expr/this.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (this)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
PrimaryExpression[Yield, Await]:
|
||||||
|
this
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(this);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.call('./module-code_FIXTURE.js').then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (UnaryExpressions)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const obj = {
|
||||||
|
prop: 42
|
||||||
|
};
|
||||||
|
|
||||||
|
import(delete obj.prop);
|
||||||
|
import(void 0);
|
||||||
|
import(typeof {});
|
||||||
|
import(+void 0);
|
||||||
|
import(-void 0);
|
||||||
|
import(!void 0);
|
||||||
|
import(~void 0);
|
||||||
|
import(delete void typeof +-~! 0);
|
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (yield [no LineTerminator here] AssignmentExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
function *g() {
|
||||||
|
return import(yield 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function *fn() {
|
||||||
|
let iter = g();
|
||||||
|
assert.sameValue(iter.next().value, 42);
|
||||||
|
|
||||||
|
const ns1 = await iter.next(a).value;
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
iter = g();
|
||||||
|
assert.sameValue(iter.next().value, 42);
|
||||||
|
|
||||||
|
const ns2 = await iter.next(b).value;
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().next(a).then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (YieldExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const a = './module-code_FIXTURE.js';
|
||||||
|
const b = './module-code-other_FIXTURE.js';
|
||||||
|
|
||||||
|
function *g() {
|
||||||
|
return import(yield);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function *fn() {
|
||||||
|
let iter = g();
|
||||||
|
iter.next();
|
||||||
|
|
||||||
|
const ns1 = await iter.next(a).value;
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
|
||||||
|
iter = g();
|
||||||
|
iter.next();
|
||||||
|
|
||||||
|
const ns2 = await iter.next(b).value;
|
||||||
|
|
||||||
|
assert.sameValue(ns2.local1, 'one six one two');
|
||||||
|
assert.sameValue(ns2.default, 1612);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().next(a).then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (IdentifierReference: yield)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
flags: [async, noStrict]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const yield = './module-code_FIXTURE.js';
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
const ns1 = await import(yield);
|
||||||
|
|
||||||
|
assert.sameValue(ns1.local1, 'Test262');
|
||||||
|
assert.sameValue(ns1.default, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn().then($DONE, $DONE).catch($DONE);
|
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Dynamic Import receives an AssignmentExpression (yield [no LineTerminator here] AssignmentExpression)
|
||||||
|
esid: prod-ImportCall
|
||||||
|
info: |
|
||||||
|
ImportCall [Yield]:
|
||||||
|
import ( AssignmentExpression[+In, ?Yield] )
|
||||||
|
|
||||||
|
AssignmentExpression[In, Yield, Await]:
|
||||||
|
ConditionalExpression[?In, ?Yield, ?Await]
|
||||||
|
[+Yield]YieldExpression[?In, ?Await]
|
||||||
|
ArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
AsyncArrowFunction[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Asserts valid syntax, return is not asserted for the undefined value of yield *
|
||||||
|
function *g() {
|
||||||
|
import(yield * ['Roberta Flack', 'Donny Hathaway', 'Frank Sinatra']);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user