mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
give back the subs of the root module (for the repl)
This commit is contained in:
parent
9d966d439f
commit
a15ff20eec
1 changed files with 16 additions and 0 deletions
|
@ -633,6 +633,7 @@ struct PlatformData {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct State<'a> {
|
struct State<'a> {
|
||||||
pub root_id: ModuleId,
|
pub root_id: ModuleId,
|
||||||
|
pub root_subs: Option<Subs>,
|
||||||
pub platform_data: Option<PlatformData>,
|
pub platform_data: Option<PlatformData>,
|
||||||
pub goal_phase: Phase,
|
pub goal_phase: Phase,
|
||||||
pub exposed_types: ExposedByModule,
|
pub exposed_types: ExposedByModule,
|
||||||
|
@ -688,6 +689,7 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
root_id,
|
root_id,
|
||||||
|
root_subs: None,
|
||||||
target_info,
|
target_info,
|
||||||
platform_data: None,
|
platform_data: None,
|
||||||
goal_phase,
|
goal_phase,
|
||||||
|
@ -2153,6 +2155,14 @@ fn update<'a>(
|
||||||
existing.push(requested);
|
existing.push(requested);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use the subs of the root module;
|
||||||
|
// this is used in the repl to find the type of `main`
|
||||||
|
let subs = if module_id == state.root_id {
|
||||||
|
subs
|
||||||
|
} else {
|
||||||
|
state.root_subs.clone().unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
msg_tx
|
msg_tx
|
||||||
.send(Msg::FinishedAllSpecialization {
|
.send(Msg::FinishedAllSpecialization {
|
||||||
subs,
|
subs,
|
||||||
|
@ -2165,6 +2175,12 @@ fn update<'a>(
|
||||||
// the originally requested module, we're all done!
|
// the originally requested module, we're all done!
|
||||||
return Ok(state);
|
return Ok(state);
|
||||||
} else {
|
} else {
|
||||||
|
// record the subs of the root module;
|
||||||
|
// this is used in the repl to find the type of `main`
|
||||||
|
if module_id == state.root_id {
|
||||||
|
state.root_subs = Some(subs);
|
||||||
|
}
|
||||||
|
|
||||||
state.constrained_ident_ids.insert(module_id, ident_ids);
|
state.constrained_ident_ids.insert(module_id, ident_ids);
|
||||||
|
|
||||||
for (module_id, requested) in external_specializations_requested {
|
for (module_id, requested) in external_specializations_requested {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue