mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
halve the number of lookups into References
This commit is contained in:
parent
b557929276
commit
9d17a075d9
4 changed files with 5 additions and 9 deletions
|
@ -1594,8 +1594,7 @@ pub fn can_defs_with_return<'a>(
|
|||
// Now that we've collected all the references, check to see if any of the new idents
|
||||
// we defined went unused by the return expression. If any were unused, report it.
|
||||
for (symbol, region) in symbols_introduced {
|
||||
if !output.references.has_value_lookup(symbol)
|
||||
&& !output.references.has_type_lookup(symbol)
|
||||
if !output.references.has_type_or_value_lookup(symbol)
|
||||
&& !scope.abilities_store.is_specialization_name(symbol)
|
||||
{
|
||||
env.problem(Problem::UnusedDef(symbol, region));
|
||||
|
|
|
@ -1072,10 +1072,8 @@ fn canonicalize_when_branch<'a>(
|
|||
for (symbol, region) in scope.symbols() {
|
||||
let symbol = *symbol;
|
||||
|
||||
if !output.references.has_value_lookup(symbol)
|
||||
&& !output.references.has_type_lookup(symbol)
|
||||
&& !branch_output.references.has_value_lookup(symbol)
|
||||
&& !branch_output.references.has_type_lookup(symbol)
|
||||
if !output.references.has_type_or_value_lookup(symbol)
|
||||
&& !branch_output.references.has_type_or_value_lookup(symbol)
|
||||
&& !original_scope.contains_symbol(symbol)
|
||||
&& !scope.abilities_store.is_specialization_name(symbol)
|
||||
{
|
||||
|
|
|
@ -302,8 +302,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
// See if any of the new idents we defined went unused.
|
||||
// If any were unused and also not exposed, report it.
|
||||
for (symbol, region) in symbols_introduced {
|
||||
if !output.references.has_value_lookup(symbol)
|
||||
&& !output.references.has_type_lookup(symbol)
|
||||
if !output.references.has_type_or_value_lookup(symbol)
|
||||
&& !exposed_symbols.contains(&symbol)
|
||||
&& !scope.abilities_store.is_specialization_name(symbol)
|
||||
{
|
||||
|
|
|
@ -153,7 +153,7 @@ impl References {
|
|||
false
|
||||
}
|
||||
|
||||
pub fn has_type_lookup(&self, symbol: Symbol) -> bool {
|
||||
fn has_type_lookup(&self, symbol: Symbol) -> bool {
|
||||
let it = self.symbols.iter().zip(self.bitflags.iter());
|
||||
|
||||
for (a, b) in it {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue