mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
cleanup based on review
This commit is contained in:
parent
b075c2d394
commit
6ecb3b36d0
2 changed files with 1 additions and 80 deletions
|
@ -276,11 +276,6 @@ fn start_phase<'a>(module_id: ModuleId, phase: Phase, state: &mut State<'a>) ->
|
||||||
let module_ids = Arc::clone(&state.arc_modules);
|
let module_ids = Arc::clone(&state.arc_modules);
|
||||||
let module_ids = { (*module_ids).lock().clone() };
|
let module_ids = { (*module_ids).lock().clone() };
|
||||||
|
|
||||||
// debug_assert!(parse
|
|
||||||
// .imported_modules
|
|
||||||
// .iter()
|
|
||||||
// .all(|id| module_ids.get_name(*id).is_some()));
|
|
||||||
|
|
||||||
let exposed_symbols = state
|
let exposed_symbols = state
|
||||||
.exposed_symbols_by_module
|
.exposed_symbols_by_module
|
||||||
.remove(&module_id)
|
.remove(&module_id)
|
||||||
|
@ -312,63 +307,6 @@ fn start_phase<'a>(module_id: ModuleId, phase: Phase, state: &mut State<'a>) ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase::ParseAndGenerateConstraints => {
|
|
||||||
// let header = state.module_cache.headers.remove(&module_id).unwrap();
|
|
||||||
// let module_id = header.module_id;
|
|
||||||
// let deps_by_name = &header.deps_by_name;
|
|
||||||
// let num_deps = deps_by_name.len();
|
|
||||||
// let mut dep_idents: IdentIdsByModule = IdentIds::exposed_builtins(num_deps);
|
|
||||||
//
|
|
||||||
// let State {
|
|
||||||
// ident_ids_by_module,
|
|
||||||
// ..
|
|
||||||
// } = &state;
|
|
||||||
//
|
|
||||||
// {
|
|
||||||
// let ident_ids_by_module = (*ident_ids_by_module).lock();
|
|
||||||
//
|
|
||||||
// // Populate dep_idents with each of their IdentIds,
|
|
||||||
// // which we'll need during canonicalization to translate
|
|
||||||
// // identifier strings into IdentIds, which we need to build Symbols.
|
|
||||||
// // We only include the modules we care about (the ones we import).
|
|
||||||
// //
|
|
||||||
// // At the end of this loop, dep_idents contains all the information to
|
|
||||||
// // resolve a symbol from another module: if it's in here, that means
|
|
||||||
// // we have both imported the module and the ident was exported by that mdoule.
|
|
||||||
// for dep_id in header.deps_by_name.values() {
|
|
||||||
// // We already verified that these are all present,
|
|
||||||
// // so unwrapping should always succeed here.
|
|
||||||
// let idents = ident_ids_by_module.get(&dep_id).unwrap();
|
|
||||||
//
|
|
||||||
// dep_idents.insert(*dep_id, idents.clone());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Clone the module_ids we'll need for canonicalization.
|
|
||||||
// // This should be small, and cloning it should be quick.
|
|
||||||
// // We release the lock as soon as we're done cloning, so we don't have
|
|
||||||
// // to lock the global module_ids while canonicalizing any given module.
|
|
||||||
// let module_ids = Arc::clone(&state.arc_modules);
|
|
||||||
// let module_ids = { (*module_ids).lock().clone() };
|
|
||||||
//
|
|
||||||
// debug_assert!(header
|
|
||||||
// .imported_modules
|
|
||||||
// .iter()
|
|
||||||
// .all(|id| module_ids.get_name(*id).is_some()));
|
|
||||||
//
|
|
||||||
// let exposed_symbols = state
|
|
||||||
// .exposed_symbols_by_module
|
|
||||||
// .remove(&module_id)
|
|
||||||
// .expect("Could not find listener ID in exposed_symbols_by_module");
|
|
||||||
//
|
|
||||||
// BuildTask::ParseAndConstrain {
|
|
||||||
// header,
|
|
||||||
// mode: state.stdlib.mode,
|
|
||||||
// module_ids,
|
|
||||||
// dep_idents,
|
|
||||||
// exposed_symbols,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Phase::SolveTypes => {
|
Phase::SolveTypes => {
|
||||||
let constrained = state.module_cache.constrained.remove(&module_id).unwrap();
|
let constrained = state.module_cache.constrained.remove(&module_id).unwrap();
|
||||||
|
|
||||||
|
@ -564,18 +502,6 @@ enum Msg<'a> {
|
||||||
canonicalization_problems: Vec<roc_problem::can::Problem>,
|
canonicalization_problems: Vec<roc_problem::can::Problem>,
|
||||||
module_docs: ModuleDocumentation,
|
module_docs: ModuleDocumentation,
|
||||||
},
|
},
|
||||||
// Constrained {
|
|
||||||
// module: Module,
|
|
||||||
// declarations: Vec<Declaration>,
|
|
||||||
// imported_modules: MutSet<ModuleId>,
|
|
||||||
// src: &'a str,
|
|
||||||
// constraint: Constraint,
|
|
||||||
// ident_ids: IdentIds,
|
|
||||||
// problems: Vec<roc_problem::can::Problem>,
|
|
||||||
// var_store: VarStore,
|
|
||||||
// module_timing: ModuleTiming,
|
|
||||||
// module_docs: ModuleDocumentation,
|
|
||||||
// },
|
|
||||||
SolvedTypes {
|
SolvedTypes {
|
||||||
src: &'a str,
|
src: &'a str,
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
|
|
|
@ -826,9 +826,6 @@ fn unify_shared_tags(
|
||||||
let mut problems = Vec::new();
|
let mut problems = Vec::new();
|
||||||
|
|
||||||
{
|
{
|
||||||
// we always unify NonRecursive with Recursive, so this should never happen
|
|
||||||
//debug_assert_ne!(Some(actual), recursion_var);
|
|
||||||
|
|
||||||
problems.extend(unify_pool(subs, pool, actual, expected));
|
problems.extend(unify_pool(subs, pool, actual, expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,9 +1148,7 @@ fn unify_recursion(
|
||||||
}
|
}
|
||||||
|
|
||||||
Structure(_) => {
|
Structure(_) => {
|
||||||
// keep the recursion var around
|
// unify the structure variable with this Structure
|
||||||
// merge(subs, ctx, FlexVar(opt_name.clone()))
|
|
||||||
|
|
||||||
unify_pool(subs, pool, structure, ctx.second)
|
unify_pool(subs, pool, structure, ctx.second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue