mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
feat: put all exposes from platform in package module ids
This commit is contained in:
parent
654a018106
commit
f527afe9fd
1 changed files with 23 additions and 1 deletions
|
@ -829,6 +829,7 @@ enum BuildTask<'a> {
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
},
|
},
|
||||||
LoadPkgConfig {
|
LoadPkgConfig {
|
||||||
|
shorthand: &'a str,
|
||||||
module_ids: Arc<Mutex<ModuleIds>>,
|
module_ids: Arc<Mutex<ModuleIds>>,
|
||||||
package_module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
package_module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
||||||
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
||||||
|
@ -1859,8 +1860,9 @@ fn finish<'a>(
|
||||||
fn load_pkg_config<'a>(
|
fn load_pkg_config<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
src_dir: &Path,
|
src_dir: &Path,
|
||||||
|
shorthand: &'a str,
|
||||||
module_ids: Arc<Mutex<ModuleIds>>,
|
module_ids: Arc<Mutex<ModuleIds>>,
|
||||||
package_module_ids: Arc<Mutex<PackageModuleIds>>,
|
package_module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
||||||
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
) -> Result<Msg<'a>, LoadingProblem> {
|
) -> Result<Msg<'a>, LoadingProblem> {
|
||||||
|
@ -1906,7 +1908,9 @@ fn load_pkg_config<'a>(
|
||||||
}
|
}
|
||||||
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
|
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
|
||||||
arena,
|
arena,
|
||||||
|
shorthand,
|
||||||
module_ids,
|
module_ids,
|
||||||
|
package_module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
mode,
|
mode,
|
||||||
header,
|
header,
|
||||||
|
@ -2078,6 +2082,7 @@ fn parse_header<'a>(
|
||||||
let load_pkg_config_msg = load_pkg_config(
|
let load_pkg_config_msg = load_pkg_config(
|
||||||
arena,
|
arena,
|
||||||
&pkg_config_dir,
|
&pkg_config_dir,
|
||||||
|
shorthand,
|
||||||
module_ids,
|
module_ids,
|
||||||
package_module_ids,
|
package_module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
|
@ -2117,7 +2122,9 @@ fn parse_header<'a>(
|
||||||
}
|
}
|
||||||
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
|
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
|
||||||
arena,
|
arena,
|
||||||
|
&"",
|
||||||
module_ids,
|
module_ids,
|
||||||
|
package_module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
mode,
|
mode,
|
||||||
header,
|
header,
|
||||||
|
@ -2470,7 +2477,9 @@ fn run_solve<'a>(
|
||||||
|
|
||||||
fn fabricate_effects_module<'a>(
|
fn fabricate_effects_module<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
|
shorthand: &'a str,
|
||||||
module_ids: Arc<Mutex<ModuleIds>>,
|
module_ids: Arc<Mutex<ModuleIds>>,
|
||||||
|
package_module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
||||||
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
header: PlatformHeader<'a>,
|
header: PlatformHeader<'a>,
|
||||||
|
@ -2496,6 +2505,17 @@ fn fabricate_effects_module<'a>(
|
||||||
functions
|
functions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut package_module_ids = (*package_module_ids).lock();
|
||||||
|
|
||||||
|
for exposed in header.exposes {
|
||||||
|
match exposed.value {
|
||||||
|
ExposesEntry::Exposed(module_name) => {
|
||||||
|
package_module_ids.get_or_insert(&(shorthand, module_name.into()));
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let exposed_ident_ids = {
|
let exposed_ident_ids = {
|
||||||
// Lock just long enough to perform the minimal operations necessary.
|
// Lock just long enough to perform the minimal operations necessary.
|
||||||
let mut module_ids = (*module_ids).lock();
|
let mut module_ids = (*module_ids).lock();
|
||||||
|
@ -3202,6 +3222,7 @@ fn run_task<'a>(
|
||||||
)
|
)
|
||||||
.map(|(_, msg)| msg),
|
.map(|(_, msg)| msg),
|
||||||
LoadPkgConfig {
|
LoadPkgConfig {
|
||||||
|
shorthand,
|
||||||
module_ids,
|
module_ids,
|
||||||
package_module_ids,
|
package_module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
|
@ -3209,6 +3230,7 @@ fn run_task<'a>(
|
||||||
} => load_pkg_config(
|
} => load_pkg_config(
|
||||||
arena,
|
arena,
|
||||||
src_dir,
|
src_dir,
|
||||||
|
shorthand,
|
||||||
module_ids,
|
module_ids,
|
||||||
package_module_ids,
|
package_module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue