File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ check_syntax_error("class A { static *#bar(x) { } #bar }");
5353check_syntax_error ( "class A { async *#bar(x) { } #bar }" ) ;
5454check_syntax_error ( "class A { async #bar(x) { } #bar }" ) ;
5555check_syntax_error ( "class A { *#bar(x) { } #bar }" ) ;
56+ check_syntax_error ( "class A { #a; foo(){ ++this.#a; --this.#a; this.#a++; this.#a--; }}" ) ;
5657
5758
5859class A {
@@ -350,3 +351,23 @@ class Q extends Array {
350351
351352var var18 = new Q ( ) ;
352353assert ( var18 . b ( ) == 1 ) ;
354+
355+ class R {
356+ #a = 0 ;
357+ test ( ) {
358+ ++ this . #a;
359+ assert ( this . #a == 1 ) ;
360+ assert ( ++ this . #a == 2 ) ;
361+ -- this . #a;
362+ assert ( this . #a == 1 ) ;
363+ assert ( -- this . #a == 0 ) ;
364+ this . #a++ ;
365+ assert ( this . #a == 1 ) ;
366+ assert ( this . #a++ == 1 ) ;
367+ this . #a-- ;
368+ assert ( this . #a == 1 ) ;
369+ assert ( this . #a-- == 1 ) ;
370+ }
371+ }
372+ var var19 = new R ( ) ;
373+ var19 . test ( ) ;
Original file line number Diff line number Diff line change 1+ // Copyright JS Foundation and other contributors, http://js.foundation
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ class A {
16+ #a = 0 ;
17+ incr ( ) {
18+ this . #a++ ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments