mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
remove another result wrapper
This commit is contained in:
parent
d5b010cb13
commit
2e9477e011
2 changed files with 296 additions and 313 deletions
|
@ -170,7 +170,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
exposed_symbols: &VecSet<Symbol>,
|
||||
symbols_from_requires: &[(Loc<Symbol>, Loc<TypeAnnotation<'a>>)],
|
||||
var_store: &mut VarStore,
|
||||
) -> Result<ModuleOutput, RuntimeError> {
|
||||
) -> ModuleOutput {
|
||||
let mut can_exposed_imports = MutMap::default();
|
||||
let mut scope = Scope::new(home, exposed_ident_ids);
|
||||
let mut env = Env::new(home, dep_idents, module_ids);
|
||||
|
@ -351,9 +351,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
match sort_can_defs(&mut env, defs, new_output) {
|
||||
(mut declarations, mut output) => {
|
||||
use crate::def::Declaration::*;
|
||||
let (mut declarations, mut output) = sort_can_defs(&mut env, defs, new_output);
|
||||
|
||||
let symbols_from_requires = symbols_from_requires
|
||||
.iter()
|
||||
|
@ -401,6 +399,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
);
|
||||
}
|
||||
|
||||
use crate::def::Declaration::*;
|
||||
for decl in declarations.iter_mut() {
|
||||
match decl {
|
||||
Declare(def) => {
|
||||
|
@ -560,14 +559,12 @@ pub fn canonicalize_module_defs<'a>(
|
|||
for declaration in declarations.iter_mut() {
|
||||
match declaration {
|
||||
Declare(def) => fix_values_captured_in_closure_def(def, &mut VecSet::default()),
|
||||
DeclareRec(defs) => {
|
||||
fix_values_captured_in_closure_defs(defs, &mut VecSet::default())
|
||||
}
|
||||
DeclareRec(defs) => fix_values_captured_in_closure_defs(defs, &mut VecSet::default()),
|
||||
InvalidCycle(_) | Builtin(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
let output = ModuleOutput {
|
||||
ModuleOutput {
|
||||
scope,
|
||||
aliases,
|
||||
rigid_variables,
|
||||
|
@ -578,10 +575,6 @@ pub fn canonicalize_module_defs<'a>(
|
|||
problems: env.problems,
|
||||
symbols_from_requires,
|
||||
lookups,
|
||||
};
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3873,7 +3873,7 @@ fn canonicalize_and_constrain<'a>(
|
|||
let before = roc_types::types::get_type_clone_count();
|
||||
|
||||
let mut var_store = VarStore::default();
|
||||
let canonicalized = canonicalize_module_defs(
|
||||
let module_output = canonicalize_module_defs(
|
||||
arena,
|
||||
parsed_defs,
|
||||
&header_for,
|
||||
|
@ -3902,8 +3902,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
|
||||
module_timing.canonicalize = canonicalize_end.duration_since(canonicalize_start).unwrap();
|
||||
|
||||
match canonicalized {
|
||||
Ok(module_output) => {
|
||||
// Generate documentation information
|
||||
// TODO: store timing information?
|
||||
let module_docs = match module_name {
|
||||
|
@ -3995,14 +3993,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
module_docs,
|
||||
})
|
||||
}
|
||||
Err(runtime_error) => {
|
||||
panic!(
|
||||
"TODO gracefully handle module canonicalization error {:?}",
|
||||
runtime_error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse<'a>(arena: &'a Bump, header: ModuleHeader<'a>) -> Result<Msg<'a>, LoadingProblem<'a>> {
|
||||
let mut module_timing = header.module_timing;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue