Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic Imports: initial cases, templates, non-generated tests and fi…
…xtures
- Loading branch information
Showing
52 changed files
with
1,206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-block-import-catch- | ||
name: nested block | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
{ | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-do-import-catch- | ||
name: nested do | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
let x = 0; | ||
do { | ||
x++; | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} while (!x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-else-import-catch- | ||
name: nested else | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
if (false) { | ||
|
||
} else { | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-function-import-catch- | ||
name: nested function | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
function fn() { | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} | ||
fn(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-if-import-catch- | ||
name: nested if | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
if (true) { | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-labeled-block-import-catch- | ||
name: nested labeled block | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
{ | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-while-import-catch- | ||
name: nested while | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
let x = 0; | ||
while (!x) { | ||
x++; | ||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/top-level-import-catch- | ||
name: top level | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
import(/*{ params }*/).catch(error => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-block-import-then- | ||
name: nested block | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
{ | ||
import(/*{ params }*/).then(imported => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-do-import-then- | ||
name: nested do | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
let x = 0; | ||
do { | ||
x++; | ||
import(/*{ params }*/).then(imported => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} while (!x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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. | ||
/*--- | ||
path: language/module-code/dynamic-import/nested-else-import-then- | ||
name: nested else | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
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]]. | ||
|
||
flags: [module] | ||
features: [dynamic-import] | ||
---*/ | ||
|
||
if (false) { | ||
|
||
} else { | ||
import(/*{ params }*/).then(imported => { | ||
|
||
/*{ body }*/ | ||
|
||
}).then($DONE, $DONE); | ||
} |
Oops, something went wrong.