JS: Emit variable bindings for 'this' expressions

This commit is contained in:
Asger F
2026-02-27 11:44:54 +01:00
parent f0f58dacb3
commit 0f2de46648
2 changed files with 10 additions and 1 deletions

View File

@@ -1896,6 +1896,15 @@ public class ASTExtractor {
return visit((ThisExpression) nd, c);
}
@Override
public Label visit(ThisExpression nd, Context c) {
Label key = super.visit(nd, c);
if (c.idcontext == IdContext.VAR_BIND || c.idcontext == IdContext.VAR_IN_TYPE_BIND) {
addVariableBinding("bind", key, "this");
}
return key;
}
@Override
public Label visit(JSXMemberExpression nd, Context c) {
Label key = super.visit(nd, c);

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);