From e75958c2a20857700f0fddb80a7f0b09d2eed903 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 18 Oct 2019 09:55:26 -0700 Subject: [PATCH] Currently broken import all commit --- schala-lang/language/src/scope_resolution.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs index 11c6ebb..372f766 100644 --- a/schala-lang/language/src/scope_resolution.rs +++ b/schala-lang/language/src/scope_resolution.rs @@ -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 {