feat: rest 参数(function f(...args)),实参区收集数组

This commit is contained in:
2026-08-10 00:33:25 +08:00
parent 5a9a46483d
commit 85c192a747
10 changed files with 184 additions and 8 deletions
+6
View File
@@ -19,6 +19,12 @@ impl Emitter {
names.insert(bi.name.to_string());
}
}
// rest 形参也是本函数作用域绑定,遮蔽外层同名变量。
if let Some(rest) = &params.rest {
if let oxide_parser::BindingPattern::BindingIdentifier(bi) = &rest.rest.argument {
names.insert(bi.name.to_string());
}
}
names
}