mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
remove clones in IntroducedVariables clone
This commit is contained in:
parent
4e315797b0
commit
ce4f47d2e9
2 changed files with 13 additions and 1 deletions
|
@ -80,6 +80,17 @@ impl IntroducedVariables {
|
||||||
self.named.dedup_by(|nv1, nv2| nv1.name == nv2.name);
|
self.named.dedup_by(|nv1, nv2| nv1.name == nv2.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn union_owned(&mut self, other: Self) {
|
||||||
|
self.wildcards.extend(other.wildcards);
|
||||||
|
self.lambda_sets.extend(other.lambda_sets);
|
||||||
|
self.inferred.extend(other.inferred);
|
||||||
|
self.host_exposed_aliases.extend(other.host_exposed_aliases);
|
||||||
|
|
||||||
|
self.named.extend(other.named);
|
||||||
|
self.named.sort_by(|nv1, nv2| nv1.name.cmp(&nv2.name));
|
||||||
|
self.named.dedup_by(|nv1, nv2| nv1.name == nv2.name);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn var_by_name(&self, name: &Lowercase) -> Option<&Variable> {
|
pub fn var_by_name(&self, name: &Lowercase) -> Option<&Variable> {
|
||||||
self.named
|
self.named
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -40,7 +40,8 @@ impl Output {
|
||||||
self.tail_call = Some(later);
|
self.tail_call = Some(later);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.introduced_variables.union(&other.introduced_variables);
|
self.introduced_variables
|
||||||
|
.union_owned(other.introduced_variables);
|
||||||
self.aliases.extend(other.aliases);
|
self.aliases.extend(other.aliases);
|
||||||
self.non_closures.extend(other.non_closures);
|
self.non_closures.extend(other.non_closures);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue