mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Propagate multiple entrypoints to alias analysis
This commit is contained in:
parent
236cebacc1
commit
8b463686bc
10 changed files with 282 additions and 352 deletions
|
@ -11,7 +11,7 @@ use roc_module::symbol::Symbol;
|
|||
|
||||
use roc_mono::ir::{
|
||||
Call, CallType, Expr, HigherOrderLowLevel, HostExposedLayouts, ListLiteralElement, Literal,
|
||||
ModifyRc, OptLevel, Proc, Stmt,
|
||||
ModifyRc, OptLevel, Proc, ProcLayout, Stmt,
|
||||
};
|
||||
use roc_mono::layout::{
|
||||
Builtin, CapturesNiche, Layout, RawFunctionLayout, STLayoutInterner, UnionLayout,
|
||||
|
@ -136,12 +136,15 @@ pub fn spec_program<'a, I>(
|
|||
arena: &'a Bump,
|
||||
interner: &STLayoutInterner<'a>,
|
||||
opt_level: OptLevel,
|
||||
opt_entry_point: Option<roc_mono::ir::EntryPoint<'a>>,
|
||||
entry_points: &'a [(Symbol, ProcLayout<'a>)],
|
||||
procs: I,
|
||||
) -> Result<morphic_lib::Solutions>
|
||||
where
|
||||
I: Iterator<Item = &'a Proc<'a>>,
|
||||
{
|
||||
// TODO support multiple entry points here!
|
||||
let opt_entry_point = entry_points.first();
|
||||
|
||||
let main_module = {
|
||||
let mut m = ModDefBuilder::new();
|
||||
|
||||
|
@ -226,13 +229,13 @@ where
|
|||
m.add_func(func_name, spec)?;
|
||||
}
|
||||
|
||||
if let Some(entry_point) = opt_entry_point {
|
||||
if let Some((symbol, proc_layout)) = opt_entry_point {
|
||||
// the entry point wrapper
|
||||
let roc_main_bytes = func_name_bytes_help(
|
||||
entry_point.symbol,
|
||||
entry_point.layout.arguments.iter().copied(),
|
||||
*symbol,
|
||||
proc_layout.arguments.iter().copied(),
|
||||
CapturesNiche::no_niche(),
|
||||
&entry_point.layout.result,
|
||||
&proc_layout.result,
|
||||
);
|
||||
let roc_main = FuncName(&roc_main_bytes);
|
||||
|
||||
|
@ -241,7 +244,7 @@ where
|
|||
let entry_point_function = build_entry_point(
|
||||
&mut env,
|
||||
interner,
|
||||
entry_point.layout,
|
||||
*proc_layout,
|
||||
roc_main,
|
||||
&host_exposed_functions,
|
||||
)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue