mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
use set_content_unchecked; replace modify with a single set
This commit is contained in:
parent
f1e1c45f2f
commit
8c44661bc2
2 changed files with 16 additions and 21 deletions
|
@ -3028,13 +3028,7 @@ fn deep_copy_var_in(
|
|||
// we have tracked all visited variables, and can now traverse them
|
||||
// in one go (without looking at the UnificationTable) and clear the copy field
|
||||
for var in visited {
|
||||
subs.modify(var, |descriptor| {
|
||||
if descriptor.copy.is_some() {
|
||||
descriptor.rank = Rank::NONE;
|
||||
descriptor.mark = Mark::NONE;
|
||||
descriptor.copy = OptVariable::NONE;
|
||||
}
|
||||
});
|
||||
subs.set_copy_unchecked(var, OptVariable::NONE);
|
||||
}
|
||||
|
||||
copy
|
||||
|
@ -3198,7 +3192,7 @@ fn deep_copy_var_help(
|
|||
}
|
||||
};
|
||||
|
||||
subs.set(copy, make_descriptor(Structure(new_flat_type)));
|
||||
subs.set_content_unchecked(copy, Structure(new_flat_type));
|
||||
|
||||
copy
|
||||
}
|
||||
|
@ -3211,25 +3205,24 @@ fn deep_copy_var_help(
|
|||
} => {
|
||||
let new_structure = deep_copy_var_help(subs, max_rank, pools, visited, structure);
|
||||
|
||||
subs.set(
|
||||
copy,
|
||||
make_descriptor(RecursionVar {
|
||||
opt_name,
|
||||
structure: new_structure,
|
||||
}),
|
||||
);
|
||||
let content = RecursionVar {
|
||||
opt_name,
|
||||
structure: new_structure,
|
||||
};
|
||||
|
||||
subs.set_content_unchecked(copy, content);
|
||||
|
||||
copy
|
||||
}
|
||||
|
||||
RigidVar(name) => {
|
||||
subs.set(copy, make_descriptor(FlexVar(Some(name))));
|
||||
subs.set_content_unchecked(copy, FlexVar(Some(name)));
|
||||
|
||||
copy
|
||||
}
|
||||
|
||||
RigidAbleVar(name, ability) => {
|
||||
subs.set(copy, make_descriptor(FlexAbleVar(Some(name), ability)));
|
||||
subs.set_content_unchecked(copy, FlexAbleVar(Some(name), ability));
|
||||
|
||||
copy
|
||||
}
|
||||
|
@ -3247,7 +3240,7 @@ fn deep_copy_var_help(
|
|||
deep_copy_var_help(subs, max_rank, pools, visited, real_type_var);
|
||||
let new_content = Alias(symbol, new_arguments, new_real_type_var, kind);
|
||||
|
||||
subs.set(copy, make_descriptor(new_content));
|
||||
subs.set_content_unchecked(copy, new_content);
|
||||
|
||||
copy
|
||||
}
|
||||
|
@ -3259,7 +3252,7 @@ fn deep_copy_var_help(
|
|||
|
||||
let new_content = RangedNumber(new_type_var, new_variables);
|
||||
|
||||
subs.set(copy, make_descriptor(new_content));
|
||||
subs.set_content_unchecked(copy, new_content);
|
||||
|
||||
copy
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue