mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Merge remote-tracking branch 'remote/main' into rebuild-platform
This commit is contained in:
commit
de9491eb7f
24 changed files with 361 additions and 140 deletions
|
@ -51,7 +51,7 @@ use roc_parse::ast::{self, CommentOrNewline, ExtractSpaces, Spaced, ValueDef};
|
|||
use roc_parse::header::parse_module_defs;
|
||||
use roc_parse::header::{
|
||||
self, AppHeader, ExposedName, HeaderType, ImportsKeywordItem, PackageEntry, PackageHeader,
|
||||
PlatformHeader, To, TypedIdent,
|
||||
PlatformHeader, To,
|
||||
};
|
||||
use roc_parse::parser::{FileError, SourceError, SyntaxError};
|
||||
use roc_problem::Severity;
|
||||
|
@ -667,7 +667,7 @@ enum PlatformPath<'a> {
|
|||
#[derive(Debug)]
|
||||
struct PlatformData<'a> {
|
||||
module_id: ModuleId,
|
||||
provides: &'a [(Loc<ExposedName<'a>>, Loc<TypedIdent<'a>>)],
|
||||
provides: &'a [Loc<ExposedName<'a>>],
|
||||
is_prebuilt: bool,
|
||||
}
|
||||
|
||||
|
@ -3171,7 +3171,7 @@ fn finish_specialization<'a>(
|
|||
let proc_layout =
|
||||
proc_layout_for(state.procedures.keys().copied(), symbol);
|
||||
|
||||
buf.push((symbol, proc_layout));
|
||||
buf.push(("", symbol, proc_layout));
|
||||
}
|
||||
|
||||
buf.into_bump_slice()
|
||||
|
@ -3185,13 +3185,14 @@ fn finish_specialization<'a>(
|
|||
let mut buf =
|
||||
bumpalo::collections::Vec::with_capacity_in(provides.len(), arena);
|
||||
|
||||
for (loc_name, _loc_typed_ident) in provides {
|
||||
let ident_id = ident_ids.get_or_insert(loc_name.value.as_str());
|
||||
for loc_name in provides {
|
||||
let fn_name = loc_name.value.as_str();
|
||||
let ident_id = ident_ids.get_or_insert(fn_name);
|
||||
let symbol = Symbol::new(module_id, ident_id);
|
||||
let proc_layout =
|
||||
proc_layout_for(state.procedures.keys().copied(), symbol);
|
||||
|
||||
buf.push((symbol, proc_layout));
|
||||
buf.push((fn_name, symbol, proc_layout));
|
||||
}
|
||||
|
||||
buf.into_bump_slice()
|
||||
|
@ -4987,15 +4988,16 @@ fn build_platform_header<'a>(
|
|||
comments: &'a [CommentOrNewline<'a>],
|
||||
module_timing: ModuleTiming,
|
||||
) -> Result<(ModuleId, PQModuleName<'a>, ModuleHeader<'a>), LoadingProblem<'a>> {
|
||||
let requires = arena.alloc([Loc::at(
|
||||
header.requires.item.signature.region,
|
||||
header.requires.item.signature.extract_spaces().item,
|
||||
)]);
|
||||
let requires = header
|
||||
.requires
|
||||
.item
|
||||
.signatures
|
||||
.map_items(arena, |item| {
|
||||
Loc::at(item.region, item.extract_spaces().item)
|
||||
})
|
||||
.items;
|
||||
let provides = bumpalo::collections::Vec::from_iter_in(
|
||||
unspace(arena, header.provides.item.items)
|
||||
.iter()
|
||||
.copied()
|
||||
.zip(requires.iter().copied()),
|
||||
unspace(arena, header.provides.item.items).iter().copied(),
|
||||
arena,
|
||||
);
|
||||
let packages = unspace(arena, header.packages.item.items);
|
||||
|
@ -5447,7 +5449,7 @@ fn parse<'a>(
|
|||
if let HeaderType::Platform { provides, .. } = header.header_type {
|
||||
exposed.reserve(provides.len());
|
||||
|
||||
for (loc_name, _loc_typed_ident) in provides.iter() {
|
||||
for loc_name in provides.iter() {
|
||||
// Use get_or_insert here because the ident_ids may already
|
||||
// created an IdentId for this, when it was imported exposed
|
||||
// in a dependent module.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue