chore: avoid cloning name
This commit is contained in:
parent
55f89a7ff4
commit
e8bcbecf31
|
@ -782,21 +782,18 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check to see if it's a Type that can have accessible fields
|
// Check to see if it's a Type that can have accessible fields
|
||||||
let (accessors, name) = match collapse_links(record.tipo()).as_ref() {
|
let accessors = match collapse_links(record.tipo()).as_ref() {
|
||||||
// A type in the current module which may have fields
|
// A type in the current module which may have fields
|
||||||
Type::App { module, name, .. } if module == self.environment.current_module => self
|
Type::App { module, name, .. } if module == self.environment.current_module => {
|
||||||
.environment
|
self.environment.accessors.get(name)
|
||||||
.accessors
|
}
|
||||||
.get(name)
|
|
||||||
.map(|t| (t, name.clone())),
|
|
||||||
|
|
||||||
// A type in another module which may have fields
|
// A type in another module which may have fields
|
||||||
Type::App { module, name, .. } => self
|
Type::App { module, name, .. } => self
|
||||||
.environment
|
.environment
|
||||||
.importable_modules
|
.importable_modules
|
||||||
.get(module)
|
.get(module)
|
||||||
.and_then(|module| module.accessors.get(name))
|
.and_then(|module| module.accessors.get(name)),
|
||||||
.map(|accessors| (accessors, name.clone())),
|
|
||||||
|
|
||||||
_something_without_fields => return Err(unknown_field(vec![])),
|
_something_without_fields => return Err(unknown_field(vec![])),
|
||||||
}
|
}
|
||||||
|
@ -829,7 +826,9 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
||||||
false,
|
false,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
self.environment.increment_usage(&name);
|
if let Type::App { name, .. } = record.tipo().as_ref() {
|
||||||
|
self.environment.increment_usage(name);
|
||||||
|
};
|
||||||
|
|
||||||
Ok(TypedExpr::RecordAccess {
|
Ok(TypedExpr::RecordAccess {
|
||||||
record,
|
record,
|
||||||
|
|
Loading…
Reference in New Issue