mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
wip
This commit is contained in:
parent
c5037e7311
commit
a0e450cadd
2 changed files with 103 additions and 29 deletions
|
@ -2979,33 +2979,21 @@ fn finish_specialization<'a>(
|
|||
};
|
||||
|
||||
let platform_path = Path::new(path_to_platform).into();
|
||||
let symbol = match platform_data {
|
||||
let provides = match platform_data {
|
||||
None => {
|
||||
debug_assert_eq!(exposed_to_host.values.len(), 1);
|
||||
|
||||
*exposed_to_host.values.iter().next().unwrap().0
|
||||
}
|
||||
Some(PlatformData { provides, .. }) => provides,
|
||||
};
|
||||
|
||||
match procedures.keys().find(|(s, _)| *s == symbol) {
|
||||
Some((_, layout)) => EntryPoint::Executable {
|
||||
layout: *layout,
|
||||
symbol,
|
||||
platform_path,
|
||||
},
|
||||
None => {
|
||||
// the entry point is not specialized. This can happen if the repl output
|
||||
// is a function value
|
||||
EntryPoint::Executable {
|
||||
layout: roc_mono::ir::ProcLayout {
|
||||
arguments: &[],
|
||||
result: Layout::struct_no_name_order(&[]),
|
||||
captures_niche: CapturesNiche::no_niche(),
|
||||
},
|
||||
symbol,
|
||||
platform_path,
|
||||
}
|
||||
}
|
||||
let layout = get_exe_entry_point(provides, &procedures);
|
||||
|
||||
EntryPoint::Executable {
|
||||
layout,
|
||||
symbol: provides,
|
||||
platform_path,
|
||||
}
|
||||
}
|
||||
ExecutionMode::Check => unreachable!(),
|
||||
|
@ -3062,6 +3050,25 @@ fn finish_specialization<'a>(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get_exe_entry_point<'a>(
|
||||
provides: Symbol,
|
||||
procedures: &MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||
) -> ProcLayout<'a> {
|
||||
match procedures.keys().find(|(s, _)| *s == provides) {
|
||||
Some((_, layout)) => *layout,
|
||||
None =>
|
||||
// the entry point is not specialized. This can happen if the repl output
|
||||
// is a function value
|
||||
{
|
||||
ProcLayout {
|
||||
arguments: &[],
|
||||
result: Layout::struct_no_name_order(&[]),
|
||||
captures_niche: CapturesNiche::no_niche(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn finish(
|
||||
mut state: State,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue