mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Rename HeaderFor to HeaderType
This commit is contained in:
parent
12a7b51eb4
commit
87c8702c89
3 changed files with 20 additions and 20 deletions
|
@ -15,7 +15,7 @@ use roc_module::ident::Ident;
|
||||||
use roc_module::ident::Lowercase;
|
use roc_module::ident::Lowercase;
|
||||||
use roc_module::symbol::{IdentIds, IdentIdsByModule, ModuleId, ModuleIds, Symbol};
|
use roc_module::symbol::{IdentIds, IdentIdsByModule, ModuleId, ModuleIds, Symbol};
|
||||||
use roc_parse::ast::{Defs, TypeAnnotation};
|
use roc_parse::ast::{Defs, TypeAnnotation};
|
||||||
use roc_parse::header::HeaderFor;
|
use roc_parse::header::HeaderType;
|
||||||
use roc_parse::pattern::PatternType;
|
use roc_parse::pattern::PatternType;
|
||||||
use roc_problem::can::{Problem, RuntimeError};
|
use roc_problem::can::{Problem, RuntimeError};
|
||||||
use roc_region::all::{Loc, Region};
|
use roc_region::all::{Loc, Region};
|
||||||
|
@ -198,10 +198,10 @@ impl GeneratedInfo {
|
||||||
env: &mut Env,
|
env: &mut Env,
|
||||||
scope: &mut Scope,
|
scope: &mut Scope,
|
||||||
var_store: &mut VarStore,
|
var_store: &mut VarStore,
|
||||||
header_for: &HeaderFor<'a>,
|
header_for: &HeaderType<'a>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
match header_for {
|
match header_for {
|
||||||
HeaderFor::Hosted {
|
HeaderType::Hosted {
|
||||||
generates,
|
generates,
|
||||||
generates_with,
|
generates_with,
|
||||||
} => {
|
} => {
|
||||||
|
@ -236,7 +236,7 @@ impl GeneratedInfo {
|
||||||
generated_functions,
|
generated_functions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HeaderFor::Builtin { generates_with } => {
|
HeaderType::Builtin { generates_with } => {
|
||||||
debug_assert!(generates_with.is_empty());
|
debug_assert!(generates_with.is_empty());
|
||||||
GeneratedInfo::Builtin
|
GeneratedInfo::Builtin
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ fn has_no_implementation(expr: &Expr) -> bool {
|
||||||
pub fn canonicalize_module_defs<'a>(
|
pub fn canonicalize_module_defs<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
loc_defs: &'a mut Defs<'a>,
|
loc_defs: &'a mut Defs<'a>,
|
||||||
header_for: &roc_parse::header::HeaderFor,
|
header_for: &roc_parse::header::HeaderType,
|
||||||
home: ModuleId,
|
home: ModuleId,
|
||||||
module_ids: &'a ModuleIds,
|
module_ids: &'a ModuleIds,
|
||||||
exposed_ident_ids: IdentIds,
|
exposed_ident_ids: IdentIds,
|
||||||
|
|
|
@ -43,7 +43,7 @@ use roc_packaging::cache::{self, RocCacheDir};
|
||||||
use roc_packaging::https::PackageMetadata;
|
use roc_packaging::https::PackageMetadata;
|
||||||
use roc_parse::ast::{self, Defs, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
|
use roc_parse::ast::{self, Defs, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
|
||||||
use roc_parse::header::{ExposedName, ImportsEntry, PackageEntry, PlatformHeader, To, TypedIdent};
|
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::ident::UppercaseIdent;
|
||||||
use roc_parse::module::module_defs;
|
use roc_parse::module::module_defs;
|
||||||
use roc_parse::parser::{FileError, Parser, SourceError, SyntaxError};
|
use roc_parse::parser::{FileError, Parser, SourceError, SyntaxError};
|
||||||
|
@ -650,7 +650,7 @@ struct ModuleHeader<'a> {
|
||||||
exposes: Vec<Symbol>,
|
exposes: Vec<Symbol>,
|
||||||
exposed_imports: MutMap<Ident, (Symbol, Region)>,
|
exposed_imports: MutMap<Ident, (Symbol, Region)>,
|
||||||
parse_state: roc_parse::state::State<'a>,
|
parse_state: roc_parse::state::State<'a>,
|
||||||
header_for: HeaderFor<'a>,
|
header_for: HeaderType<'a>,
|
||||||
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
|
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ struct ParsedModule<'a> {
|
||||||
parsed_defs: Defs<'a>,
|
parsed_defs: Defs<'a>,
|
||||||
module_name: ModuleNameEnum<'a>,
|
module_name: ModuleNameEnum<'a>,
|
||||||
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
|
symbols_from_requires: Vec<(Loc<Symbol>, Loc<TypeAnnotation<'a>>)>,
|
||||||
header_for: HeaderFor<'a>,
|
header_for: HeaderType<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocExpects = VecMap<Region, Vec<ExpectLookup>>;
|
type LocExpects = VecMap<Region, Vec<ExpectLookup>>;
|
||||||
|
@ -2276,7 +2276,7 @@ fn update<'a>(
|
||||||
Ok(state)
|
Ok(state)
|
||||||
}
|
}
|
||||||
Header(header) => {
|
Header(header) => {
|
||||||
use HeaderFor::*;
|
use HeaderType::*;
|
||||||
|
|
||||||
log!("loaded header for {:?}", header.module_id);
|
log!("loaded header for {:?}", header.module_id);
|
||||||
let home = header.module_id;
|
let home = header.module_id;
|
||||||
|
@ -3420,7 +3420,7 @@ fn load_builtin_module_help<'a>(
|
||||||
packages: &[],
|
packages: &[],
|
||||||
exposes: unspace(arena, header.exposes.item.items),
|
exposes: unspace(arena, header.exposes.item.items),
|
||||||
imports: unspace(arena, header.imports.item.items),
|
imports: unspace(arena, header.imports.item.items),
|
||||||
extra: HeaderFor::Builtin {
|
header_type: HeaderType::Builtin {
|
||||||
generates_with: &[],
|
generates_with: &[],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -3716,7 +3716,7 @@ fn parse_header<'a>(
|
||||||
packages: &[],
|
packages: &[],
|
||||||
exposes: unspace(arena, header.exposes.item.items),
|
exposes: unspace(arena, header.exposes.item.items),
|
||||||
imports: unspace(arena, header.imports.item.items),
|
imports: unspace(arena, header.imports.item.items),
|
||||||
extra: HeaderFor::Interface,
|
header_type: HeaderType::Interface,
|
||||||
};
|
};
|
||||||
|
|
||||||
let (module_id, module_name, header) = build_header(
|
let (module_id, module_name, header) = build_header(
|
||||||
|
@ -3765,7 +3765,7 @@ fn parse_header<'a>(
|
||||||
packages: &[],
|
packages: &[],
|
||||||
exposes: unspace(arena, header.exposes.item.items),
|
exposes: unspace(arena, header.exposes.item.items),
|
||||||
imports: unspace(arena, header.imports.item.items),
|
imports: unspace(arena, header.imports.item.items),
|
||||||
extra: HeaderFor::Hosted {
|
header_type: HeaderType::Hosted {
|
||||||
generates: header.generates.item,
|
generates: header.generates.item,
|
||||||
generates_with: unspace(arena, header.generates_with.item.items),
|
generates_with: unspace(arena, header.generates_with.item.items),
|
||||||
},
|
},
|
||||||
|
@ -3827,7 +3827,7 @@ fn parse_header<'a>(
|
||||||
} else {
|
} else {
|
||||||
&[]
|
&[]
|
||||||
},
|
},
|
||||||
extra: HeaderFor::App {
|
header_type: HeaderType::App {
|
||||||
to_platform: header.provides.to.value,
|
to_platform: header.provides.to.value,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4029,7 +4029,7 @@ struct HeaderInfo<'a> {
|
||||||
packages: &'a [Loc<PackageEntry<'a>>],
|
packages: &'a [Loc<PackageEntry<'a>>],
|
||||||
exposes: &'a [Loc<ExposedName<'a>>],
|
exposes: &'a [Loc<ExposedName<'a>>],
|
||||||
imports: &'a [Loc<ImportsEntry<'a>>],
|
imports: &'a [Loc<ImportsEntry<'a>>],
|
||||||
extra: HeaderFor<'a>,
|
header_type: HeaderType<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_header<'a>(
|
fn build_header<'a>(
|
||||||
|
@ -4049,7 +4049,7 @@ fn build_header<'a>(
|
||||||
packages,
|
packages,
|
||||||
exposes,
|
exposes,
|
||||||
imports,
|
imports,
|
||||||
extra,
|
header_type,
|
||||||
} = info;
|
} = info;
|
||||||
|
|
||||||
let declared_name: ModuleName = match &loc_name.value {
|
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
|
// 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
|
// and we just have a bunch of definitions with runtime errors in their bodies
|
||||||
let extra = {
|
let extra = {
|
||||||
match extra {
|
match header_type {
|
||||||
HeaderFor::Interface if home.is_builtin() => HeaderFor::Builtin {
|
HeaderType::Interface if home.is_builtin() => HeaderType::Builtin {
|
||||||
generates_with: &[],
|
generates_with: &[],
|
||||||
},
|
},
|
||||||
_ => extra,
|
_ => header_type,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4463,7 +4463,7 @@ fn send_header_two<'a>(
|
||||||
Symbol::new(home, ident_id)
|
Symbol::new(home, ident_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
let extra = HeaderFor::Platform {
|
let extra = HeaderType::Platform {
|
||||||
// A config_shorthand of "" should be fine
|
// A config_shorthand of "" should be fine
|
||||||
config_shorthand: opt_shorthand.unwrap_or_default(),
|
config_shorthand: opt_shorthand.unwrap_or_default(),
|
||||||
platform_main_type: requires[0].value,
|
platform_main_type: requires[0].value,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use roc_region::all::Loc;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum HeaderFor<'a> {
|
pub enum HeaderType<'a> {
|
||||||
App {
|
App {
|
||||||
to_platform: To<'a>,
|
to_platform: To<'a>,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue