From 8b1dd561f205c0dc0e0282490e2391e8c1f20ebd Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 19 Sep 2019 03:06:49 -0700 Subject: [PATCH] Add get_fqsn_from_id opposite lookup method --- schala-lang/language/src/symbol_table.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schala-lang/language/src/symbol_table.rs b/schala-lang/language/src/symbol_table.rs index c6c0775..de595cc 100644 --- a/schala-lang/language/src/symbol_table.rs +++ b/schala-lang/language/src/symbol_table.rs @@ -97,6 +97,10 @@ impl SymbolTable { self.id_to_fqsn.insert(id.clone(), fqsn); } + pub fn get_fqsn_from_id(&mut self, id: &ItemId) -> Option { + self.id_to_fqsn.get(&id).cloned() + } + fn add_new_symbol(&mut self, name: &Rc, scope_path: &Vec, spec: SymbolSpec) { let mut vec: Vec = scope_path.clone(); vec.push(ScopeSegment { name: name.clone(), kind: ScopeSegmentKind::Terminal });