summaryrefslogtreecommitdiff
path: root/js/src/tests/test262/language/expressions/assignment
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/assignment')
-rw-r--r--js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js57
-rw-r--r--js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js60
-rw-r--r--js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js57
-rw-r--r--js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js60
-rw-r--r--js/src/tests/test262/language/expressions/assignment/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/assignment/shell.js0
6 files changed, 234 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..8bdeca68e9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,57 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/assignment-expr.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (AssignmentExpression)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var x = {};
+
+0, [x?.y = 42] = [23];
diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..57d80fa31d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/assignment-expr.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (AssignmentExpression)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+0, [{
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42] = [23];
diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..b186432078
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,57 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/assignment-expr.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (AssignmentExpression)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var y = {};
+
+0, { x: y?.z = 42 } = { x: 23 };
diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..d0b80f742e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/assignment-expr.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (AssignmentExpression)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+0, { x: {
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42} = {x: 42};
diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/shell.js b/js/src/tests/test262/language/expressions/assignment/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/dstr/shell.js
diff --git a/js/src/tests/test262/language/expressions/assignment/shell.js b/js/src/tests/test262/language/expressions/assignment/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/shell.js