summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/import.meta
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/import.meta')
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js39
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js9
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js80
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js19
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/same-object-returned.js37
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js35
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js35
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js23
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js23
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js21
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js23
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js19
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js17
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js19
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js32
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js32
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js32
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js33
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js31
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js31
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js32
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js32
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js33
-rw-r--r--js/src/tests/test262/language/expressions/import.meta/syntax/shell.js0
27 files changed, 687 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/import.meta/browser.js b/js/src/tests/test262/language/expressions/import.meta/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/browser.js
diff --git a/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js
new file mode 100644
index 0000000000..6f8745bd07
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js
@@ -0,0 +1,39 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-meta-properties-runtime-semantics-evaluation
+description: >
+ The import.meta object is not shared across modules.
+info: |
+ Runtime Semantics: Evaluation
+
+ ImportMeta : import.meta
+
+ 1. Let module be GetActiveScriptOrModule().
+ ...
+ 3. Let importMeta be module.[[ImportMeta]].
+ 4. If importMeta is undefined.
+ ...
+ f. Set module.[[ImportMeta]] to importMeta.
+ g. Return importMeta.
+ ...
+flags: [module]
+features: [import.meta]
+---*/
+
+import {meta as fixture_meta, getMeta} from "./distinct-for-each-module_FIXTURE.js";
+
+// The imported module has a distinct import.meta object.
+assert.notSameValue(import.meta, fixture_meta,
+ "foreign import.meta accessed via import binding");
+assert.notSameValue(import.meta, getMeta(),
+ "foreign import.meta accessed via function call");
+
+// Calling a function which returns import.meta returns the import.meta object
+// from the module in which the function is declared.
+assert.sameValue(fixture_meta, getMeta(),
+ "import.meta accessed via import binding is identical to the one accessed via call");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js
new file mode 100644
index 0000000000..53b9ea2172
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js
@@ -0,0 +1,9 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var meta = import.meta;
+
+export function getMeta() {
+ return import.meta;
+}
diff --git a/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js b/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js
new file mode 100644
index 0000000000..846cb1c016
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js
@@ -0,0 +1,80 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-meta-properties-runtime-semantics-evaluation
+description: >
+ import.meta is an ordinary object.
+info: |
+ Runtime Semantics: Evaluation
+
+ ImportMeta : import.meta
+
+ ...
+ 4. If importMeta is undefined.
+ a. Set importMeta to ObjectCreate(null).
+ b. Let importMetaValues be ! HostGetImportMetaProperties(module).
+ ...
+ e. Perform ! HostFinalizeImportMeta(importMeta, module).
+ ...
+ g. Return importMeta.
+ ...
+flags: [module]
+features: [import.meta]
+---*/
+
+// import.meta is an object.
+assert.sameValue(typeof import.meta, "object",
+ "typeof import.meta is 'object'");
+assert.notSameValue(import.meta, null,
+ "typeof import.meta is 'object' and import.meta isn't |null|.");
+
+assert.throws(TypeError, function() {
+ import.meta();
+}, "import.meta is not callable");
+
+assert.throws(TypeError, function() {
+ new import.meta();
+}, "import.meta is not a constructor");
+
+// Note: The properties, the shape of the properties, the extensibility state, and the prototype
+// of import.meta are implementation-defined via HostGetImportMetaProperties and
+// HostFinalizeImportMeta.
+
+// Properties and the prototype can only be modified when import.meta is extensible.
+if (Object.isExtensible(import.meta)) {
+ assert.sameValue(Object.getOwnPropertyDescriptor(import.meta, "test262prop"), undefined,
+ "test262 test property is not present initially");
+
+ import.meta.test262prop = "blubb";
+
+ assert.sameValue(import.meta.test262prop, "blubb",
+ "Properties can be added and retrieved from import.meta");
+
+ assert.sameValue(delete import.meta.test262prop, true,
+ "Properties can be removed from import.meta");
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(import.meta, "test262prop"), undefined,
+ "test262 test property is no longer present");
+
+ var proto = {};
+ Object.setPrototypeOf(import.meta, proto);
+
+ assert.sameValue(Object.getPrototypeOf(import.meta), proto,
+ "[[Prototype]] of import.meta can be changed");
+}
+
+Object.preventExtensions(import.meta);
+assert.sameValue(Object.isExtensible(import.meta), false,
+ "import.meta is non-extensible after calling |Object.preventExtensions|");
+
+Object.seal(import.meta);
+assert.sameValue(Object.isSealed(import.meta), true,
+ "import.meta is sealed after calling |Object.seal|");
+
+Object.freeze(import.meta);
+assert.sameValue(Object.isFrozen(import.meta), true,
+ "import.meta is frozen after calling |Object.freeze|");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js b/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js
new file mode 100644
index 0000000000..f97ce5ab96
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ import.meta is not allowed in direct eval in module code.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+flags: [module]
+features: [import.meta]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("import.meta");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js b/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js
new file mode 100644
index 0000000000..07cf9fc674
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js
@@ -0,0 +1,37 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-meta-properties-runtime-semantics-evaluation
+description: >
+ The same import.meta object is returned for a module.
+info: |
+ Runtime Semantics: Evaluation
+
+ ImportMeta : import.meta
+
+ 1. Let module be GetActiveScriptOrModule().
+ ...
+ 3. Let importMeta be module.[[ImportMeta]].
+ 4. If importMeta is undefined.
+ ...
+ f. Set module.[[ImportMeta]] to importMeta.
+ g. Return importMeta.
+ 5. Else,
+ a. Assert: Type(importMeta) is Object.
+ b. Return importMeta.
+flags: [module]
+features: [import.meta]
+---*/
+
+var a = import.meta;
+var b = function() { return import.meta; }();
+
+assert.sameValue(import.meta, a,
+ "import.meta accessed directly and accessed via variable declaration");
+
+assert.sameValue(import.meta, b,
+ "import.meta accessed directly and accessed via function return value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/shell.js b/js/src/tests/test262/language/expressions/import.meta/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/shell.js
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/browser.js b/js/src/tests/test262/language/expressions/import.meta/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/browser.js
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js
new file mode 100644
index 0000000000..cb09314662
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions
+description: >
+ "import" in import.meta must not contain escape sequences.
+info: |
+ 5.1.5 Grammar Notation
+
+ Terminal symbols are shown in fixed width
+ font, both in the productions of the grammars and throughout this specification whenever the
+ text directly refers to such a terminal symbol. These are to appear in a script exactly as
+ written. All terminal symbol code points specified in this way are to be understood as the
+ appropriate Unicode code points from the Basic Latin range, as opposed to any similar-looking
+ code points from other Unicode ranges.
+
+ 12.3 Left-Hand-Side Expressions
+ MetaProperty:
+ NewTarget
+ ImportMeta
+
+ ImportMeta:
+ import.meta
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+im\u0070ort.meta;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js
new file mode 100644
index 0000000000..a8d1113425
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions
+description: >
+ "meta" in import.meta must not contain escape sequences.
+info: |
+ 5.1.5 Grammar Notation
+
+ Terminal symbols are shown in fixed width
+ font, both in the productions of the grammars and throughout this specification whenever the
+ text directly refers to such a terminal symbol. These are to appear in a script exactly as
+ written. All terminal symbol code points specified in this way are to be understood as the
+ appropriate Unicode code points from the Basic Latin range, as opposed to any similar-looking
+ code points from other Unicode ranges.
+
+ 12.3 Left-Hand-Side Expressions
+ MetaProperty:
+ NewTarget
+ ImportMeta
+
+ ImportMeta:
+ import.meta
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+import.m\u0065ta;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js
new file mode 100644
index 0000000000..1826231385
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ An Syntax Error is thrown when the syntactic goal symbol is AsyncFunctionBody or FormalParameters.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+features: [import.meta, async-functions]
+---*/
+
+var AsyncFunction = async function(){}.constructor;
+
+assert.throws(SyntaxError, function() {
+ AsyncFunction("import.meta");
+}, "import.meta in AsyncFunctionBody");
+
+assert.throws(SyntaxError, function() {
+ AsyncFunction("a = import.meta", "");
+}, "import.meta in FormalParameters");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js
new file mode 100644
index 0000000000..72d0f3c906
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ An Syntax Error is thrown when the syntactic goal symbol is AsyncGeneratorBody or FormalParameters.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+features: [import.meta, async-iteration]
+---*/
+
+var AsyncGenerator = async function*(){}.constructor;
+
+assert.throws(SyntaxError, function() {
+ AsyncGenerator("import.meta");
+}, "import.meta in AsyncGeneratorBody");
+
+assert.throws(SyntaxError, function() {
+ AsyncGenerator("a = import.meta", "");
+}, "import.meta in FormalParameters");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js
new file mode 100644
index 0000000000..b4076d355d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ An Syntax Error is thrown when the syntactic goal symbol is FunctionBody or FormalParameters.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+features: [import.meta]
+---*/
+
+assert.throws(SyntaxError, function() {
+ Function("import.meta");
+}, "import.meta in FunctionBody");
+
+assert.throws(SyntaxError, function() {
+ Function("a = import.meta", "");
+}, "import.meta in FormalParameters");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js
new file mode 100644
index 0000000000..4ab91e4595
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ An Syntax Error is thrown when the syntactic goal symbol is GeneratorBody or FormalParameters.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+features: [import.meta, generators]
+---*/
+
+var Generator = function*(){}.constructor;
+
+assert.throws(SyntaxError, function() {
+ Generator("import.meta");
+}, "import.meta in GeneratorBody");
+
+assert.throws(SyntaxError, function() {
+ Generator("a = import.meta", "");
+}, "import.meta in FormalParameters");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js
new file mode 100644
index 0000000000..5a0ff05649
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ No SyntaxError is thrown when import.meta appears in nested functions in module scripts.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+flags: [module]
+features: [import.meta]
+---*/
+
+function f() {
+ import.meta;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js
new file mode 100644
index 0000000000..729b44cebe
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js
@@ -0,0 +1,17 @@
+// |reftest| module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ No early Syntax Error is thrown when the syntactic goal symbol is Module.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+flags: [module]
+features: [import.meta]
+---*/
+
+import.meta;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js
new file mode 100644
index 0000000000..e9527eb9c4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-left-hand-side-expressions-static-semantics-early-errors
+description: >
+ An early Syntax Error is thrown when the syntactic goal symbol is Script.
+info: |
+ It is an early Syntax Error if Module is not the syntactic goal symbol.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+import.meta;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js
new file mode 100644
index 0000000000..d9bfcd5d6b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.15.5.1 Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral
+ and AssignmentTargetType(LeftHandSideExpression) is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta, destructuring-assignment]
+---*/
+
+$DONOTEVALUATE();
+
+[import.meta] = [];
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js
new file mode 100644
index 0000000000..6a271927e3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.15.5.1 Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral
+ and AssignmentTargetType(LeftHandSideExpression) is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta, destructuring-assignment]
+---*/
+
+$DONOTEVALUATE();
+
+[...import.meta] = [];
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js
new file mode 100644
index 0000000000..859420a596
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.15.1 Static Semantics: Early Errors
+
+ AssignmentExpression : LeftHandSideExpression = AssignmentExpression
+
+ It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an
+ ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+import.meta = 0;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js
new file mode 100644
index 0000000000..de0d8b0d25
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 13.7.5.1 Static Semantics: Early Errors
+ IterationStatement:
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta, async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function* f() {
+ for await (import.meta of null) ;
+}
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js
new file mode 100644
index 0000000000..3d1eb1d808
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 13.7.5.1 Static Semantics: Early Errors
+ IterationStatement:
+ for ( LeftHandSideExpression in Expression ) Statement
+
+ It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+for (import.meta in null) ;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js
new file mode 100644
index 0000000000..0ab4e78641
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 13.7.5.1 Static Semantics: Early Errors
+ IterationStatement:
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+for (import.meta of null) ;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js
new file mode 100644
index 0000000000..1144cc9b2f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.15.5.1 Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral
+ and AssignmentTargetType(LeftHandSideExpression) is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta, destructuring-assignment]
+---*/
+
+$DONOTEVALUATE();
+
+({a: import.meta} = {});
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js
new file mode 100644
index 0000000000..d07fa21af6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.15.5.1 Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral
+ and AssignmentTargetType(LeftHandSideExpression) is not simple.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta, destructuring-assignment, object-rest]
+---*/
+
+$DONOTEVALUATE();
+
+({...import.meta} = {});
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js
new file mode 100644
index 0000000000..226bcf80a7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-static-semantics-static-semantics-assignmenttargettype
+description: >
+ import.meta is not a valid assignment target.
+info: |
+ Static Semantics: AssignmentTargetType
+
+ ImportMeta:
+ import.meta
+
+ Return invalid.
+
+ 12.4.1 Static Semantics: Early Errors
+
+ UpdateExpression:
+ LeftHandSideExpression++
+ LeftHandSideExpression--
+
+ It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [import.meta]
+---*/
+
+$DONOTEVALUATE();
+
+import.meta++;
diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/shell.js b/js/src/tests/test262/language/expressions/import.meta/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/import.meta/syntax/shell.js