Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transformer/private-methods): create brand binding var in hoist scope #8361

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/es2022/class_properties/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ impl<'a> ClassProperties<'a, '_> {
// `_Class_brand`
let name = class_name_binding.as_ref().map_or_else(|| "Class", |binding| &binding.name);
let name = &format!("_{name}_brand");
let scope_id = ctx.current_block_scope_id();
ctx.generate_uid(name, scope_id, SymbolFlags::FunctionScopedVariable)
ctx.generate_uid_in_current_hoist_scope(name)
});

let static_private_fields_use_temp = !is_declaration;
let class_bindings = ClassBindings::new(
class_name_binding,
Expand Down
13 changes: 1 addition & 12 deletions tasks/coverage/snapshots/semantic_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: d85767ab

semantic_typescript Summary:
AST Parsed : 6503/6503 (100.00%)
Positive Passed: 2831/6503 (43.53%)
Positive Passed: 2832/6503 (43.55%)
tasks/coverage/typescript/tests/cases/compiler/2dArrays.ts
semantic error: Symbol reference IDs mismatch for "Cell":
after transform: SymbolId(0): [ReferenceId(1)]
Expand Down Expand Up @@ -34882,17 +34882,6 @@ Scope flags mismatch:
after transform: ScopeId(5): ScopeFlags(StrictMode | Function)
rebuilt : ScopeId(8): ScopeFlags(Function)

tasks/coverage/typescript/tests/cases/conformance/classes/members/privateNames/privateNameClassExpressionLoop.ts
semantic error: Bindings mismatch:
after transform: ScopeId(0): ["_classPrivateFieldInitSpec", "_classPrivateMethodInitSpec", "_myField", "array"]
rebuilt : ScopeId(0): ["_C_brand", "_classPrivateFieldInitSpec", "_classPrivateMethodInitSpec", "_myField", "array"]
Bindings mismatch:
after transform: ScopeId(2): ["_C_brand", "_get_accessor", "_method", "_set_accessor"]
rebuilt : ScopeId(2): ["_get_accessor", "_method", "_set_accessor"]
Symbol scope ID mismatch for "_C_brand":
after transform: SymbolId(8): ScopeId(2)
rebuilt : SymbolId(5): ScopeId(0)

tasks/coverage/typescript/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts
semantic error: Unresolved references mismatch:
after transform: ["Record", "WeakMap", "console", "require"]
Expand Down
Loading