start on roc_load build.rs script for building the builtins

This commit is contained in:
Folkert 2022-03-23 18:30:43 +01:00
parent 7bb1fd88fa
commit 0a6335e772
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
4 changed files with 38 additions and 0 deletions

4
Cargo.lock generated
View file

@ -3673,7 +3673,11 @@ dependencies = [
name = "roc_load" name = "roc_load"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bumpalo",
"roc_builtins",
"roc_load_internal", "roc_load_internal",
"roc_module",
"roc_target",
] ]
[[package]] [[package]]

View file

@ -1,3 +1,7 @@
interface Bool
exposes [ Bool, and, or, not, isEq, isNotEq ]
imports [ ]
Bool : [ True, False ] Bool : [ True, False ]
and : Bool, Bool -> Bool and : Bool, Bool -> Bool

View file

@ -10,3 +10,8 @@ roc_load_internal = { path = "../load_internal" }
[build-dependencies] [build-dependencies]
roc_load_internal = { path = "../load_internal" } roc_load_internal = { path = "../load_internal" }
roc_builtins = { path = "../builtins" }
roc_module = { path = "../module" }
bumpalo = { version = "3.8.0", features = ["collections"] }
roc_target = { path = "../roc_target" }
# roc_types = { path = "../types" }

View file

@ -832,6 +832,31 @@ pub fn load_and_typecheck<'a>(
} }
} }
pub fn load_and_typecheck_str<'a>(
arena: &'a Bump,
filename: PathBuf,
source: &'a str,
src_dir: &Path,
exposed_types: ExposedByModule,
target_info: TargetInfo,
) -> Result<LoadedModule, LoadingProblem<'a>> {
use LoadResult::*;
let load_start = LoadStart::from_str(arena, filename, source)?;
match load(
arena,
load_start,
src_dir,
exposed_types,
Phase::SolveTypes,
target_info,
)? {
Monomorphized(_) => unreachable!(""),
TypeChecked(module) => Ok(module),
}
}
/// Main entry point to the compiler from the CLI and tests /// Main entry point to the compiler from the CLI and tests
pub fn load_and_monomorphize<'a>( pub fn load_and_monomorphize<'a>(
arena: &'a Bump, arena: &'a Bump,