mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Split out populate_scope
This commit is contained in:
@@ -144,12 +144,19 @@ impl ModuleCompiler {
|
||||
self.diagnostics.append(&mut scope_analysis.diagnostics);
|
||||
let scope = init_std_scope();
|
||||
|
||||
self.populate_scope(module, &scope);
|
||||
|
||||
for module_item in &module.body {
|
||||
self.compile_module_item(module_item, &scope);
|
||||
}
|
||||
}
|
||||
|
||||
fn populate_scope(&mut self, module: &swc_ecma_ast::Module, scope: &Scope) {
|
||||
use swc_ecma_ast::Decl;
|
||||
use swc_ecma_ast::ModuleDecl;
|
||||
use swc_ecma_ast::ModuleItem;
|
||||
use swc_ecma_ast::Stmt;
|
||||
|
||||
// Populate scope with top-level declarations
|
||||
for module_item in &module.body {
|
||||
match module_item {
|
||||
ModuleItem::ModuleDecl(module_decl) => match module_decl {
|
||||
@@ -401,10 +408,6 @@ impl ModuleCompiler {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
for module_item in &module.body {
|
||||
self.compile_module_item(module_item, &scope);
|
||||
}
|
||||
}
|
||||
|
||||
fn compile_module_item(&mut self, module_item: &swc_ecma_ast::ModuleItem, scope: &Scope) {
|
||||
|
||||
Reference in New Issue
Block a user