Fix clippy
This commit is contained in:
parent
08590430e4
commit
6a7c88cd02
@ -214,7 +214,7 @@ impl Symbol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_id(&self) -> Option<DefId> {
|
pub fn def_id(&self) -> Option<DefId> {
|
||||||
Some(self.def_id.clone())
|
Some(self.def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spec(&self) -> SymbolSpec {
|
pub fn spec(&self) -> SymbolSpec {
|
||||||
@ -302,7 +302,7 @@ impl SymbolTable {
|
|||||||
println!("In add_symbol(), adding: {:?}", symbol);
|
println!("In add_symbol(), adding: {:?}", symbol);
|
||||||
self.symbol_trie.insert(&fqsn);
|
self.symbol_trie.insert(&fqsn);
|
||||||
self.fqsn_to_symbol.insert(fqsn, symbol.clone());
|
self.fqsn_to_symbol.insert(fqsn, symbol.clone());
|
||||||
self.id_to_symbol.insert(id.clone(), symbol);
|
self.id_to_symbol.insert(*id, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Walks the AST, matching the ID of an identifier used in some expression to
|
/// Walks the AST, matching the ID of an identifier used in some expression to
|
||||||
|
@ -83,7 +83,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
Some(NameType::Import(fqsn)) => {
|
Some(NameType::Import(fqsn)) => {
|
||||||
let symbol = self.symbol_table.fqsn_to_symbol.get(fqsn);
|
let symbol = self.symbol_table.fqsn_to_symbol.get(fqsn);
|
||||||
if let Some(symbol) = symbol {
|
if let Some(symbol) = symbol {
|
||||||
self.symbol_table.id_to_symbol.insert(id.clone(), symbol.clone());
|
self.symbol_table.id_to_symbol.insert(*id, symbol.clone());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(NameType::Param(n)) => {
|
Some(NameType::Param(n)) => {
|
||||||
@ -96,7 +96,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
Some(NameType::LocalVariable(item_id)) => {
|
Some(NameType::LocalVariable(item_id)) => {
|
||||||
let symbol = self.symbol_table.id_to_symbol.get(item_id).cloned();
|
let symbol = self.symbol_table.id_to_symbol.get(item_id).cloned();
|
||||||
if let Some(symbol) = symbol {
|
if let Some(symbol) = symbol {
|
||||||
self.symbol_table.id_to_symbol.insert(id.clone(), symbol);
|
self.symbol_table.id_to_symbol.insert(*id, symbol);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
@ -104,7 +104,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
let fqsn = Fqsn { scopes: vec![Scope::Name(local_name.clone())] };
|
let fqsn = Fqsn { scopes: vec![Scope::Name(local_name.clone())] };
|
||||||
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
||||||
if let Some(symbol) = symbol {
|
if let Some(symbol) = symbol {
|
||||||
self.symbol_table.id_to_symbol.insert(id.clone(), symbol.clone());
|
self.symbol_table.id_to_symbol.insert(*id, symbol.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
let fqsn = Fqsn { scopes: components.iter().map(|name| Scope::Name(name.clone())).collect() };
|
let fqsn = Fqsn { scopes: components.iter().map(|name| Scope::Name(name.clone())).collect() };
|
||||||
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
||||||
if let Some(symbol) = symbol {
|
if let Some(symbol) = symbol {
|
||||||
self.symbol_table.id_to_symbol.insert(id.clone(), symbol.clone());
|
self.symbol_table.id_to_symbol.insert(*id, symbol.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ impl<'a> ASTVisitor for ScopeResolver<'a> {
|
|||||||
// We are within a function scope
|
// We are within a function scope
|
||||||
let fqsn = Fqsn { scopes: vec![Scope::Name(fn_name), Scope::Name(name.clone())] };
|
let fqsn = Fqsn { scopes: vec![Scope::Name(fn_name), Scope::Name(name.clone())] };
|
||||||
self.symbol_table.add_symbol(id, fqsn, SymbolSpec::LocalVariable);
|
self.symbol_table.add_symbol(id, fqsn, SymbolSpec::LocalVariable);
|
||||||
self.lexical_scopes.insert(name.clone(), NameType::LocalVariable(id.clone()));
|
self.lexical_scopes.insert(name.clone(), NameType::LocalVariable(*id));
|
||||||
}
|
}
|
||||||
Recursion::Continue
|
Recursion::Continue
|
||||||
}
|
}
|
||||||
@ -306,12 +306,12 @@ impl<'a> ASTVisitor for ScopeResolver<'a> {
|
|||||||
let fqsn = Fqsn { scopes: vec![lscope, Scope::Name(local_name.clone())] };
|
let fqsn = Fqsn { scopes: vec![lscope, Scope::Name(local_name.clone())] };
|
||||||
//let local_name = fqsn.local_name();
|
//let local_name = fqsn.local_name();
|
||||||
self.symbol_table.add_symbol(id, fqsn, SymbolSpec::LocalVariable);
|
self.symbol_table.add_symbol(id, fqsn, SymbolSpec::LocalVariable);
|
||||||
self.lexical_scopes.insert(local_name, NameType::LocalVariable(id.clone()));
|
self.lexical_scopes.insert(local_name, NameType::LocalVariable(*id));
|
||||||
} else {
|
} else {
|
||||||
let fqsn = Fqsn { scopes: components.iter().map(|name| Scope::Name(name.clone())).collect() };
|
let fqsn = Fqsn { scopes: components.iter().map(|name| Scope::Name(name.clone())).collect() };
|
||||||
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
let symbol = self.symbol_table.fqsn_to_symbol.get(&fqsn);
|
||||||
if let Some(symbol) = symbol {
|
if let Some(symbol) = symbol {
|
||||||
self.symbol_table.id_to_symbol.insert(id.clone(), symbol.clone());
|
self.symbol_table.id_to_symbol.insert(*id, symbol.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -224,7 +224,7 @@ impl<'a> State<'a> {
|
|||||||
// This just checks that the function exists in "memory" by ID, we don't
|
// This just checks that the function exists in "memory" by ID, we don't
|
||||||
// actually retrieve it until `apply_function()`
|
// actually retrieve it until `apply_function()`
|
||||||
Some(MemoryValue::Function(_)) => {
|
Some(MemoryValue::Function(_)) => {
|
||||||
Primitive::Callable(Callable::UserDefined(id.clone()))
|
Primitive::Callable(Callable::UserDefined(*id))
|
||||||
}
|
}
|
||||||
x => return Err(format!("Function not found for id: {} : {:?}", id, x).into()),
|
x => return Err(format!("Function not found for id: {} : {:?}", id, x).into()),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user