Rename HeaderFor to HeaderType

This commit is contained in:
Richard Feldman 2022-12-06 14:31:29 -05:00
parent 12a7b51eb4
commit 87c8702c89
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
3 changed files with 20 additions and 20 deletions

View file

@ -15,7 +15,7 @@ use roc_module::ident::Ident;
use roc_module::ident::Lowercase;
use roc_module::symbol::{IdentIds, IdentIdsByModule, ModuleId, ModuleIds, Symbol};
use roc_parse::ast::{Defs, TypeAnnotation};
use roc_parse::header::HeaderFor;
use roc_parse::header::HeaderType;
use roc_parse::pattern::PatternType;
use roc_problem::can::{Problem, RuntimeError};
use roc_region::all::{Loc, Region};
@ -198,10 +198,10 @@ impl GeneratedInfo {
env: &mut Env,
scope: &mut Scope,
var_store: &mut VarStore,
header_for: &HeaderFor<'a>,
header_for: &HeaderType<'a>,
) -> Self {
match header_for {
HeaderFor::Hosted {
HeaderType::Hosted {
generates,
generates_with,
} => {
@ -236,7 +236,7 @@ impl GeneratedInfo {
generated_functions,
}
}
HeaderFor::Builtin { generates_with } => {
HeaderType::Builtin { generates_with } => {
debug_assert!(generates_with.is_empty());
GeneratedInfo::Builtin
}
@ -266,7 +266,7 @@ fn has_no_implementation(expr: &Expr) -> bool {
pub fn canonicalize_module_defs<'a>(
arena: &'a Bump,
loc_defs: &'a mut Defs<'a>,
header_for: &roc_parse::header::HeaderFor,
header_for: &roc_parse::header::HeaderType,
home: ModuleId,
module_ids: &'a ModuleIds,
exposed_ident_ids: IdentIds,

View file

@ -43,7 +43,7 @@ use roc_packaging::cache::{self, RocCacheDir};
use roc_packaging::https::PackageMetadata;
use roc_parse::ast::{self, Defs, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
use roc_parse::header::{ExposedName, ImportsEntry, PackageEntry, PlatformHeader, To, TypedIdent};
use roc_parse::header::{HeaderFor, ModuleNameEnum, PackageName};
use roc_parse::header::{HeaderType, ModuleNameEnum, PackageName};
use roc_parse::ident::UppercaseIdent;
use roc_parse::module::module_defs;
use roc_parse::parser::{FileError, Parser, SourceError, SyntaxError};
@ -650,7 +650,7 @@ struct ModuleHeader<'a> {
exposes: Vec<Symbol>,
exposed_imports: MutMap<Ident, (Symbol, Region)>,
parse_state: roc_parse::state::State<'a>,
header_for: HeaderFor<'a>,
header_for: HeaderType<'a>,
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
module_timing: ModuleTiming,
}
@ -790,7 +790,7 @@ struct ParsedModule<'a> {
parsed_defs: Defs<'a>,
module_name: ModuleNameEnum<'a>,
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
header_for: HeaderFor<'a>,
header_for: HeaderType<'a>,
}
type LocExpects = VecMap<Region, Vec<ExpectLookup>>;
@ -2276,7 +2276,7 @@ fn update<'a>(
Ok(state)
}
Header(header) => {
use HeaderFor::*;
use HeaderType::*;
log!("loaded header for {:?}", header.module_id);
let home = header.module_id;
@ -3420,7 +3420,7 @@ fn load_builtin_module_help<'a>(
packages: &[],
exposes: unspace(arena, header.exposes.item.items),
imports: unspace(arena, header.imports.item.items),
extra: HeaderFor::Builtin {
header_type: HeaderType::Builtin {
generates_with: &[],
},
};
@ -3716,7 +3716,7 @@ fn parse_header<'a>(
packages: &[],
exposes: unspace(arena, header.exposes.item.items),
imports: unspace(arena, header.imports.item.items),
extra: HeaderFor::Interface,
header_type: HeaderType::Interface,
};
let (module_id, module_name, header) = build_header(
@ -3765,7 +3765,7 @@ fn parse_header<'a>(
packages: &[],
exposes: unspace(arena, header.exposes.item.items),
imports: unspace(arena, header.imports.item.items),
extra: HeaderFor::Hosted {
header_type: HeaderType::Hosted {
generates: header.generates.item,
generates_with: unspace(arena, header.generates_with.item.items),
},
@ -3827,7 +3827,7 @@ fn parse_header<'a>(
} else {
&[]
},
extra: HeaderFor::App {
header_type: HeaderType::App {
to_platform: header.provides.to.value,
},
};
@ -4029,7 +4029,7 @@ struct HeaderInfo<'a> {
packages: &'a [Loc<PackageEntry<'a>>],
exposes: &'a [Loc<ExposedName<'a>>],
imports: &'a [Loc<ImportsEntry<'a>>],
extra: HeaderFor<'a>,
header_type: HeaderType<'a>,
}
fn build_header<'a>(
@ -4049,7 +4049,7 @@ fn build_header<'a>(
packages,
exposes,
imports,
extra,
header_type,
} = info;
let declared_name: ModuleName = match &loc_name.value {
@ -4212,11 +4212,11 @@ fn build_header<'a>(
// mark these modules as Builtin. Otherwise the builtin functions are not instantiated
// and we just have a bunch of definitions with runtime errors in their bodies
let extra = {
match extra {
HeaderFor::Interface if home.is_builtin() => HeaderFor::Builtin {
match header_type {
HeaderType::Interface if home.is_builtin() => HeaderType::Builtin {
generates_with: &[],
},
_ => extra,
_ => header_type,
}
};
@ -4463,7 +4463,7 @@ fn send_header_two<'a>(
Symbol::new(home, ident_id)
};
let extra = HeaderFor::Platform {
let extra = HeaderType::Platform {
// A config_shorthand of "" should be fine
config_shorthand: opt_shorthand.unwrap_or_default(),
platform_main_type: requires[0].value,

View file

@ -10,7 +10,7 @@ use roc_region::all::Loc;
use std::fmt::Debug;
#[derive(Debug)]
pub enum HeaderFor<'a> {
pub enum HeaderType<'a> {
App {
to_platform: To<'a>,
},