Currently broken import all commit

This commit is contained in:
greg 2019-10-18 09:55:26 -07:00
parent 7a56b6dfc0
commit e75958c2a2
1 changed files with 12 additions and 1 deletions

View File

@ -16,7 +16,18 @@ impl<'a> ASTVisitor for ScopeResolver<'a> {
fn import(&mut self, import_spec: &ImportSpecifier) {
let ImportSpecifier { ref path_components, ref imported_names, .. } = &import_spec;
match imported_names {
ImportedNames::All => unimplemented!(),
ImportedNames::All => {
let len = path_components.len();
let prefix = FullyQualifiedSymbolName(path_components.iter().enumerate().map(|(i, c)| ScopeSegment {
name: c.clone(), kind: if i == len-1 { ScopeSegmentKind::Terminal } else { ScopeSegmentKind::Type }
}).collect());
let members = self.symbol_table.lookup_children_of_fqsn(&prefix);
for member in members.into_iter() {
let local_name = member.0.last().unwrap().name.clone();
println!("LOCAL NAME: {:?} and member: {:?}", local_name, member);
self.name_scope_stack.insert(local_name.clone(), member.0);
}
},
ImportedNames::LastOfPath => {
let name = path_components.last().unwrap(); //TODO handle better
let fqsn_prefix = path_components.iter().map(|c| ScopeSegment {