mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Use a shared env for desugaring and the rest of canonicalization
This refactor simplifies the desugar pass by reducing the number of arguments threaded through each recursive function call. - Add the module src string to `Env`. - Add `line_info` to `Env` as a lazy-evaled function. - Refactor desugar functions to take the `can::Env` struct in place of a number of params. This is mostly a find-and-replace, but in a few places `Vec::from_iter_in` was changed to `Vec::with_capacity_in` followed by a `for` loop in order to avoid lifetime issues. - Remove unnecessary linter annotations for `clippy::too_many_arguments`
This commit is contained in:
parent
640bd15ca1
commit
b515bfa77e
6 changed files with 349 additions and 880 deletions
|
@ -240,6 +240,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
);
|
||||
let mut env = Env::new(
|
||||
arena,
|
||||
src,
|
||||
home,
|
||||
arena.alloc(Path::new(module_path)),
|
||||
dep_idents,
|
||||
|
@ -266,16 +267,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
// operators, and then again on *their* nested operators, ultimately applying the
|
||||
// rules multiple times unnecessarily.
|
||||
|
||||
crate::desugar::desugar_defs_node_values(
|
||||
arena,
|
||||
&mut scope,
|
||||
loc_defs,
|
||||
src,
|
||||
&mut None,
|
||||
module_path,
|
||||
true,
|
||||
&mut env.problems,
|
||||
);
|
||||
crate::desugar::desugar_defs_node_values(&mut env, &mut scope, loc_defs, true);
|
||||
|
||||
let mut rigid_variables = RigidVariables::default();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue