Rename Symbol.name -> Symbol.local_name
to make it clearer what this means
This commit is contained in:
parent
9cd64d97a5
commit
6368d10d92
@ -469,11 +469,11 @@ impl<'a> State<'a> {
|
|||||||
let symbol_table = self.symbol_table_handle.borrow();
|
let symbol_table = self.symbol_table_handle.borrow();
|
||||||
let value = symbol_table.lookup_by_fqsn(&fqsn!(name ; tr));
|
let value = symbol_table.lookup_by_fqsn(&fqsn!(name ; tr));
|
||||||
Ok(match value {
|
Ok(match value {
|
||||||
Some(Symbol { name, spec, .. }) => match spec {
|
Some(Symbol { local_name, spec, .. }) => match spec {
|
||||||
//TODO I'll need this type_name later to do a table lookup
|
//TODO I'll need this type_name later to do a table lookup
|
||||||
SymbolSpec::DataConstructor { type_name: _type_name, type_args, .. } => {
|
SymbolSpec::DataConstructor { type_name: _type_name, type_args, .. } => {
|
||||||
if type_args.len() == 0 {
|
if type_args.len() == 0 {
|
||||||
Node::PrimObject { name: name.clone(), tag: 0, items: vec![] }
|
Node::PrimObject { name: local_name.clone(), tag: 0, items: vec![] }
|
||||||
} else {
|
} else {
|
||||||
return Err(format!("This data constructor thing not done"))
|
return Err(format!("This data constructor thing not done"))
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ pub enum ScopeSegmentKind {
|
|||||||
Function,
|
Function,
|
||||||
Type,
|
Type,
|
||||||
Terminal,
|
Terminal,
|
||||||
|
//Module
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_macros)]
|
#[allow(unused_macros)]
|
||||||
@ -105,7 +106,7 @@ impl SymbolTable {
|
|||||||
let mut vec: Vec<ScopeSegment> = scope_path.clone();
|
let mut vec: Vec<ScopeSegment> = scope_path.clone();
|
||||||
vec.push(ScopeSegment { name: name.clone(), kind: ScopeSegmentKind::Terminal });
|
vec.push(ScopeSegment { name: name.clone(), kind: ScopeSegmentKind::Terminal });
|
||||||
let fully_qualified_name = FullyQualifiedSymbolName(vec);
|
let fully_qualified_name = FullyQualifiedSymbolName(vec);
|
||||||
let symbol = Symbol { name: name.clone(), fully_qualified_name: fully_qualified_name.clone(), spec };
|
let symbol = Symbol { local_name: name.clone(), fully_qualified_name: fully_qualified_name.clone(), spec };
|
||||||
self.symbol_path_to_symbol.insert(fully_qualified_name, symbol);
|
self.symbol_path_to_symbol.insert(fully_qualified_name, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,14 +117,14 @@ impl SymbolTable {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Symbol {
|
pub struct Symbol {
|
||||||
pub name: Rc<String>, //TODO does this need to be pub?
|
pub local_name: Rc<String>, //TODO does this need to be pub?
|
||||||
fully_qualified_name: FullyQualifiedSymbolName,
|
fully_qualified_name: FullyQualifiedSymbolName,
|
||||||
pub spec: SymbolSpec,
|
pub spec: SymbolSpec,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Symbol {
|
impl fmt::Display for Symbol {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "<Name: {}, Spec: {}>", self.name, self.spec)
|
write!(f, "<Local name: {}, Spec: {}>", self.local_name, self.spec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user