Isolate import handling code

This commit is contained in:
greg 2019-09-24 18:42:01 -07:00
parent 41cad61e34
commit 9cd64d97a5

View File

@ -21,7 +21,14 @@ impl<'a> ScopeResolver<'a> {
match statement.kind { match statement.kind {
StatementKind::Declaration(ref decl) => self.decl(decl), StatementKind::Declaration(ref decl) => self.decl(decl),
StatementKind::Expression(ref expr) => self.expr(expr), StatementKind::Expression(ref expr) => self.expr(expr),
StatementKind::Import(ImportSpecifier { ref path_components, ref imported_names, .. }) => { StatementKind::Import(ref spec) => self.import(spec),
}?;
}
Ok(())
}
fn import(&mut self, import_spec: &ImportSpecifier) -> Result<(), String> {
let ImportSpecifier { ref path_components, ref imported_names, .. } = &import_spec;
match imported_names { match imported_names {
ImportedNames::All => unimplemented!(), ImportedNames::All => unimplemented!(),
ImportedNames::LastOfPath => { ImportedNames::LastOfPath => {
@ -34,11 +41,6 @@ impl<'a> ScopeResolver<'a> {
} }
ImportedNames::List(ref names) => unimplemented!() ImportedNames::List(ref names) => unimplemented!()
}; };
//self.name_scope_stack.insert()
Ok(())
}
}?;
}
Ok(()) Ok(())
} }