Skip to content

Commit

Permalink
perf(vm/translate): Hoist a remove_alias call outside the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed Jan 7, 2019
1 parent bfbab7f commit 37fe876
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vm/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@ impl<'a, 'e> PatternTranslator<'a, 'e> {
ref fields,
..
} => {
let typ = remove_aliases_cow(&self.0.env, typ);
for (i, field) in fields.iter().enumerate() {
if !add_duplicate_ident(
&mut replacements,
Expand All @@ -1549,7 +1550,7 @@ impl<'a, 'e> PatternTranslator<'a, 'e> {
.value
.as_ref()
.map(|pattern| self.extract_ident(i, &pattern.value).name);
let field_type = remove_aliases_cow(&self.0.env, typ)
let field_type = typ
.row_iter()
.find(|f| f.name.name_eq(&field.name.value))
.map(|f| f.typ.clone())
Expand Down

0 comments on commit 37fe876

Please sign in to comment.