Symbol local_name
This commit is contained in:
parent
89a93d59c7
commit
88dfa87e85
@ -153,7 +153,8 @@ impl SymbolTable {
|
||||
/// to a Symbol, a descriptor of what that name refers to.
|
||||
fn add_symbol(&mut self, id: &ItemId, fqsn: Fqsn, spec: SymbolSpec) {
|
||||
let def_id = self.def_id_store.fresh();
|
||||
let symbol = Rc::new(Symbol { fully_qualified_name: fqsn.clone(), spec, def_id });
|
||||
let local_name = fqsn.last_elem();
|
||||
let symbol = Rc::new( Symbol { fully_qualified_name: fqsn.clone(), local_name, spec, def_id });
|
||||
self.symbol_trie.insert(&fqsn, def_id);
|
||||
self.id_to_def.insert(*id, def_id);
|
||||
self.def_to_symbol.insert(def_id, symbol);
|
||||
@ -162,7 +163,8 @@ impl SymbolTable {
|
||||
fn populate_single_builtin(&mut self, fqsn: Fqsn, builtin: Builtin) {
|
||||
let def_id = self.def_id_store.fresh();
|
||||
let spec = SymbolSpec::Builtin(builtin);
|
||||
let symbol = Rc::new(Symbol { fully_qualified_name: fqsn.clone(), spec, def_id });
|
||||
let local_name = fqsn.last_elem();
|
||||
let symbol = Rc::new(Symbol { fully_qualified_name: fqsn.clone(), local_name, spec, def_id });
|
||||
|
||||
self.symbol_trie.insert(&fqsn, def_id);
|
||||
self.def_to_symbol.insert(def_id, symbol);
|
||||
@ -173,13 +175,14 @@ impl SymbolTable {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Symbol {
|
||||
fully_qualified_name: Fqsn,
|
||||
local_name: Rc<String>,
|
||||
spec: SymbolSpec,
|
||||
def_id: DefId,
|
||||
}
|
||||
|
||||
impl Symbol {
|
||||
pub fn local_name(&self) -> Rc<String> {
|
||||
self.fully_qualified_name.last_elem()
|
||||
pub fn local_name(&self) -> &str {
|
||||
self.local_name.as_ref()
|
||||
}
|
||||
|
||||
pub fn def_id(&self) -> Option<DefId> {
|
||||
|
Loading…
Reference in New Issue
Block a user