perf: 类私有名作用域容器改哈希表,点查由线性扫描改 O(1)

This commit is contained in:
2026-10-12 04:01:14 +00:00
parent 6b2bd6abb8
commit 26441edcbc
6 changed files with 34 additions and 34 deletions
+2 -4
View File
@@ -167,10 +167,8 @@ impl Emitter {
let mut stacked_names = saved_private_names.clone();
let mut stacked_kinds = saved_private_kinds.clone();
for (n, id, kind, is_static) in &private_names {
stacked_names.retain(|(en, _)| en != n);
stacked_kinds.retain(|(en, _, _, _)| en != n);
stacked_names.push((n.clone(), *id));
stacked_kinds.push((n.clone(), *kind, *is_static, private_brand_id.unwrap_or(0)));
stacked_names.insert(n.clone(), *id);
stacked_kinds.insert(n.clone(), (*kind, *is_static, private_brand_id.unwrap_or(0)));
}
ctx.scopes.private_name_map = stacked_names;
ctx.scopes.private_element_kinds = stacked_kinds;