Remove one use of symbol_table.lookup_by_name
Should aim to remove it entirely
This commit is contained in:
parent
611e46938d
commit
16dc973aa6
@ -27,6 +27,7 @@ pub enum ScopeSegmentKind {
|
||||
Terminal,
|
||||
}
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! fqsn {
|
||||
( $( $name:expr ; $kind:tt),* ) => {
|
||||
{
|
||||
@ -42,6 +43,7 @@ macro_rules! fqsn {
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! sym_path_kind {
|
||||
(fn) => { ScopeSegmentKind::Function };
|
||||
(ty) => { ScopeSegmentKind::Type };
|
||||
@ -80,6 +82,7 @@ impl SymbolTable {
|
||||
self.lookup_by_path(&symbol_path)
|
||||
}
|
||||
|
||||
//TODO rename to lookup_by_fqsn
|
||||
pub fn lookup_by_path(&self, fully_qualified_path: &FullyQualifiedSymbolName) -> Option<&Symbol> {
|
||||
self.symbol_path_to_symbol.get(fully_qualified_path)
|
||||
}
|
||||
@ -292,7 +295,7 @@ mod symbol_table_tests {
|
||||
let mut symbol_table = SymbolTable::new();
|
||||
let ast = quick_ast($source);
|
||||
symbol_table.add_top_level_symbols(&ast).unwrap();
|
||||
match symbol_table.lookup_by_name($single_value) {
|
||||
match symbol_table.lookup_by_path($single_value) {
|
||||
Some(_spec) => (),
|
||||
None => panic!(),
|
||||
};
|
||||
@ -302,7 +305,7 @@ mod symbol_table_tests {
|
||||
|
||||
#[test]
|
||||
fn basic_symbol_table() {
|
||||
values_in_table! { "let a = 10; fn b() { 20 }", &rc!(b) };
|
||||
values_in_table! { "let a = 10; fn b() { 20 }", &fqsn!("b"; tr) }
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user