File tree 3 files changed +104
-1
lines changed
com.oracle.js.parser/src/com/oracle/js/parser
com.oracle.truffle.js.test/js
3 files changed +104
-1
lines changed Original file line number Diff line number Diff line change @@ -7561,7 +7561,7 @@ private void markSuperProperty() {
7561
7561
if (currentFunction .isMethod ()) {
7562
7562
currentFunction .setFlag (FunctionNode .USES_SUPER );
7563
7563
addIdentifierReference (SUPER .getName ());
7564
- addIdentifierReference ( THIS . getName () );
7564
+ markThis ( );
7565
7565
}
7566
7566
}
7567
7567
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