fix intrinsics and env
This commit is contained in:
@@ -22,33 +22,6 @@ function use_embed(name) {
|
||||
return load_internal("js_core_" + name + "_use")
|
||||
}
|
||||
|
||||
// These duplicate C builtins from runtime.c, but are needed because the GC can
|
||||
// lose properties on the global object after compaction. The runtime_env provides
|
||||
// a stable way for modules to access them via env_record linking.
|
||||
function logical(val1) {
|
||||
if (val1 == 0 || val1 == false || val1 == "false" || val1 == null)
|
||||
return false;
|
||||
if (val1 == 1 || val1 == true || val1 == "true")
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
function some(arr, pred) {
|
||||
return find(arr, pred) != null
|
||||
}
|
||||
|
||||
function every(arr, pred) {
|
||||
return find(arr, x => not(pred(x))) == null
|
||||
}
|
||||
|
||||
function starts_with(str, prefix) {
|
||||
return search(str, prefix) == 0
|
||||
}
|
||||
|
||||
function ends_with(str, suffix) {
|
||||
return search(str, suffix, -length(suffix)) != null
|
||||
}
|
||||
|
||||
var fd = use_embed('internal_fd')
|
||||
var js = use_embed('js')
|
||||
var crypto = use_embed('crypto')
|
||||
@@ -87,7 +60,7 @@ function boot_load(name) {
|
||||
}
|
||||
mcode_blob = fd.slurp(mcode_path)
|
||||
mach_blob = mach_compile_mcode_bin(name, text(mcode_blob))
|
||||
return mach_load(mach_blob, {use: use_embed})
|
||||
return mach_load(mach_blob, stone({use: use_embed}))
|
||||
}
|
||||
|
||||
// Load a pipeline module from cache; on miss compile from source via boot chain
|
||||
@@ -451,14 +424,6 @@ var parallel = pronto.parallel
|
||||
var race = pronto.race
|
||||
var sequence = pronto.sequence
|
||||
|
||||
// Fill runtime_env — includes duplicates of C builtins because the GC can
|
||||
// lose global object properties after compaction. Modules resolve these via
|
||||
// env_record, not the global.
|
||||
runtime_env.logical = logical
|
||||
runtime_env.some = some
|
||||
runtime_env.every = every
|
||||
runtime_env.starts_with = starts_with
|
||||
runtime_env.ends_with = ends_with
|
||||
runtime_env.actor = actor
|
||||
runtime_env.is_actor = is_actor
|
||||
runtime_env.log = log
|
||||
|
||||
Reference in New Issue
Block a user