Merge pull request #21369 from asgerf/js/this-bindings

JS: Emit variables for 'this'
This commit is contained in:
Asger F
2026-03-05 13:36:38 +01:00
committed by GitHub
278 changed files with 50937 additions and 44951 deletions

View File

@@ -453,7 +453,7 @@ is_arguments_object (int id: @variable ref);
@lexical_name = @variable | @local_type_name | @local_namespace_name;
@bind_id = @varaccess | @local_var_type_access;
@bind_id = @varaccess | @local_var_type_access | @this_expr;
bind (unique int id: @bind_id ref,
int decl: @variable ref);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Add variable bindings for 'this'
compatibility: partial

View File

@@ -54,23 +54,30 @@ getAnAssignedExpr
| y | let.js:19:12:19:13 | 19 |
getDeclaringContainer
| arrayPatternDefault.js:1:2:1:1 | arguments | arrayPatternDefault.js:1:2:4:1 | functio ... bal2;\\n} |
| arrayPatternDefault.js:1:2:1:1 | this | arrayPatternDefault.js:1:2:4:1 | functio ... bal2;\\n} |
| arrayPatternDefault.js:1:11:1:11 | o | arrayPatternDefault.js:1:2:4:1 | functio ... bal2;\\n} |
| arrayPatternDefault.js:2:8:2:8 | x | arrayPatternDefault.js:1:2:4:1 | functio ... bal2;\\n} |
| assignments.js:3:1:3:0 | arguments | assignments.js:3:1:6:1 | functio ... = 56;\\n} |
| assignments.js:3:1:3:0 | this | assignments.js:3:1:6:1 | functio ... = 56;\\n} |
| assignments.js:4:6:4:6 | g | assignments.js:3:1:6:1 | functio ... = 56;\\n} |
| assignments.js:4:10:4:9 | arguments | assignments.js:4:10:4:24 | function h() {} |
| assignments.js:4:10:4:9 | this | assignments.js:4:10:4:24 | function h() {} |
| assignments.js:4:19:4:19 | h | assignments.js:4:10:4:24 | function h() {} |
| defaultargs.js:1:2:1:1 | this | defaultargs.js:1:2:5:1 | functio ... ]) {}\\n} |
| defaultargs.js:2:7:2:7 | x | defaultargs.js:1:2:5:1 | functio ... ]) {}\\n} |
| defaultargs.js:2:10:2:18 | arguments | defaultargs.js:1:2:5:1 | functio ... ]) {}\\n} |
| defaultargs.js:3:3:3:2 | arguments | defaultargs.js:3:3:3:25 | functio ... = x) {} |
| defaultargs.js:3:3:3:2 | this | defaultargs.js:3:3:3:25 | functio ... = x) {} |
| defaultargs.js:3:12:3:12 | f | defaultargs.js:1:2:5:1 | functio ... ]) {}\\n} |
| defaultargs.js:3:14:3:14 | x | defaultargs.js:3:3:3:25 | functio ... = x) {} |
| defaultargs.js:3:17:3:17 | y | defaultargs.js:3:3:3:25 | functio ... = x) {} |
| defaultargs.js:4:3:4:2 | arguments | defaultargs.js:4:3:4:51 | functio ... [0]) {} |
| defaultargs.js:4:3:4:2 | this | defaultargs.js:4:3:4:51 | functio ... [0]) {} |
| defaultargs.js:4:12:4:12 | g | defaultargs.js:1:2:5:1 | functio ... ]) {}\\n} |
| defaultargs.js:4:14:4:14 | x | defaultargs.js:4:3:4:51 | functio ... [0]) {} |
| defaultargs.js:4:32:4:32 | y | defaultargs.js:4:3:4:51 | functio ... [0]) {} |
| for.js:1:2:1:1 | arguments | for.js:1:2:5:1 | functio ... x;\\n} |
| for.js:1:2:1:1 | this | for.js:1:2:5:1 | functio ... x;\\n} |
| for.js:1:11:1:11 | o | for.js:1:2:5:1 | functio ... x;\\n} |
| for.js:2:7:2:7 | x | for.js:1:2:5:1 | functio ... x;\\n} |
| legacyletstmt.js:3:6:3:6 | x | legacyletstmt.js:1:1:8:0 | <toplevel> |
@@ -82,20 +89,26 @@ getDeclaringContainer
| let.js:6:17:6:17 | x | let.js:1:1:22:0 | <toplevel> |
| let.js:9:18:9:18 | x | let.js:1:1:22:0 | <toplevel> |
| let.js:14:1:14:0 | arguments | let.js:14:1:21:1 | functio ... }\\n} |
| let.js:14:1:14:0 | this | let.js:14:1:21:1 | functio ... }\\n} |
| let.js:14:14:14:14 | x | let.js:14:1:21:1 | functio ... }\\n} |
| let.js:17:11:17:11 | y | let.js:14:1:21:1 | functio ... }\\n} |
| typeoftype.ts:1:1:1:0 | arguments | typeoftype.ts:1:1:6:1 | functio ... x\\n }\\n} |
| typeoftype.ts:1:1:1:0 | this | typeoftype.ts:1:1:6:1 | functio ... x\\n }\\n} |
| typeoftype.ts:2:7:2:7 | x | typeoftype.ts:1:1:6:1 | functio ... x\\n }\\n} |
| typeoftype.ts:3:3:3:2 | arguments | typeoftype.ts:3:3:5:3 | functio ... e x\\n } |
| typeoftype.ts:3:3:3:2 | this | typeoftype.ts:3:3:5:3 | functio ... e x\\n } |
| typeoftype.ts:3:12:3:12 | g | typeoftype.ts:1:1:6:1 | functio ... x\\n }\\n} |
| typeoftype.ts:4:9:4:9 | y | typeoftype.ts:3:3:5:3 | functio ... e x\\n } |
| variables.js:8:1:8:0 | arguments | variables.js:8:1:12:1 | functio ... ar x;\\n} |
| variables.js:8:1:8:0 | this | variables.js:8:1:12:1 | functio ... ar x;\\n} |
| variables.js:9:6:9:6 | x | variables.js:8:1:12:1 | functio ... ar x;\\n} |
| variables.js:13:1:13:0 | arguments | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:13:1:13:0 | this | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:13:12:13:12 | y | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:13:15:13:15 | z | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:15:6:15:6 | x | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:16:2:16:1 | arguments | variables.js:16:2:22:2 | functio ... y+z;\\n\\t} |
| variables.js:16:2:16:1 | this | variables.js:16:2:22:2 | functio ... y+z;\\n\\t} |
| variables.js:16:11:16:11 | h | variables.js:13:1:23:1 | functio ... z;\\n\\t}\\n} |
| variables.js:16:13:16:13 | z | variables.js:16:2:22:2 | functio ... y+z;\\n\\t} |
| variables.js:18:11:18:11 | y | variables.js:16:2:22:2 | functio ... y+z;\\n\\t} |

View File

@@ -1,3 +1,4 @@
| tst2.js:4:3:6:3 | getX: f ... .x;\\n } | This property is overwritten by $@ in the same object literal. | tst2.js:12:3:14:3 | getX: f ... .x;\\n } | another property |
| tst2.js:8:3:10:3 | setX: f ... x;\\n } | This property is overwritten by $@ in the same object literal. | tst2.js:16:3:18:3 | setX: f ... x;\\n } | another property |
| tst.js:20:3:20:7 | x: 23 | This property is overwritten by $@ in the same object literal. | tst.js:23:3:23:7 | x: 56 | another property |
| tst.js:21:3:21:12 | y: "hello" | This property is overwritten by $@ in the same object literal. | tst.js:24:3:24:14 | "y": "world" | another property |

View File

@@ -3,7 +3,7 @@ var o = {
getX: function() {
return this.x;
},
}, // $ Alert
setX: function(x) {
this.x = x;

View File

@@ -1,4 +1,3 @@
| tst2.js:4:3:6:3 | getX: f ... .x;\\n } | This property is duplicated $@. | tst2.js:12:3:14:3 | getX: f ... .x;\\n } | in a later property |
| tst.js:2:3:2:16 | "key": "value" | This property is duplicated $@. | tst.js:5:3:5:16 | "key": "value" | in a later property |
| tst.js:4:3:4:14 | "1": "value" | This property is duplicated $@. | tst.js:11:3:11:12 | 1: "value" | in a later property |
| tst.js:5:3:5:16 | "key": "value" | This property is duplicated $@. | tst.js:6:3:6:16 | 'key': "value" | in a later property |

View File

@@ -3,11 +3,11 @@ var o = {
getX: function() {
return this.x;
}, // $ Alert
}, // $ MISSING: Alert // The structural comparison fails to treat the two 'this' variables as the same
setX: function(x) {
this.x = x;
},
}, // $ MISSING: Alert // The structural comparison fails to treat the two 'x' variables as the same
getX: function() {
return this.x;