mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
simplify GeneratedInfo
This commit is contained in:
parent
c93805ea87
commit
c9b29c773f
1 changed files with 9 additions and 12 deletions
|
@ -75,19 +75,17 @@ fn validate_generate_with<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum GeneratedInfo<'a> {
|
enum GeneratedInfo {
|
||||||
Hosted {
|
Hosted {
|
||||||
effect_symbol: Symbol,
|
effect_symbol: Symbol,
|
||||||
generated_functions: HostedGeneratedFunctions,
|
generated_functions: HostedGeneratedFunctions,
|
||||||
},
|
},
|
||||||
Builtin {
|
Builtin,
|
||||||
generated_functions: &'a [Symbol],
|
|
||||||
},
|
|
||||||
NotSpecial,
|
NotSpecial,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GeneratedInfo<'a> {
|
impl GeneratedInfo {
|
||||||
fn from_header_for(
|
fn from_header_for<'a>(
|
||||||
env: &mut Env,
|
env: &mut Env,
|
||||||
scope: &mut Scope,
|
scope: &mut Scope,
|
||||||
var_store: &mut VarStore,
|
var_store: &mut VarStore,
|
||||||
|
@ -140,9 +138,10 @@ impl<'a> GeneratedInfo<'a> {
|
||||||
generated_functions,
|
generated_functions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HeaderFor::Builtin { generates_with } => GeneratedInfo::Builtin {
|
HeaderFor::Builtin { generates_with } => {
|
||||||
generated_functions: generates_with,
|
debug_assert!(generates_with.is_empty());
|
||||||
},
|
GeneratedInfo::Builtin
|
||||||
|
}
|
||||||
_ => GeneratedInfo::NotSpecial,
|
_ => GeneratedInfo::NotSpecial,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,9 +394,7 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
// we just assume they are hosted functions (meant to be provided by the platform)
|
// we just assume they are hosted functions (meant to be provided by the platform)
|
||||||
if has_no_implementation(&def.loc_expr.value) {
|
if has_no_implementation(&def.loc_expr.value) {
|
||||||
match generated_info {
|
match generated_info {
|
||||||
GeneratedInfo::Builtin {
|
GeneratedInfo::Builtin => {
|
||||||
generated_functions: _,
|
|
||||||
} => {
|
|
||||||
let symbol = def.pattern_vars.iter().next().unwrap().0;
|
let symbol = def.pattern_vars.iter().next().unwrap().0;
|
||||||
match crate::builtins::builtin_defs_map(*symbol, var_store) {
|
match crate::builtins::builtin_defs_map(*symbol, var_store) {
|
||||||
None => {
|
None => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue