File tree Expand file tree Collapse file tree 3 files changed +105
-2
lines changed
com.oracle.js.parser/src/com/oracle/js/parser
com.oracle.truffle.js.test/js Expand file tree Collapse file tree 3 files changed +105
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2010, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2010, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * The Universal Permissive License (UPL), Version 1.0
@@ -7554,7 +7554,7 @@ private void markSuperProperty() {
75547554 if (currentFunction .isMethod ()) {
75557555 currentFunction .setFlag (FunctionNode .USES_SUPER );
75567556 addIdentifierReference (SUPER .getName ());
7557- addIdentifierReference ( THIS . getName () );
7557+ markThis ( );
75587558 }
75597559 }
75607560
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+ */
7+
8+ /**
9+ * Regression test for implicit use of lexical `this` via `super` in a nested arrow function.
10+ */
11+ new class C1 {
12+ constructor ( ) {
13+ ( ( ) => {
14+ for ( let i = ( ( ) => super . a = 0 ) ( ) ;
15+ i >= 0 ;
16+ ( ( ) => ( this , i -- ) ) ( ) ) {
17+ }
18+ } ) ( ) ;
19+ }
20+ } ;
21+
22+ // original test case
23+ class C2 {
24+ constructor ( a4 , a5 ) {
25+ class C6 {
26+ }
27+ for ( let i9 = 0 , i10 = 10 ;
28+ i10 -- ;
29+ ( ( ) => {
30+ for ( let [ i15 , i16 ] = ( ( ) => {
31+ super . a = 0 ;
32+ return [ 0 , 10 ] ;
33+ } ) ( ) ;
34+ i16 ;
35+ ( ( ) => {
36+ this * Uint8Array ;
37+ C6 [ 8 ] = "o" ;
38+ i16 -- ;
39+ } ) ( ) ) {
40+ }
41+ } ) ( ) ) {
42+ }
43+ }
44+ }
45+ new C2 ( ) ;
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+ */
7+
8+ /**
9+ * Regression test for implicit use of lexical `this` via `super` in a nested arrow function.
10+ */
11+ class C0 {
12+ constructor ( ) {
13+ for ( let i = 0 ;
14+ ( ( ) => {
15+ this ; // explicit use of `this`
16+ for ( let j = 0 ;
17+ ( ( ) => {
18+ super . toString ( ) ; // implicit use of `this`
19+ return j < 1 ;
20+ } ) ( ) ;
21+ j ++ ) {
22+ }
23+ return i < 1 ;
24+ } ) ( ) ;
25+ i ++ ) {
26+ }
27+ }
28+ }
29+ new C0 ( ) ;
30+
31+ // bonus test case
32+ class C1 extends C0 {
33+ constructor ( ) {
34+ for ( let i = 0 ;
35+ ( ( ) => {
36+ for ( let j = 0 ;
37+ ( ( ) => {
38+ super ( ) ;
39+ return j < 0 ;
40+ } ) ( ) ;
41+ j ++ ) {
42+ }
43+ for ( let j = 0 ;
44+ ( ( ) => {
45+ super . toString ( ) ;
46+ return j < 0 ;
47+ } ) ( ) ;
48+ j ++ ) {
49+ }
50+ this . toString ( ) ;
51+ return i < 1 ;
52+ } ) ( ) ;
53+ i ++ ) {
54+ break ;
55+ }
56+ }
57+ }
58+ new C1 ( ) ;
You can’t perform that action at this time.
0 commit comments