mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Add tests for increment and decrement operations on this
This commit is contained in:
parent
4fc741b008
commit
377231a1de
27
test/language/expressions/postfix-decrement/this.js
Normal file
27
test/language/expressions/postfix-decrement/this.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2023 Ecma International. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-update-expressions-static-semantics-early-errors
|
||||||
|
description: >
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (this)
|
||||||
|
info: |
|
||||||
|
sec-static-semantics-assignmenttargettype
|
||||||
|
|
||||||
|
PrimaryExpression : this
|
||||||
|
|
||||||
|
Return invalid.
|
||||||
|
|
||||||
|
sec-update-expressions-static-semantics-early-errors
|
||||||
|
|
||||||
|
UpdateExpression: LeftHandSideExpression --
|
||||||
|
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple.
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
this--;
|
27
test/language/expressions/postfix-increment/this.js
Normal file
27
test/language/expressions/postfix-increment/this.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2023 Ecma International. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-update-expressions-static-semantics-early-errors
|
||||||
|
description: >
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (this)
|
||||||
|
info: |
|
||||||
|
sec-static-semantics-assignmenttargettype
|
||||||
|
|
||||||
|
PrimaryExpression : this
|
||||||
|
|
||||||
|
Return invalid.
|
||||||
|
|
||||||
|
sec-update-expressions-static-semantics-early-errors
|
||||||
|
|
||||||
|
UpdateExpression: LeftHandSideExpression ++
|
||||||
|
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple.
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
this++;
|
27
test/language/expressions/prefix-decrement/this.js
Normal file
27
test/language/expressions/prefix-decrement/this.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2023 Ecma International. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-update-expressions-static-semantics-early-errors
|
||||||
|
description: >
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (this)
|
||||||
|
info: |
|
||||||
|
sec-static-semantics-assignmenttargettype
|
||||||
|
|
||||||
|
PrimaryExpression : this
|
||||||
|
|
||||||
|
Return invalid.
|
||||||
|
|
||||||
|
sec-update-expressions-static-semantics-early-errors
|
||||||
|
|
||||||
|
UpdateExpression: -- UnaryExpression
|
||||||
|
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple.
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
--this;
|
27
test/language/expressions/prefix-increment/this.js
Normal file
27
test/language/expressions/prefix-increment/this.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2023 Ecma International. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-update-expressions-static-semantics-early-errors
|
||||||
|
description: >
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (this)
|
||||||
|
info: |
|
||||||
|
sec-static-semantics-assignmenttargettype
|
||||||
|
|
||||||
|
PrimaryExpression : this
|
||||||
|
|
||||||
|
Return invalid.
|
||||||
|
|
||||||
|
sec-update-expressions-static-semantics-early-errors
|
||||||
|
|
||||||
|
UpdateExpression: ++ UnaryExpression
|
||||||
|
|
||||||
|
It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple.
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
++this;
|
Loading…
x
Reference in New Issue
Block a user