Merge branch 'refactor-platform-info' into packages

This commit is contained in:
Richard Feldman 2022-12-11 03:42:24 -05:00
commit 3227f95d45
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
137 changed files with 6178 additions and 2855 deletions

View file

@ -4,34 +4,40 @@ use crate::ident::{lowercase_ident, UppercaseIdent};
use crate::parser::{optional, then};
use crate::parser::{specialize, word1, EPackageEntry, EPackageName, Parser};
use crate::string_literal;
use roc_module::symbol::Symbol;
use roc_module::symbol::{ModuleId, Symbol};
use roc_region::all::Loc;
use std::fmt::Debug;
#[derive(Debug)]
pub enum HeaderFor<'a> {
pub enum HeaderType<'a> {
App {
output_name: StrLiteral<'a>,
to_platform: To<'a>,
},
Hosted {
name: ModuleName<'a>,
generates: UppercaseIdent<'a>,
generates_with: &'a [Loc<ExposedName<'a>>],
},
/// Only created during canonicalization, never actually parsed from source
Builtin {
name: ModuleName<'a>,
generates_with: &'a [Symbol],
},
Platform {
opt_app_module_id: Option<ModuleId>,
/// the name and type scheme of the main function (required by the platform)
/// (type scheme is currently unused)
provides: &'a [(Loc<ExposedName<'a>>, Loc<TypedIdent<'a>>)],
requires: &'a [Loc<TypedIdent<'a>>],
requires_types: &'a [Loc<UppercaseIdent<'a>>],
/// usually `pf`
config_shorthand: &'a str,
/// the type scheme of the main function (required by the platform)
/// (currently unused)
#[allow(dead_code)]
platform_main_type: TypedIdent<'a>,
/// provided symbol to host (commonly `mainForHost`)
main_for_host: roc_module::symbol::Symbol,
},
Interface,
Interface {
name: ModuleName<'a>,
},
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
@ -95,15 +101,6 @@ impl<'a> ModuleName<'a> {
}
}
#[derive(Debug)]
pub enum ModuleNameEnum<'a> {
/// A filename
App(StrLiteral<'a>),
Interface(ModuleName<'a>),
Hosted(ModuleName<'a>),
Platform,
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub struct ExposedName<'a>(&'a str);