Rename Symbol.name -> Symbol.local_name

to make it clearer what this means
This commit is contained in:
greg 2019-09-24 18:56:53 -07:00
parent 9cd64d97a5
commit 6368d10d92
2 changed files with 6 additions and 5 deletions

View File

@ -469,11 +469,11 @@ impl<'a> State<'a> {
let symbol_table = self.symbol_table_handle.borrow();
let value = symbol_table.lookup_by_fqsn(&fqsn!(name ; tr));
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
SymbolSpec::DataConstructor { type_name: _type_name, type_args, .. } => {
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 {
return Err(format!("This data constructor thing not done"))
}

View File

@ -53,6 +53,7 @@ pub enum ScopeSegmentKind {
Function,
Type,
Terminal,
//Module
}
#[allow(unused_macros)]
@ -105,7 +106,7 @@ impl SymbolTable {
let mut vec: Vec<ScopeSegment> = scope_path.clone();
vec.push(ScopeSegment { name: name.clone(), kind: ScopeSegmentKind::Terminal });
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);
}
@ -116,14 +117,14 @@ impl SymbolTable {
#[derive(Debug)]
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,
pub spec: SymbolSpec,
}
impl fmt::Display for Symbol {
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)
}
}