(&mut self, name: &str, typ: CompilerScope, line_number: u32)
| 1017 | } |
| 1018 | |
| 1019 | fn enter_scope(&mut self, name: &str, typ: CompilerScope, line_number: u32) { |
| 1020 | let is_nested = self |
| 1021 | .tables |
| 1022 | .last() |
| 1023 | .map(|table| { |
| 1024 | table.is_nested |
| 1025 | || matches!( |
| 1026 | table.typ, |
| 1027 | CompilerScope::Function | CompilerScope::AsyncFunction |
| 1028 | ) |
| 1029 | }) |
| 1030 | .unwrap_or(false); |
| 1031 | // Inherit mangled_names from parent for non-class scopes |
| 1032 | let inherited_mangled_names = self |
| 1033 | .tables |
| 1034 | .last() |
| 1035 | .and_then(|t| t.mangled_names.clone()) |
| 1036 | .filter(|_| typ != CompilerScope::Class); |
| 1037 | let mut table = SymbolTable::new(name.to_owned(), typ, line_number, is_nested); |
| 1038 | table.future_annotations = self.future_annotations; |
| 1039 | table.mangled_names = inherited_mangled_names; |
| 1040 | self.tables.push(table); |
| 1041 | // Save parent's varnames and start fresh for the new scope |
| 1042 | self.varnames_stack |
| 1043 | .push(core::mem::take(&mut self.current_varnames)); |
| 1044 | } |
| 1045 | |
| 1046 | fn enter_type_param_block( |
| 1047 | &mut self, |
no test coverage detected