diff --git a/test/language/expressions/logical-assignment/lgcl-and-arguments-strict.js b/test/language/expressions/logical-assignment/lgcl-and-arguments-strict.js new file mode 100644 index 00000000000..c23e4a88f92 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-and-arguments-strict.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(&&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments &&= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-and-eval-strict.js b/test/language/expressions/logical-assignment/lgcl-and-eval-strict.js new file mode 100644 index 00000000000..345ea960e1a --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-and-eval-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(&&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval &&= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-and-non-simple.js b/test/language/expressions/logical-assignment/lgcl-and-non-simple.js new file mode 100644 index 00000000000..977ace323ac --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-and-non-simple.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "&&=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 &&= 1; diff --git a/test/language/expressions/logical-assignment/lgcl-and-whitespace.js b/test/language/expressions/logical-assignment/lgcl-and-whitespace.js new file mode 100644 index 00000000000..35b81571356 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-and-whitespace.js @@ -0,0 +1,58 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]&&=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+0009 (expression)'); +assert.sameValue(x, 2, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+000C (expression)'); +assert.sameValue(x, 2, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+0020 (expression)'); +assert.sameValue(x, 2, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+00A0 (expression)'); +assert.sameValue(x, 2, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +&&= +2, 2, 'U+000A (expression)'); +assert.sameValue(x, 2, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x +&&= +2, 2, 'U+000D (expression)'); +assert.sameValue(x, 2, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
&&=
2, 2, 'U+2028 (expression)'); +assert.sameValue(x, 2, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
&&=
2, 2, 'U+2029 (expression)'); +assert.sameValue(x, 2, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   +

&&=   +

2, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); diff --git a/test/language/expressions/logical-assignment/lgcl-nullish-arguments-strict.js b/test/language/expressions/logical-assignment/lgcl-nullish-arguments-strict.js new file mode 100644 index 00000000000..499f9ea045e --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-nullish-arguments-strict.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(??=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments ??= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-nullish-eval-strict.js b/test/language/expressions/logical-assignment/lgcl-nullish-eval-strict.js new file mode 100644 index 00000000000..70cd3c9bca5 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-nullish-eval-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(??=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval ??= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-nullish-non-simple.js b/test/language/expressions/logical-assignment/lgcl-nullish-non-simple.js new file mode 100644 index 00000000000..fe312171665 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-nullish-non-simple.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "??=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 ??= 1; diff --git a/test/language/expressions/logical-assignment/lgcl-nullish-whitespace.js b/test/language/expressions/logical-assignment/lgcl-nullish-whitespace.js new file mode 100644 index 00000000000..7fc6484207d --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-nullish-whitespace.js @@ -0,0 +1,58 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]??=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = null; +assert.sameValue(x ??= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = null; +assert.sameValue(x +??= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = null; +assert.sameValue(x +??= +1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = null; +assert.sameValue(x
??=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = null; +assert.sameValue(x
??=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = null; +assert.sameValue(x   +

??=   +

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); diff --git a/test/language/expressions/logical-assignment/lgcl-or-arguments-strict.js b/test/language/expressions/logical-assignment/lgcl-or-arguments-strict.js new file mode 100644 index 00000000000..c67b5355016 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-or-arguments-strict.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(||=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments ||= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-or-eval-strict.js b/test/language/expressions/logical-assignment/lgcl-or-eval-strict.js new file mode 100644 index 00000000000..1d3a9e23472 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-or-eval-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(||=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval ||= 20; diff --git a/test/language/expressions/logical-assignment/lgcl-or-non-simple.js b/test/language/expressions/logical-assignment/lgcl-or-non-simple.js new file mode 100644 index 00000000000..90639520ec6 --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-or-non-simple.js @@ -0,0 +1,17 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "||=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 ||= 1; diff --git a/test/language/expressions/logical-assignment/lgcl-or-whitespace.js b/test/language/expressions/logical-assignment/lgcl-or-whitespace.js new file mode 100644 index 00000000000..bae1526633d --- /dev/null +++ b/test/language/expressions/logical-assignment/lgcl-or-whitespace.js @@ -0,0 +1,58 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]||=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 0; +assert.sameValue(x +||= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 0; +assert.sameValue(x +||= +1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 0; +assert.sameValue(x
||=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 0; +assert.sameValue(x
||=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 0; +assert.sameValue(x   +

||=   +

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');