mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 修复 TDZ 变量误写入全局作用域问题
This commit is contained in:
@@ -58,8 +58,10 @@ impl SymbolTable {
|
||||
}
|
||||
|
||||
pub fn lookup_or_global(&mut self, name: &str, reg_for_new: u8) -> u8 {
|
||||
if let Ok(reg) = self.lookup(name) {
|
||||
return reg;
|
||||
for scope in self.scopes.iter().rev() {
|
||||
if let Some(b) = scope.get(name) {
|
||||
return b.reg;
|
||||
}
|
||||
}
|
||||
self.scopes[0].insert(
|
||||
name.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user