From e8d923a5f57a00b74c430c0b8db1b2eaea5cab9f Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Wed, 3 Jan 2024 17:25:10 +0800 Subject: [PATCH 1/2] Add tests for Source Phase Imports --- INTERPRETING.md | 7 ++ features.txt | 6 ++ .../importcall-source.case | 25 +++++++ src/dynamic-import/import-call-unknown.case | 15 +++++ ...t-source-assignment-expr-not-optional.case | 16 +++++ ...source-empty-str-is-valid-assign-expr.case | 12 ++++ .../import-source-no-new-call-expression.case | 18 +++++ .../import-source-no-rest-param.case | 22 ++++++ .../import-source-script-code-valid.case | 16 +++++ .../import-source-source-text-module.case | 38 +++++++++++ ...rce-specifier-tostring-abrupt-rejects.case | 42 ++++++++++++ .../import-source-specifier-tostring.case | 50 ++++++++++++++ .../typeof-import-call-source-property.case | 15 +++++ src/dynamic-import/typeof-import-source.case | 14 ++++ src/dynamic-import/typeof-import.case | 13 ++++ test/built-ins/AbstractModuleSource/length.js | 21 ++++++ test/built-ins/AbstractModuleSource/name.js | 24 +++++++ test/built-ins/AbstractModuleSource/proto.js | 19 ++++++ .../AbstractModuleSource/prototype.js | 22 ++++++ .../prototype/Symbol.toStringTag.js | 34 ++++++++++ .../prototype/constructor.js | 23 +++++++ .../AbstractModuleSource/prototype/proto.js | 15 +++++ .../throw-from-constructor.js | 18 +++++ .../direct-importcall-source.js | 21 ++++++ .../parenthesized-importcall-source.js | 24 +++++++ .../dynamic-import/catch/empty_FIXTURE.js | 4 ++ ...-catch-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-await-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-await-import-source-source-text-module.js | 55 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 57 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 64 ++++++++++++++++++ ...-await-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...nction-import-source-source-text-module.js | 58 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 60 +++++++++++++++++ ...nction-import-source-specifier-tostring.js | 67 +++++++++++++++++++ ...-await-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-await-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-await-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-await-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 55 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 57 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 64 ++++++++++++++++++ ...abeled-import-source-source-text-module.js | 55 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 57 ++++++++++++++++ ...abeled-import-source-specifier-tostring.js | 64 ++++++++++++++++++ ...-while-import-source-source-text-module.js | 55 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 57 ++++++++++++++++ ...-while-import-source-specifier-tostring.js | 64 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 56 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 58 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 65 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 55 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 57 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 64 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 57 ++++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 59 ++++++++++++++++ ...-catch-import-source-specifier-tostring.js | 66 ++++++++++++++++++ ...-catch-import-source-source-text-module.js | 53 +++++++++++++++ ...ource-specifier-tostring-abrupt-rejects.js | 55 +++++++++++++++ ...-catch-import-source-specifier-tostring.js | 62 +++++++++++++++++ ...signment-expression-import-call-unknown.js | 37 ++++++++++ ...ort-source-assignment-expr-not-optional.js | 36 ++++++++++ ...on-import-source-no-new-call-expression.js | 37 ++++++++++ ...-expression-import-source-no-rest-param.js | 42 ++++++++++++ ...sion-typeof-import-call-source-property.js | 37 ++++++++++ ...ignment-expression-typeof-import-source.js | 36 ++++++++++ ...row-assignment-expression-typeof-import.js | 35 ++++++++++ .../nested-arrow-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...ow-import-source-no-new-call-expression.js | 39 +++++++++++ ...ested-arrow-import-source-no-rest-param.js | 44 ++++++++++++ ...rrow-typeof-import-call-source-property.js | 39 +++++++++++ .../nested-arrow-typeof-import-source.js | 38 +++++++++++ .../invalid/nested-arrow-typeof-import.js | 37 ++++++++++ ...rrow-function-await-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...it-import-source-no-new-call-expression.js | 39 +++++++++++ ...ction-await-import-source-no-rest-param.js | 44 ++++++++++++ ...wait-typeof-import-call-source-property.js | 39 +++++++++++ ...row-function-await-typeof-import-source.js | 38 +++++++++++ ...sync-arrow-function-await-typeof-import.js | 37 ++++++++++ ...nction-return-await-import-call-unknown.js | 37 ++++++++++ ...ort-source-assignment-expr-not-optional.js | 36 ++++++++++ ...it-import-source-no-new-call-expression.js | 37 ++++++++++ ...eturn-await-import-source-no-rest-param.js | 42 ++++++++++++ ...wait-typeof-import-call-source-property.js | 37 ++++++++++ ...ction-return-await-typeof-import-source.js | 36 ++++++++++ ...row-function-return-await-typeof-import.js | 35 ++++++++++ ...sync-function-await-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...it-import-source-no-new-call-expression.js | 39 +++++++++++ ...ction-await-import-source-no-rest-param.js | 44 ++++++++++++ ...wait-typeof-import-call-source-property.js | 39 +++++++++++ ...ync-function-await-typeof-import-source.js | 38 +++++++++++ ...sted-async-function-await-typeof-import.js | 37 ++++++++++ ...sted-async-function-import-call-unknown.js | 40 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 39 +++++++++++ ...on-import-source-no-new-call-expression.js | 40 +++++++++++ ...nc-function-import-source-no-rest-param.js | 45 +++++++++++++ ...nction-return-await-import-call-unknown.js | 40 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 39 +++++++++++ ...it-import-source-no-new-call-expression.js | 40 +++++++++++ ...eturn-await-import-source-no-rest-param.js | 45 +++++++++++++ ...wait-typeof-import-call-source-property.js | 40 +++++++++++ ...ction-return-await-typeof-import-source.js | 39 +++++++++++ ...ync-function-return-await-typeof-import.js | 38 +++++++++++ ...tion-typeof-import-call-source-property.js | 40 +++++++++++ ...ted-async-function-typeof-import-source.js | 39 +++++++++++ .../nested-async-function-typeof-import.js | 38 +++++++++++ ...ted-async-gen-await-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...it-import-source-no-new-call-expression.js | 39 +++++++++++ ...c-gen-await-import-source-no-rest-param.js | 44 ++++++++++++ ...wait-typeof-import-call-source-property.js | 39 +++++++++++ ...ed-async-gen-await-typeof-import-source.js | 38 +++++++++++ .../nested-async-gen-await-typeof-import.js | 37 ++++++++++ .../nested-block-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...ck-import-source-no-new-call-expression.js | 39 +++++++++++ ...ested-block-import-source-no-rest-param.js | 44 ++++++++++++ ...ested-block-labeled-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...ed-import-source-no-new-call-expression.js | 39 +++++++++++ ...ock-labeled-import-source-no-rest-param.js | 44 ++++++++++++ ...eled-typeof-import-call-source-property.js | 39 +++++++++++ ...sted-block-labeled-typeof-import-source.js | 38 +++++++++++ .../nested-block-labeled-typeof-import.js | 37 ++++++++++ ...lock-typeof-import-call-source-property.js | 39 +++++++++++ .../nested-block-typeof-import-source.js | 38 +++++++++++ .../invalid/nested-block-typeof-import.js | 37 ++++++++++ .../nested-do-while-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...le-import-source-no-new-call-expression.js | 39 +++++++++++ ...ed-do-while-import-source-no-rest-param.js | 44 ++++++++++++ ...hile-typeof-import-call-source-property.js | 39 +++++++++++ .../nested-do-while-typeof-import-source.js | 38 +++++++++++ .../invalid/nested-do-while-typeof-import.js | 37 ++++++++++ ...sted-else-braceless-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...ss-import-source-no-new-call-expression.js | 39 +++++++++++ ...e-braceless-import-source-no-rest-param.js | 44 ++++++++++++ ...less-typeof-import-call-source-property.js | 39 +++++++++++ ...ted-else-braceless-typeof-import-source.js | 38 +++++++++++ .../nested-else-braceless-typeof-import.js | 37 ++++++++++ .../nested-else-import-call-unknown.js | 41 ++++++++++++ ...ort-source-assignment-expr-not-optional.js | 40 +++++++++++ ...se-import-source-no-new-call-expression.js | 41 ++++++++++++ ...nested-else-import-source-no-rest-param.js | 46 +++++++++++++ ...else-typeof-import-call-source-property.js | 41 ++++++++++++ .../nested-else-typeof-import-source.js | 40 +++++++++++ .../invalid/nested-else-typeof-import.js | 39 +++++++++++ .../nested-function-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...on-import-source-no-new-call-expression.js | 39 +++++++++++ ...ed-function-import-source-no-rest-param.js | 44 ++++++++++++ ...ted-function-return-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...rn-import-source-no-new-call-expression.js | 39 +++++++++++ ...tion-return-import-source-no-rest-param.js | 44 ++++++++++++ ...turn-typeof-import-call-source-property.js | 39 +++++++++++ ...ed-function-return-typeof-import-source.js | 38 +++++++++++ .../nested-function-return-typeof-import.js | 37 ++++++++++ ...tion-typeof-import-call-source-property.js | 39 +++++++++++ .../nested-function-typeof-import-source.js | 38 +++++++++++ .../invalid/nested-function-typeof-import.js | 37 ++++++++++ ...nested-if-braceless-import-call-unknown.js | 37 ++++++++++ ...ort-source-assignment-expr-not-optional.js | 36 ++++++++++ ...ss-import-source-no-new-call-expression.js | 37 ++++++++++ ...f-braceless-import-source-no-rest-param.js | 42 ++++++++++++ ...less-typeof-import-call-source-property.js | 37 ++++++++++ ...ested-if-braceless-typeof-import-source.js | 36 ++++++++++ .../nested-if-braceless-typeof-import.js | 35 ++++++++++ .../invalid/nested-if-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...if-import-source-no-new-call-expression.js | 39 +++++++++++ .../nested-if-import-source-no-rest-param.js | 44 ++++++++++++ ...d-if-typeof-import-call-source-property.js | 39 +++++++++++ .../invalid/nested-if-typeof-import-source.js | 38 +++++++++++ .../syntax/invalid/nested-if-typeof-import.js | 37 ++++++++++ .../nested-while-import-call-unknown.js | 41 ++++++++++++ ...ort-source-assignment-expr-not-optional.js | 40 +++++++++++ ...le-import-source-no-new-call-expression.js | 41 ++++++++++++ ...ested-while-import-source-no-rest-param.js | 46 +++++++++++++ ...hile-typeof-import-call-source-property.js | 41 ++++++++++++ .../nested-while-typeof-import-source.js | 40 +++++++++++ .../invalid/nested-while-typeof-import.js | 39 +++++++++++ ...ted-with-expression-import-call-unknown.js | 37 ++++++++++ ...ort-source-assignment-expr-not-optional.js | 36 ++++++++++ ...on-import-source-no-new-call-expression.js | 37 ++++++++++ ...-expression-import-source-no-rest-param.js | 42 ++++++++++++ ...sion-typeof-import-call-source-property.js | 37 ++++++++++ ...ed-with-expression-typeof-import-source.js | 36 ++++++++++ .../nested-with-expression-typeof-import.js | 35 ++++++++++ .../nested-with-import-call-unknown.js | 39 +++++++++++ ...ort-source-assignment-expr-not-optional.js | 38 +++++++++++ ...th-import-source-no-new-call-expression.js | 39 +++++++++++ ...nested-with-import-source-no-rest-param.js | 44 ++++++++++++ ...with-typeof-import-call-source-property.js | 39 +++++++++++ .../nested-with-typeof-import-source.js | 38 +++++++++++ .../invalid/nested-with-typeof-import.js | 37 ++++++++++ .../invalid/top-level-import-call-unknown.js | 27 ++++++++ ...ort-source-assignment-expr-not-optional.js | 26 +++++++ ...el-import-source-no-new-call-expression.js | 27 ++++++++ .../top-level-import-source-no-rest-param.js | 32 +++++++++ ...evel-typeof-import-call-source-property.js | 27 ++++++++ .../invalid/top-level-typeof-import-source.js | 26 +++++++ .../syntax/invalid/top-level-typeof-import.js | 25 +++++++ ...t-source-empty-str-is-valid-assign-expr.js | 25 +++++++ ...ression-import-source-script-code-valid.js | 29 ++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...d-arrow-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...n-await-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 25 +++++++ ...n-await-import-source-script-code-valid.js | 29 ++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...n-await-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 28 ++++++++ ...unction-import-source-script-code-valid.js | 32 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 28 ++++++++ ...n-await-import-source-script-code-valid.js | 32 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...n-await-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...d-block-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...labeled-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...o-while-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...aceless-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 29 ++++++++ ...ed-else-import-source-script-code-valid.js | 33 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...unction-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...-return-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 25 +++++++ ...aceless-import-source-script-code-valid.js | 29 ++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...sted-if-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 29 ++++++++ ...d-while-import-source-script-code-valid.js | 33 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 28 ++++++++ ...ression-import-source-script-code-valid.js | 32 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 27 ++++++++ ...ed-with-import-source-script-code-valid.js | 31 +++++++++ ...t-source-empty-str-is-valid-assign-expr.js | 15 +++++ ...p-level-import-source-script-code-valid.js | 19 ++++++ .../import-assertion-key-identifiername.js | 2 +- .../import-assertion-key-string-double.js | 2 +- .../import-assertion-key-string-single.js | 2 +- .../import-assertion-many.js | 2 +- .../import-assertion-newlines.js | 2 +- .../import-assertion-trlng-comma.js | 2 +- .../import-assertion-value-string-double.js | 2 +- .../import-assertion-value-string-single.js | 2 +- .../allow-nlt-before-with.js | 2 +- .../ensure-linking-error_FIXTURE.js | 9 --- .../import-attribute-key-identifiername.js | 2 +- .../import-attribute-key-string-double.js | 2 +- .../import-attribute-key-string-single.js | 2 +- .../import-attribute-many.js | 2 +- .../import-attribute-newlines.js | 2 +- .../import-attribute-trlng-comma.js | 2 +- .../import-attribute-value-string-double.js | 2 +- .../import-attribute-value-string-single.js | 2 +- .../ensure-linking-error_FIXTURE.js | 0 .../import-source-binding-name.js | 25 +++++++ .../import-source-newlines.js | 31 +++++++++ 284 files changed, 10329 insertions(+), 26 deletions(-) create mode 100644 src/assignment-target-type/importcall-source.case create mode 100644 src/dynamic-import/import-call-unknown.case create mode 100644 src/dynamic-import/import-source-assignment-expr-not-optional.case create mode 100644 src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case create mode 100644 src/dynamic-import/import-source-no-new-call-expression.case create mode 100644 src/dynamic-import/import-source-no-rest-param.case create mode 100644 src/dynamic-import/import-source-script-code-valid.case create mode 100644 src/dynamic-import/import-source-source-text-module.case create mode 100644 src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case create mode 100644 src/dynamic-import/import-source-specifier-tostring.case create mode 100644 src/dynamic-import/typeof-import-call-source-property.case create mode 100644 src/dynamic-import/typeof-import-source.case create mode 100644 src/dynamic-import/typeof-import.case create mode 100644 test/built-ins/AbstractModuleSource/length.js create mode 100644 test/built-ins/AbstractModuleSource/name.js create mode 100644 test/built-ins/AbstractModuleSource/proto.js create mode 100644 test/built-ins/AbstractModuleSource/prototype.js create mode 100644 test/built-ins/AbstractModuleSource/prototype/Symbol.toStringTag.js create mode 100644 test/built-ins/AbstractModuleSource/prototype/constructor.js create mode 100644 test/built-ins/AbstractModuleSource/prototype/proto.js create mode 100644 test/built-ins/AbstractModuleSource/throw-from-constructor.js create mode 100644 test/language/expressions/assignmenttargettype/direct-importcall-source.js create mode 100644 test/language/expressions/assignmenttargettype/parenthesized-importcall-source.js create mode 100644 test/language/expressions/dynamic-import/catch/empty_FIXTURE.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-do-while-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-source-text-module.js create mode 100644 test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring-abrupt-rejects.js create mode 100644 test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-import-call-unknown.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-assignment-expr-not-optional.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-new-call-expression.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-rest-param.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-call-source-property.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-source.js create mode 100644 test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-script-code-valid.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-empty-str-is-valid-assign-expr.js create mode 100644 test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-script-code-valid.js delete mode 100644 test/language/module-code/import-attributes/ensure-linking-error_FIXTURE.js rename test/language/module-code/{import-assertions => resources}/ensure-linking-error_FIXTURE.js (100%) create mode 100644 test/language/module-code/source-phase-import/import-source-binding-name.js create mode 100644 test/language/module-code/source-phase-import/import-source-newlines.js diff --git a/INTERPRETING.md b/INTERPRETING.md index 8cb36452a41..c1d65f31477 100644 --- a/INTERPRETING.md +++ b/INTERPRETING.md @@ -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 `` 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 `` specifier should be 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. diff --git a/features.txt b/features.txt index 6599e733279..4934929d05f 100644 --- a/features.txt +++ b/features.txt @@ -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 diff --git a/src/assignment-target-type/importcall-source.case b/src/assignment-target-type/importcall-source.case new file mode 100644 index 00000000000..52c4718979f --- /dev/null +++ b/src/assignment-target-type/importcall-source.case @@ -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 diff --git a/src/dynamic-import/import-call-unknown.case b/src/dynamic-import/import-call-unknown.case new file mode 100644 index 00000000000..f463843ad1d --- /dev/null +++ b/src/dynamic-import/import-call-unknown.case @@ -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 */ diff --git a/src/dynamic-import/import-source-assignment-expr-not-optional.case b/src/dynamic-import/import-source-assignment-expr-not-optional.case new file mode 100644 index 00000000000..2ceba8325d7 --- /dev/null +++ b/src/dynamic-import/import-source-assignment-expr-not-optional.case @@ -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 */ diff --git a/src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case b/src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case new file mode 100644 index 00000000000..e9dd6eda36f --- /dev/null +++ b/src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case @@ -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('') diff --git a/src/dynamic-import/import-source-no-new-call-expression.case b/src/dynamic-import/import-source-no-new-call-expression.case new file mode 100644 index 00000000000..8bca3c65df7 --- /dev/null +++ b/src/dynamic-import/import-source-no-new-call-expression.case @@ -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('') diff --git a/src/dynamic-import/import-source-no-rest-param.case b/src/dynamic-import/import-source-no-rest-param.case new file mode 100644 index 00000000000..c3420d21a37 --- /dev/null +++ b/src/dynamic-import/import-source-no-rest-param.case @@ -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(...['']) diff --git a/src/dynamic-import/import-source-script-code-valid.case b/src/dynamic-import/import-source-script-code-valid.case new file mode 100644 index 00000000000..8e13ce2cf68 --- /dev/null +++ b/src/dynamic-import/import-source-script-code-valid.case @@ -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('') diff --git a/src/dynamic-import/import-source-source-text-module.case b/src/dynamic-import/import-source-source-text-module.case new file mode 100644 index 00000000000..c095051c81c --- /dev/null +++ b/src/dynamic-import/import-source-source-text-module.case @@ -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'); diff --git a/src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case b/src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case new file mode 100644 index 00000000000..631646d6ada --- /dev/null +++ b/src/dynamic-import/import-source-specifier-tostring-abrupt-rejects.case @@ -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'); diff --git a/src/dynamic-import/import-source-specifier-tostring.case b/src/dynamic-import/import-source-specifier-tostring.case new file mode 100644 index 00000000000..ee9f23510bb --- /dev/null +++ b/src/dynamic-import/import-source-specifier-tostring.case @@ -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'); diff --git a/src/dynamic-import/typeof-import-call-source-property.case b/src/dynamic-import/typeof-import-call-source-property.case new file mode 100644 index 00000000000..57b39282a13 --- /dev/null +++ b/src/dynamic-import/typeof-import-call-source-property.case @@ -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 */ diff --git a/src/dynamic-import/typeof-import-source.case b/src/dynamic-import/typeof-import-source.case new file mode 100644 index 00000000000..72c6f525119 --- /dev/null +++ b/src/dynamic-import/typeof-import-source.case @@ -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 */ diff --git a/src/dynamic-import/typeof-import.case b/src/dynamic-import/typeof-import.case new file mode 100644 index 00000000000..1a3ef26e005 --- /dev/null +++ b/src/dynamic-import/typeof-import.case @@ -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 */ diff --git a/test/built-ins/AbstractModuleSource/length.js b/test/built-ins/AbstractModuleSource/length.js new file mode 100644 index 00000000000..56a49017ee5 --- /dev/null +++ b/test/built-ins/AbstractModuleSource/length.js @@ -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 +}); diff --git a/test/built-ins/AbstractModuleSource/name.js b/test/built-ins/AbstractModuleSource/name.js new file mode 100644 index 00000000000..7df92e30e65 --- /dev/null +++ b/test/built-ins/AbstractModuleSource/name.js @@ -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 +}); diff --git a/test/built-ins/AbstractModuleSource/proto.js b/test/built-ins/AbstractModuleSource/proto.js new file mode 100644 index 00000000000..24ef1b6adb5 --- /dev/null +++ b/test/built-ins/AbstractModuleSource/proto.js @@ -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`' +); diff --git a/test/built-ins/AbstractModuleSource/prototype.js b/test/built-ins/AbstractModuleSource/prototype.js new file mode 100644 index 00000000000..4257d962185 --- /dev/null +++ b/test/built-ins/AbstractModuleSource/prototype.js @@ -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 +}); diff --git a/test/built-ins/AbstractModuleSource/prototype/Symbol.toStringTag.js b/test/built-ins/AbstractModuleSource/prototype/Symbol.toStringTag.js new file mode 100644 index 00000000000..2fd23ca70bf --- /dev/null +++ b/test/built-ins/AbstractModuleSource/prototype/Symbol.toStringTag.js @@ -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); diff --git a/test/built-ins/AbstractModuleSource/prototype/constructor.js b/test/built-ins/AbstractModuleSource/prototype/constructor.js new file mode 100644 index 00000000000..88b94130b3a --- /dev/null +++ b/test/built-ins/AbstractModuleSource/prototype/constructor.js @@ -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 +}); diff --git a/test/built-ins/AbstractModuleSource/prototype/proto.js b/test/built-ins/AbstractModuleSource/prototype/proto.js new file mode 100644 index 00000000000..ad5594a267b --- /dev/null +++ b/test/built-ins/AbstractModuleSource/prototype/proto.js @@ -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); diff --git a/test/built-ins/AbstractModuleSource/throw-from-constructor.js b/test/built-ins/AbstractModuleSource/throw-from-constructor.js new file mode 100644 index 00000000000..dda8b2789e2 --- /dev/null +++ b/test/built-ins/AbstractModuleSource/throw-from-constructor.js @@ -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'); diff --git a/test/language/expressions/assignmenttargettype/direct-importcall-source.js b/test/language/expressions/assignmenttargettype/direct-importcall-source.js new file mode 100644 index 00000000000..1158123b013 --- /dev/null +++ b/test/language/expressions/assignmenttargettype/direct-importcall-source.js @@ -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; diff --git a/test/language/expressions/assignmenttargettype/parenthesized-importcall-source.js b/test/language/expressions/assignmenttargettype/parenthesized-importcall-source.js new file mode 100644 index 00000000000..46fdeeec635 --- /dev/null +++ b/test/language/expressions/assignmenttargettype/parenthesized-importcall-source.js @@ -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; diff --git a/test/language/expressions/dynamic-import/catch/empty_FIXTURE.js b/test/language/expressions/dynamic-import/catch/empty_FIXTURE.js new file mode 100644 index 00000000000..c55ec206e74 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/empty_FIXTURE.js @@ -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 diff --git a/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..a1bc35872d6 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-source-text-module.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..9d084a299f6 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..d7f2d7a92ea --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-arrow-import-catch-import-source-specifier-tostring.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-source-text-module.js new file mode 100644 index 00000000000..888349b405e --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..399175f6200 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..be3fa4c1edd --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-source-text-module.js new file mode 100644 index 00000000000..0ab1239e5c5 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..eb334d7ee4d --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..318ce701379 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-source-text-module.js new file mode 100644 index 00000000000..2763bbae7db --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-source-text-module.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..adeb79f257d --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..fb14fb661ec --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-await-import-source-specifier-tostring.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-source-text-module.js new file mode 100644 index 00000000000..78460b35949 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-source-text-module.js @@ -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(); + diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..721716f8bd3 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring-abrupt-rejects.js @@ -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(); + diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring.js new file mode 100644 index 00000000000..a0e98387111 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-import-source-specifier-tostring.js @@ -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(); + diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-source-text-module.js new file mode 100644 index 00000000000..bee973034df --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-source-text-module.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..abed3311387 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..96256180f71 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-function-return-await-import-source-specifier-tostring.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-source-text-module.js new file mode 100644 index 00000000000..043fddfa366 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..836ae2f0eec --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..3ce755aef04 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-await-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-source-text-module.js new file mode 100644 index 00000000000..2288aacb4fb --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..cf407d09047 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring.js new file mode 100644 index 00000000000..cbac8793a4b --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..d482cd39359 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-source-text-module.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..75ea76874b5 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..fc5b7a69211 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-import-catch-import-source-specifier-tostring.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-source-text-module.js new file mode 100644 index 00000000000..0708790c9d4 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-source-text-module.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..1c76039bd32 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring-abrupt-rejects.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring.js new file mode 100644 index 00000000000..294af99722d --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-block-labeled-import-source-specifier-tostring.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-source-text-module.js new file mode 100644 index 00000000000..e6adfdfcd8d --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..8b31e6d418a --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring.js new file mode 100644 index 00000000000..0690a317f0a --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-do-while-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..2afab9e6f5e --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-source-text-module.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..1ae4bee14b0 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..b3d08022818 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-else-import-catch-import-source-specifier-tostring.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..9117f41c5ca --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-source-text-module.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..6f86a18923b --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..72f2a077569 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-function-import-catch-import-source-specifier-tostring.js @@ -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(); diff --git a/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..793ff344ea7 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-source-text-module.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..eb309c8790a --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..7808d69806f --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-if-import-catch-import-source-specifier-tostring.js @@ -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); +} diff --git a/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..e2ec2077111 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-source-text-module.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..d90cca4e715 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..2886633ea96 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/nested-while-import-catch-import-source-specifier-tostring.js @@ -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); +}; diff --git a/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-source-text-module.js b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-source-text-module.js new file mode 100644 index 00000000000..9ba2397f2ca --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-source-text-module.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring-abrupt-rejects.js b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring-abrupt-rejects.js new file mode 100644 index 00000000000..a0ff8401be5 --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring-abrupt-rejects.js @@ -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); diff --git a/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring.js b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring.js new file mode 100644 index 00000000000..c08ec3d442f --- /dev/null +++ b/test/language/expressions/dynamic-import/catch/top-level-import-catch-import-source-specifier-tostring.js @@ -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); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-call-unknown.js new file mode 100644 index 00000000000..493f6f99215 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-call-unknown.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..09770d739de --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-assignment-expr-not-optional.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..158123f759e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-new-call-expression.js @@ -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(''); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-rest-param.js new file mode 100644 index 00000000000..9cf643bdb08 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-import-source-no-rest-param.js @@ -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(...['']); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-call-source-property.js new file mode 100644 index 00000000000..7e98e745f3c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-call-source-property.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-source.js new file mode 100644 index 00000000000..21f059b8c41 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import-source.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import.js new file mode 100644 index 00000000000..95bcfc9f0d1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-typeof-import.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-call-unknown.js new file mode 100644 index 00000000000..77c5f157d36 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-call-unknown.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..b0163501242 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-assignment-expr-not-optional.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..00acabd06d1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-new-call-expression.js @@ -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(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-rest-param.js new file mode 100644 index 00000000000..219371053d7 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-import-source-no-rest-param.js @@ -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(...['']); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-call-source-property.js new file mode 100644 index 00000000000..490f2fd01c2 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-call-source-property.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-source.js new file mode 100644 index 00000000000..352767b9fa3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import-source.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import.js new file mode 100644 index 00000000000..ecfa6d79985 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-arrow-typeof-import.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-call-unknown.js new file mode 100644 index 00000000000..9fd621a4cb5 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-call-unknown.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..0fae5d70144 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-assignment-expr-not-optional.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..48df357bf2e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-new-call-expression.js @@ -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('') +}); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-rest-param.js new file mode 100644 index 00000000000..0f86c2d235e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-import-source-no-rest-param.js @@ -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(...['']) +}); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-call-source-property.js new file mode 100644 index 00000000000..cf3171f3036 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-call-source-property.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-source.js new file mode 100644 index 00000000000..3ee214c4202 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import-source.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import.js new file mode 100644 index 00000000000..9c392653240 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-typeof-import.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-call-unknown.js new file mode 100644 index 00000000000..55688748332 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-call-unknown.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..8dd26862295 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-assignment-expr-not-optional.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..1da8cb0b4ca --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-new-call-expression.js @@ -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('')) diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-rest-param.js new file mode 100644 index 00000000000..eb3a8ebe0f3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-import-source-no-rest-param.js @@ -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(...[''])) diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-call-source-property.js new file mode 100644 index 00000000000..5d8443b0cd9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-call-source-property.js @@ -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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-source.js new file mode 100644 index 00000000000..edd72de3b0f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import-source.js @@ -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-async-arrow-fn-return-await.template +/*--- +description: It's a SyntaxError if '()' 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 typeof import.source) + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import.js new file mode 100644 index 00000000000..40fa2c7a1c8 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-typeof-import.js @@ -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-async-arrow-fn-return-await.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested in async arrow function, returned) +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 */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-call-unknown.js new file mode 100644 index 00000000000..956703b7853 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-call-unknown.js @@ -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-function-await.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(); + +async function f() { + await import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..fff41d3d033 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-assignment-expr-not-optional.js @@ -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-function-await.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(); + +async function f() { + await import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..c9559953cce --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-new-call-expression.js @@ -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-function-await.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(); + +async function f() { + await new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-rest-param.js new file mode 100644 index 00000000000..4c4fec5eef5 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-import-source-no-rest-param.js @@ -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-function-await.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(); + +async function f() { + await import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-call-source-property.js new file mode 100644 index 00000000000..0e7cf1b4c0b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-call-source-property.js @@ -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-function-await.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(); + +async function f() { + await typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-source.js new file mode 100644 index 00000000000..40a9082fd2d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import-source.js @@ -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-function-await.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(); + +async function f() { + await typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import.js new file mode 100644 index 00000000000..5d0bdcb4520 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-typeof-import.js @@ -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-function-await.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(); + +async function f() { + await typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-call-unknown.js new file mode 100644 index 00000000000..2aaaca31951 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-call-unknown.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-call-unknown.case +// - src/dynamic-import/syntax/invalid/nested-async-function.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(); + +async function f() { + import.UNKNOWN('./empty_FIXTURE.js'); +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..64d2f370238 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// 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-function.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(); + +async function f() { + import.source(); +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..e1d1c50d607 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-new-call-expression.js @@ -0,0 +1,40 @@ +// 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-function.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(); + +async function f() { + new import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-rest-param.js new file mode 100644 index 00000000000..03ba4b05c22 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-import-source-no-rest-param.js @@ -0,0 +1,45 @@ +// 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-function.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(); + +async function f() { + import.source(...['']); +} + diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-call-unknown.js new file mode 100644 index 00000000000..9feca84eac6 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-call-unknown.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-call-unknown.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.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(); + +async function f() { + return await import.UNKNOWN('./empty_FIXTURE.js'); +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..39f1147168f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// 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-function-return-await.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(); + +async function f() { + return await import.source(); +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..365d574e922 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-new-call-expression.js @@ -0,0 +1,40 @@ +// 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-function-return-await.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(); + +async function f() { + return await new import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-rest-param.js new file mode 100644 index 00000000000..8062d6cfeea --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-import-source-no-rest-param.js @@ -0,0 +1,45 @@ +// 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-function-return-await.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(); + +async function f() { + return await import.source(...['']); +} + diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-call-source-property.js new file mode 100644 index 00000000000..325a7a0e3f6 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-call-source-property.js @@ -0,0 +1,40 @@ +// 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-function-return-await.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(); + +async function f() { + return await typeof import.source.UNKNOWN; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-source.js new file mode 100644 index 00000000000..5ef24b07aac --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import-source.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-source.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.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(); + +async function f() { + return await typeof import.source; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import.js new file mode 100644 index 00000000000..63b017062e1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-typeof-import.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.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(); + +async function f() { + return await typeof import; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-call-source-property.js new file mode 100644 index 00000000000..7622a3d31bc --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-call-source-property.js @@ -0,0 +1,40 @@ +// 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-function.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(); + +async function f() { + typeof import.source.UNKNOWN; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-source.js new file mode 100644 index 00000000000..164a07542b2 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import-source.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-source.case +// - src/dynamic-import/syntax/invalid/nested-async-function.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(); + +async function f() { + typeof import.source; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import.js new file mode 100644 index 00000000000..ee5767d8d2d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-function-typeof-import.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import.case +// - src/dynamic-import/syntax/invalid/nested-async-function.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(); + +async function f() { + typeof import; +} + + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-call-unknown.js new file mode 100644 index 00000000000..992b41237a1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-call-unknown.js @@ -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-generator-await.template +/*--- +description: It's a SyntaxError on unknown import call (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import, async-iteration] +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 function * f() { + await import.UNKNOWN('./empty_FIXTURE.js') +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..51f65e84e79 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-assignment-expr-not-optional.js @@ -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-generator-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import, async-iteration] +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 function * f() { + await import.source() +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..8c914d3f2fd --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-new-call-expression.js @@ -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-generator-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import, async-iteration] +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 function * f() { + await new import.source('') +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-rest-param.js new file mode 100644 index 00000000000..ec9dca267d4 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-import-source-no-rest-param.js @@ -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-generator-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import, async-iteration] +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 function * f() { + await import.source(...['']) +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-call-source-property.js new file mode 100644 index 00000000000..91a0b5a43f9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-call-source-property.js @@ -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-generator-await.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import, async-iteration] +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 function * f() { + await typeof import.source.UNKNOWN +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-source.js new file mode 100644 index 00000000000..fd1afe433d1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import-source.js @@ -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-generator-await.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import, async-iteration] +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 function * f() { + await typeof import.source +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import.js new file mode 100644 index 00000000000..cef4a33e13c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-typeof-import.js @@ -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-generator-await.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +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 function * f() { + await typeof import +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-call-unknown.js new file mode 100644 index 00000000000..b6e9c715b62 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-call-unknown.js @@ -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-block.template +/*--- +description: It's a SyntaxError on unknown import call (nested block 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(); + +{ + import.UNKNOWN('./empty_FIXTURE.js'); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..0818be7c148 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-assignment-expr-not-optional.js @@ -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-block.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block 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(); + +{ + import.source(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..5ef3dcf4cfb --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-new-call-expression.js @@ -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-block.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested block 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(); + +{ + new import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-rest-param.js new file mode 100644 index 00000000000..92b4f340dee --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-import-source-no-rest-param.js @@ -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-block.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested block 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(); + +{ + import.source(...['']); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-call-unknown.js new file mode 100644 index 00000000000..67160207acf --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-call-unknown.js @@ -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-block-labeled.template +/*--- +description: It's a SyntaxError on unknown import call (nested block 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(); + +label: { + import.UNKNOWN('./empty_FIXTURE.js'); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..9a10a50ef12 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-assignment-expr-not-optional.js @@ -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-block-labeled.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block 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(); + +label: { + import.source(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..f37ece233d9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-new-call-expression.js @@ -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-block-labeled.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested block 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(); + +label: { + new import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-rest-param.js new file mode 100644 index 00000000000..1c805d9ce04 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-import-source-no-rest-param.js @@ -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-block-labeled.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested block 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(); + +label: { + import.source(...['']); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-call-source-property.js new file mode 100644 index 00000000000..2b81b84911f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-call-source-property.js @@ -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-block-labeled.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested block 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(); + +label: { + typeof import.source.UNKNOWN; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-source.js new file mode 100644 index 00000000000..fabe1d0dc60 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import-source.js @@ -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-block-labeled.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested block 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(); + +label: { + typeof import.source; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import.js new file mode 100644 index 00000000000..b8b9ea59731 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-typeof-import.js @@ -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-block-labeled.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested block 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(); + +label: { + typeof import; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-call-source-property.js new file mode 100644 index 00000000000..aeb16967bce --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-call-source-property.js @@ -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-block.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested block 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(); + +{ + typeof import.source.UNKNOWN; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-source.js new file mode 100644 index 00000000000..f58edf59b47 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import-source.js @@ -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-block.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested block 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(); + +{ + typeof import.source; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import.js new file mode 100644 index 00000000000..e2d57395ac3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-block-typeof-import.js @@ -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-block.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested block 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(); + +{ + typeof import; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-call-unknown.js new file mode 100644 index 00000000000..c1c2bcb0ec2 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-call-unknown.js @@ -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-do-while.template +/*--- +description: It's a SyntaxError on unknown import call (nested do while 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(); + +do { + import.UNKNOWN('./empty_FIXTURE.js'); +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..a996c6d22e0 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-assignment-expr-not-optional.js @@ -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-do-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested do while 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(); + +do { + import.source(); +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..abc42277f2a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-new-call-expression.js @@ -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-do-while.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested do while 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(); + +do { + new import.source(''); +} while (false); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-rest-param.js new file mode 100644 index 00000000000..d46f1fb029e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-import-source-no-rest-param.js @@ -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-do-while.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested do while 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(); + +do { + import.source(...['']); +} while (false); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-call-source-property.js new file mode 100644 index 00000000000..c9c0bb1cab2 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-call-source-property.js @@ -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-do-while.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested do while 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(); + +do { + typeof import.source.UNKNOWN; +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-source.js new file mode 100644 index 00000000000..c7191d547d0 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import-source.js @@ -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-do-while.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested do while 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(); + +do { + typeof import.source; +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import.js new file mode 100644 index 00000000000..a420c7289f9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-do-while-typeof-import.js @@ -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-do-while.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested do while 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(); + +do { + typeof import; +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-call-unknown.js new file mode 100644 index 00000000000..12f9382c86f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-call-unknown.js @@ -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-else-braceless.template +/*--- +description: It's a SyntaxError on unknown import call (nested else 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(); + +if (false) { + +} else import.UNKNOWN('./empty_FIXTURE.js'); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..253a9e2ae4c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-assignment-expr-not-optional.js @@ -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-else-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else 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(); + +if (false) { + +} else import.source(); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..a8040c17cac --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-new-call-expression.js @@ -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-else-braceless.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested else 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(); + +if (false) { + +} else new import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-rest-param.js new file mode 100644 index 00000000000..3ad21f1df9c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-import-source-no-rest-param.js @@ -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-else-braceless.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested else 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(); + +if (false) { + +} else import.source(...['']); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-call-source-property.js new file mode 100644 index 00000000000..2bb301914f6 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-call-source-property.js @@ -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-else-braceless.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested else 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(); + +if (false) { + +} else typeof import.source.UNKNOWN; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-source.js new file mode 100644 index 00000000000..9721f577d1d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import-source.js @@ -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-else-braceless.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested else 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(); + +if (false) { + +} else typeof import.source; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import.js new file mode 100644 index 00000000000..01cf40982dc --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-typeof-import.js @@ -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-else-braceless.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested else 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(); + +if (false) { + +} else typeof import; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-call-unknown.js new file mode 100644 index 00000000000..3e138c71695 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-call-unknown.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-call-unknown.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError on unknown import call (nested else 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(); + +if (false) { + +} else { + import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..2c830d29570 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-assignment-expr-not-optional.js @@ -0,0 +1,40 @@ +// 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-else.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else 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(); + +if (false) { + +} else { + import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..2ed5b4fc273 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-new-call-expression.js @@ -0,0 +1,41 @@ +// 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-else.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested else 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(); + +if (false) { + +} else { + new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-rest-param.js new file mode 100644 index 00000000000..1385a433bf9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-import-source-no-rest-param.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested else 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(); + +if (false) { + +} else { + import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-call-source-property.js new file mode 100644 index 00000000000..f97643aec6f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-call-source-property.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-call-source-property.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested else 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(); + +if (false) { + +} else { + typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-source.js new file mode 100644 index 00000000000..d15f8d4d57a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import-source.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-source.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested else 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(); + +if (false) { + +} else { + typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import.js new file mode 100644 index 00000000000..7a4bbf43c33 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-else-typeof-import.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested else 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(); + +if (false) { + +} else { + typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-call-unknown.js new file mode 100644 index 00000000000..2ac05f2f58e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-call-unknown.js @@ -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-function.template +/*--- +description: It's a SyntaxError on unknown import call (nested function 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(); + +function fn() { + import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..609e2a5033a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-assignment-expr-not-optional.js @@ -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-function.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function 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(); + +function fn() { + import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..139202b780b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-new-call-expression.js @@ -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-function.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested function 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(); + +function fn() { + new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-rest-param.js new file mode 100644 index 00000000000..4706106e973 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-import-source-no-rest-param.js @@ -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-function.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested function 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(); + +function fn() { + import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-call-unknown.js new file mode 100644 index 00000000000..d4959ae01fe --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-call-unknown.js @@ -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-function-return.template +/*--- +description: It's a SyntaxError on unknown import call (nested function 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(); + +function fn() { + return import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..7733eee820e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-assignment-expr-not-optional.js @@ -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-function-return.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function 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(); + +function fn() { + return import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..dde0539d1c3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-new-call-expression.js @@ -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-function-return.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested function 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(); + +function fn() { + return new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-rest-param.js new file mode 100644 index 00000000000..68ad8dc4453 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-import-source-no-rest-param.js @@ -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-function-return.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested function 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(); + +function fn() { + return import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-call-source-property.js new file mode 100644 index 00000000000..4ffe12ff62f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-call-source-property.js @@ -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-function-return.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested function 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(); + +function fn() { + return typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-source.js new file mode 100644 index 00000000000..d42993b521a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import-source.js @@ -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-function-return.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested function 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(); + +function fn() { + return typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import.js new file mode 100644 index 00000000000..0c2cdfb4f48 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-return-typeof-import.js @@ -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-function-return.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested function 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(); + +function fn() { + return typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-call-source-property.js new file mode 100644 index 00000000000..f8220b068b0 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-call-source-property.js @@ -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-function.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested function 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(); + +function fn() { + typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-source.js new file mode 100644 index 00000000000..7bfc7deb38d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import-source.js @@ -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-function.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested function 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(); + +function fn() { + typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import.js new file mode 100644 index 00000000000..f4433133551 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-function-typeof-import.js @@ -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-function.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested function 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(); + +function fn() { + typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-call-unknown.js new file mode 100644 index 00000000000..97178b7fdc6 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-call-unknown.js @@ -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-if-braceless.template +/*--- +description: It's a SyntaxError on unknown import call (nested if 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(); + +if (true) import.UNKNOWN('./empty_FIXTURE.js'); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..a63345e8f5f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-assignment-expr-not-optional.js @@ -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-if-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if 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(); + +if (true) import.source(); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..e046e227459 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-new-call-expression.js @@ -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-if-braceless.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested if 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(); + +if (true) new import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-rest-param.js new file mode 100644 index 00000000000..a7e63408ddd --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-import-source-no-rest-param.js @@ -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-if-braceless.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested if 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(); + +if (true) import.source(...['']); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-call-source-property.js new file mode 100644 index 00000000000..8d4fb9765b8 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-call-source-property.js @@ -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-if-braceless.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested if 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(); + +if (true) typeof import.source.UNKNOWN; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-source.js new file mode 100644 index 00000000000..ff592967a80 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import-source.js @@ -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-if-braceless.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested if 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(); + +if (true) typeof import.source; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import.js new file mode 100644 index 00000000000..39e54b73399 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-typeof-import.js @@ -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-if-braceless.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested if 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(); + +if (true) typeof import; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-call-unknown.js new file mode 100644 index 00000000000..8ca718c4da7 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-call-unknown.js @@ -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-if.template +/*--- +description: It's a SyntaxError on unknown import call (nested if 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(); + +if (true) { + import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..17d1a2551a4 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-assignment-expr-not-optional.js @@ -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-if.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if 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(); + +if (true) { + import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..314cd647e49 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-new-call-expression.js @@ -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-if.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested if 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(); + +if (true) { + new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-rest-param.js new file mode 100644 index 00000000000..4fdb605f559 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-import-source-no-rest-param.js @@ -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-if.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested if 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(); + +if (true) { + import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-call-source-property.js new file mode 100644 index 00000000000..dcc50a2a276 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-call-source-property.js @@ -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-if.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested if 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(); + +if (true) { + typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-source.js new file mode 100644 index 00000000000..93fedf42173 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import-source.js @@ -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-if.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested if 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(); + +if (true) { + typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import.js new file mode 100644 index 00000000000..282f1a6d5ae --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-if-typeof-import.js @@ -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-if.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested if 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(); + +if (true) { + typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-call-unknown.js new file mode 100644 index 00000000000..81b003d3e14 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-call-unknown.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-call-unknown.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError on unknown import call (nested while 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 x = 0; +while (!x) { + x++; + import.UNKNOWN('./empty_FIXTURE.js'); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..1e2cd1818da --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-assignment-expr-not-optional.js @@ -0,0 +1,40 @@ +// 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-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested while 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 x = 0; +while (!x) { + x++; + import.source(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..b11c3b96bbc --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-new-call-expression.js @@ -0,0 +1,41 @@ +// 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-while.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested while 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 x = 0; +while (!x) { + x++; + new import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-rest-param.js new file mode 100644 index 00000000000..069e097cf5d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-import-source-no-rest-param.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested while 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 x = 0; +while (!x) { + x++; + import.source(...['']); +}; diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-call-source-property.js new file mode 100644 index 00000000000..8b400c79fa3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-call-source-property.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-call-source-property.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested while 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 x = 0; +while (!x) { + x++; + typeof import.source.UNKNOWN; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-source.js new file mode 100644 index 00000000000..7f0555bc5f5 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import-source.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-source.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested while 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 x = 0; +while (!x) { + x++; + typeof import.source; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import.js new file mode 100644 index 00000000000..2a5195cc9ad --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-while-typeof-import.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested while 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 x = 0; +while (!x) { + x++; + typeof import; +}; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-call-unknown.js new file mode 100644 index 00000000000..7da4426730c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-call-unknown.js @@ -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-with-expression.template +/*--- +description: It's a SyntaxError on unknown import call (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with (import.UNKNOWN('./empty_FIXTURE.js')) {} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..dde615dce5b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-assignment-expr-not-optional.js @@ -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-with-expression.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with (import.source()) {} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..6f3a200734a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-new-call-expression.js @@ -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-with-expression.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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(); + +with (new import.source('')) {} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-rest-param.js new file mode 100644 index 00000000000..cf4a63b9545 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-import-source-no-rest-param.js @@ -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-with-expression.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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(); + +with (import.source(...[''])) {} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-call-source-property.js new file mode 100644 index 00000000000..afa433abb7e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-call-source-property.js @@ -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-with-expression.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with (typeof import.source.UNKNOWN) {} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-source.js new file mode 100644 index 00000000000..4c0cac89e8b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import-source.js @@ -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-with-expression.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with (typeof import.source) {} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import.js new file mode 100644 index 00000000000..984de4d9698 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-typeof-import.js @@ -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-with-expression.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +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(); + +with (typeof import) {} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-call-unknown.js new file mode 100644 index 00000000000..c4d58005ca3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-call-unknown.js @@ -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-with.template +/*--- +description: It's a SyntaxError on unknown import call (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + import.UNKNOWN('./empty_FIXTURE.js'); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..501815b25ec --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-assignment-expr-not-optional.js @@ -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-with.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + import.source(); +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..6c5c2aded4b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-new-call-expression.js @@ -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-with.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + new import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-rest-param.js new file mode 100644 index 00000000000..50f0b5c3357 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-import-source-no-rest-param.js @@ -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-with.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + import.source(...['']); +} diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-call-source-property.js new file mode 100644 index 00000000000..f4a8bbf2310 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-call-source-property.js @@ -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-with.template +/*--- +description: It's a SyntaxError on unexpected import source property (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + typeof import.source.UNKNOWN; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-source.js new file mode 100644 index 00000000000..dce995136dc --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import-source.js @@ -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-with.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + typeof import.source; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import.js new file mode 100644 index 00000000000..c33fd3fdf6d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/nested-with-typeof-import.js @@ -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-with.template +/*--- +description: It's a SyntaxError if '()' is omitted (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +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(); + +with ({}) { + typeof import; +} + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-call-unknown.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-call-unknown.js new file mode 100644 index 00000000000..c01c1468e42 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-call-unknown.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-call-unknown.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError on unknown import call (top level 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 ) + + + ImportCall[Yield, Await] : + import ( AssignmentExpression[+In, ?Yield, ?Await] ) + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) + +---*/ + +$DONOTEVALUATE(); + +import.UNKNOWN('./empty_FIXTURE.js'); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-assignment-expr-not-optional.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-assignment-expr-not-optional.js new file mode 100644 index 00000000000..c4cb9a6ab56 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-assignment-expr-not-optional.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (top level 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 ) + + + ImportCall[Yield, Await] : + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) + +---*/ + +$DONOTEVALUATE(); + +import.source(); + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-new-call-expression.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-new-call-expression.js new file mode 100644 index 00000000000..3edffbfdef3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-new-call-expression.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (top level 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 ) + + + CallExpression: + ImportCall + + ImportCall : + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) + +---*/ + +$DONOTEVALUATE(); + +new import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-rest-param.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-rest-param.js new file mode 100644 index 00000000000..6a6d26bf510 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-import-source-no-rest-param.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-no-rest-param.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is not extensible - no rest parameter (top level 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 ) + + + 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(); + +import.source(...['']); diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-call-source-property.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-call-source-property.js new file mode 100644 index 00000000000..041c0f48d46 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-call-source-property.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-call-source-property.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError on unexpected import source property (top level 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 ) + + + ImportCall[Yield, Await] : + import ( AssignmentExpression[+In, ?Yield, ?Await] ) + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) + +---*/ + +$DONOTEVALUATE(); + +typeof import.source.UNKNOWN; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-source.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-source.js new file mode 100644 index 00000000000..d19d99f7038 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import-source.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import-source.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError if '()' is omitted (top level 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 ) + + + ImportCall[Yield, Await] : + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) + +---*/ + +$DONOTEVALUATE(); + +typeof import.source; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import.js b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import.js new file mode 100644 index 00000000000..1d7305ecdd8 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/invalid/top-level-typeof-import.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/typeof-import.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError if '()' is omitted (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall[Yield, Await] : + import . source ( AssignmentExpression[+In, ?Yield, ?Await] ) +---*/ + +$DONOTEVALUATE(); + +typeof import; + +/* The params region intentionally empty */ diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..c0686fe8774 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: Calling import.source('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +let f = () => import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-script-code-valid.js new file mode 100644 index 00000000000..75a8501f2b8 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-source-script-code-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: import.source() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +let f = () => import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..c478b1c9c6e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: Calling import.source('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +let f = () => { + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-script-code-valid.js new file mode 100644 index 00000000000..c329305cae5 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: import.source() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +let f = () => { + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..67e13fed98b --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: Calling import.source('') (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +(async () => { + await import.source('') +}); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-script-code-valid.js new file mode 100644 index 00000000000..4445d6c2b3c --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: import.source() can be used in script code (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +(async () => { + await import.source('') +}); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..91ed64b25f2 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: Calling import.source('') (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] +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]]. + +---*/ + +(async () => await import.source('')); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-script-code-valid.js new file mode 100644 index 00000000000..c185062f66d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-source-script-code-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: import.source() can be used in script code (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] +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]]. + +---*/ +// 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() {} + + +(async () => await import.source('')); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..044e6788548 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: Calling import.source('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + await import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-script-code-valid.js new file mode 100644 index 00000000000..3c9d8734778 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: import.source() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +async function f() { + await import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..8b3055c9674 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: Calling import.source('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-script-code-valid.js new file mode 100644 index 00000000000..b9b5c69553a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-source-script-code-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: import.source() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +async function f() { + import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..47e12e19627 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: Calling import.source('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + return await import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-script-code-valid.js new file mode 100644 index 00000000000..9f28db36b11 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-source-script-code-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: import.source() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +async function f() { + return await import.source(''); +} + diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..249c37d160e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: Calling import.source('') (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import, async-iteration] +flags: [generated] +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]]. + +---*/ + +async function * f() { + await import.source('') +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-script-code-valid.js new file mode 100644 index 00000000000..78b8fbefb58 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: import.source() can be used in script code (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import, async-iteration] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +async function * f() { + await import.source('') +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..1018731e264 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: Calling import.source('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-script-code-valid.js new file mode 100644 index 00000000000..79632a7ed21 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-block-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: import.source() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..190c0766a17 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: Calling import.source('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +label: { + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-script-code-valid.js new file mode 100644 index 00000000000..5e1d0269a34 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: import.source() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +label: { + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..29e32191e31 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: Calling import.source('') (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +do { + import.source(''); +} while (false); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-script-code-valid.js new file mode 100644 index 00000000000..da121faa04a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: import.source() can be used in script code (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +do { + import.source(''); +} while (false); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..4f02b1f404a --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: Calling import.source('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (false) { + +} else import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-script-code-valid.js new file mode 100644 index 00000000000..9f05da6668d --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: import.source() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +if (false) { + +} else import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..e2322d23b62 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: Calling import.source('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (false) { + +} else { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-script-code-valid.js new file mode 100644 index 00000000000..005c69a4c6e --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-else-import-source-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: import.source() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +if (false) { + +} else { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..bf0f2d75543 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: Calling import.source('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +function fn() { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-script-code-valid.js new file mode 100644 index 00000000000..b332ec33784 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-function-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: import.source() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +function fn() { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..69fa3095184 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: Calling import.source('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +function fn() { + return import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-script-code-valid.js new file mode 100644 index 00000000000..ceb90e37aa9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: import.source() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +function fn() { + return import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..d2e59a710af --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: Calling import.source('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (true) import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-script-code-valid.js new file mode 100644 index 00000000000..237f0e083b3 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-source-script-code-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: import.source() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +if (true) import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..41d9b0666a9 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: Calling import.source('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (true) { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-script-code-valid.js new file mode 100644 index 00000000000..2727c875ddd --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-if-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: import.source() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +if (true) { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..001448f9dcb --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: Calling import.source('') (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-script-code-valid.js new file mode 100644 index 00000000000..8615665deb4 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-while-import-source-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: import.source() can be used in script code (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +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]]. + +---*/ +// 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() {} + + +let x = 0; +while (!x) { + x++; + import.source(''); +}; diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..9c01518aaa1 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: Calling import.source('') (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ + +with (import.source('')) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-script-code-valid.js new file mode 100644 index 00000000000..c5af0b0a240 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-source-script-code-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: import.source() can be used in script code (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ +// 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() {} + + +with (import.source('')) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..5aef2d75e53 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: Calling import.source('') (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ + +with ({}) { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-script-code-valid.js new file mode 100644 index 00000000000..d1c7e48ddae --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/nested-with-import-source-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: import.source() can be used in script code (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ +// 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() {} + + +with ({}) { + import.source(''); +} diff --git a/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-empty-str-is-valid-assign-expr.js b/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-empty-str-is-valid-assign-expr.js new file mode 100644 index 00000000000..ae078c3870f --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-empty-str-is-valid-assign-expr.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: Calling import.source('') (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ + +import.source(''); diff --git a/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-script-code-valid.js b/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-script-code-valid.js new file mode 100644 index 00000000000..ac75e48db61 --- /dev/null +++ b/test/language/expressions/dynamic-import/syntax/valid/top-level-import-source-script-code-valid.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-source-script-code-valid.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: import.source() can be used in script code (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [source-phase-imports, source-phase-imports-module-source, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ +// 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.source(''); diff --git a/test/language/module-code/import-assertions/import-assertion-key-identifiername.js b/test/language/module-code/import-assertions/import-assertion-key-identifiername.js index 605b49f7399..43cdf8b1e20 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-identifiername.js +++ b/test/language/module-code/import-assertions/import-assertion-key-identifiername.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {if:''}; import './import-assertion-2_FIXTURE.js' assert {if:''}; diff --git a/test/language/module-code/import-assertions/import-assertion-key-string-double.js b/test/language/module-code/import-assertions/import-assertion-key-string-double.js index 0a6491686a2..2aaf7c47763 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-string-double.js +++ b/test/language/module-code/import-assertions/import-assertion-key-string-double.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''}; import './import-assertion-2_FIXTURE.js' assert {"test262\u0078":''}; diff --git a/test/language/module-code/import-assertions/import-assertion-key-string-single.js b/test/language/module-code/import-assertions/import-assertion-key-string-single.js index edccfeb08e2..d4cb0abb7ab 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-string-single.js +++ b/test/language/module-code/import-assertions/import-assertion-key-string-single.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''}; import './import-assertion-2_FIXTURE.js' assert {'test262\u0078':''}; diff --git a/test/language/module-code/import-assertions/import-assertion-many.js b/test/language/module-code/import-assertions/import-assertion-many.js index fccf8be5c22..b970515c4f8 100644 --- a/test/language/module-code/import-assertions/import-assertion-many.js +++ b/test/language/module-code/import-assertions/import-assertion-many.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; import './import-assertion-2_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; diff --git a/test/language/module-code/import-assertions/import-assertion-newlines.js b/test/language/module-code/import-assertions/import-assertion-newlines.js index 10cfba52a4a..b7896d9adf2 100644 --- a/test/language/module-code/import-assertions/import-assertion-newlines.js +++ b/test/language/module-code/import-assertions/import-assertion-newlines.js @@ -31,7 +31,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert diff --git a/test/language/module-code/import-assertions/import-assertion-trlng-comma.js b/test/language/module-code/import-assertions/import-assertion-trlng-comma.js index 323c61fac4f..89d0733df7c 100644 --- a/test/language/module-code/import-assertions/import-assertion-trlng-comma.js +++ b/test/language/module-code/import-assertions/import-assertion-trlng-comma.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {test262:'',}; import './import-assertion-2_FIXTURE.js' assert {test262:'',}; diff --git a/test/language/module-code/import-assertions/import-assertion-value-string-double.js b/test/language/module-code/import-assertions/import-assertion-value-string-double.js index fc24b2e269d..0ce091ae307 100644 --- a/test/language/module-code/import-assertions/import-assertion-value-string-double.js +++ b/test/language/module-code/import-assertions/import-assertion-value-string-double.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"}; import './import-assertion-2_FIXTURE.js' assert {test262:"\u0078"}; diff --git a/test/language/module-code/import-assertions/import-assertion-value-string-single.js b/test/language/module-code/import-assertions/import-assertion-value-string-single.js index 0e0ef844bfa..c12e13c9ac4 100644 --- a/test/language/module-code/import-assertions/import-assertion-value-string-single.js +++ b/test/language/module-code/import-assertions/import-assertion-value-string-single.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'}; import './import-assertion-2_FIXTURE.js' assert {test262:'\u0078'}; diff --git a/test/language/module-code/import-attributes/allow-nlt-before-with.js b/test/language/module-code/import-attributes/allow-nlt-before-with.js index 73131843af9..057118a5df8 100644 --- a/test/language/module-code/import-attributes/allow-nlt-before-with.js +++ b/test/language/module-code/import-attributes/allow-nlt-before-with.js @@ -26,7 +26,7 @@ flags: [module, raw] throw "Test262: This statement should not be evaluated."; -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import * as x from './import-attribute-1_FIXTURE.js' with diff --git a/test/language/module-code/import-attributes/ensure-linking-error_FIXTURE.js b/test/language/module-code/import-attributes/ensure-linking-error_FIXTURE.js deleted file mode 100644 index e1eebf9cf28..00000000000 --- a/test/language/module-code/import-attributes/ensure-linking-error_FIXTURE.js +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -// When imported, this file will ensure that a linking error happens by -// importing a non-existent binding. -// It can be used to assert that there is a linking error, which means -// that there are no parsing errors. - -import { nonExistent } from "./ensure-linking-error_FIXTURE.js"; diff --git a/test/language/module-code/import-attributes/import-attribute-key-identifiername.js b/test/language/module-code/import-attributes/import-attribute-key-identifiername.js index 28d10211cf2..15d1fd1eb26 100644 --- a/test/language/module-code/import-attributes/import-attribute-key-identifiername.js +++ b/test/language/module-code/import-attributes/import-attribute-key-identifiername.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {if:''}; import './import-attribute-2_FIXTURE.js' with {if:''}; diff --git a/test/language/module-code/import-attributes/import-attribute-key-string-double.js b/test/language/module-code/import-attributes/import-attribute-key-string-double.js index 61827406968..06751b5f3ff 100644 --- a/test/language/module-code/import-attributes/import-attribute-key-string-double.js +++ b/test/language/module-code/import-attributes/import-attribute-key-string-double.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {"test262\u0078":''}; import './import-attribute-2_FIXTURE.js' with {"test262\u0078":''}; diff --git a/test/language/module-code/import-attributes/import-attribute-key-string-single.js b/test/language/module-code/import-attributes/import-attribute-key-string-single.js index 1d5869d77f2..32c7a9b94c1 100644 --- a/test/language/module-code/import-attributes/import-attribute-key-string-single.js +++ b/test/language/module-code/import-attributes/import-attribute-key-string-single.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {'test262\u0078':''}; import './import-attribute-2_FIXTURE.js' with {'test262\u0078':''}; diff --git a/test/language/module-code/import-attributes/import-attribute-many.js b/test/language/module-code/import-attributes/import-attribute-many.js index cfd42baf087..3044e17c3b9 100644 --- a/test/language/module-code/import-attributes/import-attribute-many.js +++ b/test/language/module-code/import-attributes/import-attribute-many.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; import './import-attribute-2_FIXTURE.js' with {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; diff --git a/test/language/module-code/import-attributes/import-attribute-newlines.js b/test/language/module-code/import-attributes/import-attribute-newlines.js index a6bfdfb1caf..f996f250b93 100644 --- a/test/language/module-code/import-attributes/import-attribute-newlines.js +++ b/test/language/module-code/import-attributes/import-attribute-newlines.js @@ -31,7 +31,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with diff --git a/test/language/module-code/import-attributes/import-attribute-trlng-comma.js b/test/language/module-code/import-attributes/import-attribute-trlng-comma.js index 62088605609..66d6d036d8f 100644 --- a/test/language/module-code/import-attributes/import-attribute-trlng-comma.js +++ b/test/language/module-code/import-attributes/import-attribute-trlng-comma.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {test262:'',}; import './import-attribute-2_FIXTURE.js' with {test262:'',}; diff --git a/test/language/module-code/import-attributes/import-attribute-value-string-double.js b/test/language/module-code/import-attributes/import-attribute-value-string-double.js index 5fcd3b2ef22..6da9627c38a 100644 --- a/test/language/module-code/import-attributes/import-attribute-value-string-double.js +++ b/test/language/module-code/import-attributes/import-attribute-value-string-double.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {test262:"\u0078"}; import './import-attribute-2_FIXTURE.js' with {test262:"\u0078"}; diff --git a/test/language/module-code/import-attributes/import-attribute-value-string-single.js b/test/language/module-code/import-attributes/import-attribute-value-string-single.js index c3c1b115de0..c2f431278d4 100644 --- a/test/language/module-code/import-attributes/import-attribute-value-string-single.js +++ b/test/language/module-code/import-attributes/import-attribute-value-string-single.js @@ -28,7 +28,7 @@ flags: [module] $DONOTEVALUATE(); -import "./ensure-linking-error_FIXTURE.js"; +import "../resources/ensure-linking-error_FIXTURE.js"; import x from './import-attribute-1_FIXTURE.js' with {test262:'\u0078'}; import './import-attribute-2_FIXTURE.js' with {test262:'\u0078'}; diff --git a/test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js b/test/language/module-code/resources/ensure-linking-error_FIXTURE.js similarity index 100% rename from test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js rename to test/language/module-code/resources/ensure-linking-error_FIXTURE.js diff --git a/test/language/module-code/source-phase-import/import-source-binding-name.js b/test/language/module-code/source-phase-import/import-source-binding-name.js new file mode 100644 index 00000000000..c08903a1e3a --- /dev/null +++ b/test/language/module-code/source-phase-import/import-source-binding-name.js @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Chengzhong Wu. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportBinding in ImportDeclaration may be 'source' and 'from' +esid: sec-modules +info: | + ImportDeclaration: + import source ImportedBinding FromClause ; + +negative: + phase: resolution + type: SyntaxError +features: [source-phase-imports] +flags: [module] +---*/ + +$DONOTEVALUATE(); + +import "../resources/ensure-linking-error_FIXTURE.js"; + +import source source from ''; +import source from from ''; +import source from ''; +import from from ''; diff --git a/test/language/module-code/source-phase-import/import-source-newlines.js b/test/language/module-code/source-phase-import/import-source-newlines.js new file mode 100644 index 00000000000..a5aa505186f --- /dev/null +++ b/test/language/module-code/source-phase-import/import-source-newlines.js @@ -0,0 +1,31 @@ +// Copyright (C) 2024 Chengzhong Wu. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + import source in ImportDeclaration may include line terminators +esid: sec-modules +info: | + ImportDeclaration: + import source ImportedBinding FromClause ; + + This test uses all four LineFeed characters in order to completely verify the + grammar. + + 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. +negative: + phase: resolution + type: SyntaxError +features: [source-phase-imports] +flags: [module] +---*/ + +$DONOTEVALUATE(); + +import "../resources/ensure-linking-error_FIXTURE.js"; + +import + +

source + +

y from ''; From f42555afa69b8445cb16d824409bd10879424b88 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Wed, 19 Jun 2024 14:57:46 +0100 Subject: [PATCH 2/2] fixup! --- INTERPRETING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INTERPRETING.md b/INTERPRETING.md index c1d65f31477..da75456dc67 100644 --- a/INTERPRETING.md +++ b/INTERPRETING.md @@ -164,7 +164,7 @@ Files bearing a name ending in `.json` are intended to be interpreted as JSON. Implementers should resolve the specifier `` 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 `` specifier should be guarded with a feature flag +Tests use `` specifier are guarded with a feature flag `source-phase-imports-module-source`. ### Staging