mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-27 04:01:11 +08:00
fix: 顶层函数声明名并入 A 侧 tier 路由——再赋值/裸读与全局属性收敛单一真值
This commit is contained in:
@@ -148,6 +148,21 @@ impl Emitter {
|
||||
}
|
||||
}
|
||||
|
||||
/// 收集语句列表**直接子级**函数声明的绑定名(顶层函数声明是全局 var 绑定,
|
||||
/// 裸读/裸写与 var 名同路由全局对象属性)。不递归进块:块内函数声明是块
|
||||
/// 作用域,不参与全局对象同步;`export default function` 是 lexical 绑定,不纳。
|
||||
pub(crate) fn collect_top_level_function_names(&self, stmts: &[Statement]) -> HashSet<String> {
|
||||
let mut names = HashSet::new();
|
||||
for stmt in stmts {
|
||||
if let Statement::FunctionDeclaration(fd) = stmt {
|
||||
if let Some(id) = &fd.id {
|
||||
names.insert(id.name.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
names
|
||||
}
|
||||
|
||||
/// 收集当前函数作用域声明的绑定名(参数 + 变量/函数声明,含嵌套 block,不含嵌套函数体)。
|
||||
pub(crate) fn collect_own_binding_names(&self, param_names: &[&str], stmts: &[Statement]) -> HashSet<String> {
|
||||
let mut names = HashSet::new();
|
||||
|
||||
Reference in New Issue
Block a user