mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
search imports first; they are likely to be small, andl likely to contain used types
This commit is contained in:
parent
c3ef37d1bd
commit
15f860e6d7
1 changed files with 4 additions and 11 deletions
|
@ -171,17 +171,10 @@ impl Scope {
|
|||
|
||||
/// Is an identifier in scope, either in the locals or imports
|
||||
fn scope_contains_ident(&self, ident: &Ident) -> ContainsIdent {
|
||||
let result = self.locals.contains_ident(ident);
|
||||
match result {
|
||||
ContainsIdent::InScope(_, _) => result,
|
||||
ContainsIdent::NotInScope(_) => match self.has_imported(ident) {
|
||||
Some((symbol, region)) => ContainsIdent::InScope(symbol, region),
|
||||
None => result,
|
||||
},
|
||||
ContainsIdent::NotPresent => match self.has_imported(ident) {
|
||||
Some((symbol, region)) => ContainsIdent::InScope(symbol, region),
|
||||
None => ContainsIdent::NotPresent,
|
||||
},
|
||||
// exposed imports are likely to be small
|
||||
match self.has_imported(ident) {
|
||||
Some((symbol, region)) => ContainsIdent::InScope(symbol, region),
|
||||
None => self.locals.contains_ident(ident),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue