Merge branch 'fix_compile_warnings'
This commit is contained in:
@@ -34,7 +34,7 @@ function boot_load(name) {
|
||||
var mcode_blob = null
|
||||
var mach_blob = null
|
||||
if (!fd.is_file(mcode_path)) {
|
||||
print("error: missing seed: " + name + "\n")
|
||||
os.print("error: missing seed: " + name + "\n")
|
||||
disrupt
|
||||
}
|
||||
mcode_blob = fd.slurp(mcode_path)
|
||||
@@ -60,9 +60,9 @@ function analyze(src, filename) {
|
||||
e = ast.errors[_i]
|
||||
msg = e.message
|
||||
if (e.line != null && e.column != null)
|
||||
print(`${filename}:${text(e.line)}:${text(e.column)}: error: ${msg}`)
|
||||
os.print(`${filename}:${text(e.line)}:${text(e.column)}: error: ${msg}\n`)
|
||||
else
|
||||
print(`${filename}: error: ${msg}`)
|
||||
os.print(`${filename}: error: ${msg}\n`)
|
||||
_i = _i + 1
|
||||
}
|
||||
disrupt
|
||||
@@ -105,4 +105,4 @@ while (_i < length(seed_files)) {
|
||||
compile_and_cache(entry.name, core_path + '/' + entry.path)
|
||||
_i = _i + 1
|
||||
}
|
||||
print("bootstrap: cache seeded\n")
|
||||
os.print("bootstrap: cache seeded\n")
|
||||
|
||||
@@ -58,7 +58,7 @@ function boot_load(name) {
|
||||
var mcode_blob = null
|
||||
var mach_blob = null
|
||||
if (!fd.is_file(mcode_path)) {
|
||||
print("error: missing boot seed: " + name + "\n")
|
||||
os.print("error: missing boot seed: " + name + "\n")
|
||||
disrupt
|
||||
}
|
||||
mcode_blob = fd.slurp(mcode_path)
|
||||
@@ -103,7 +103,7 @@ function load_pipeline_module(name, env) {
|
||||
tok_result = boot_tok(src, source_path)
|
||||
ast = boot_par(tok_result.tokens, src, source_path, boot_tok)
|
||||
if (ast.errors != null && length(ast.errors) > 0) {
|
||||
print("error: failed to compile pipeline module: " + name + "\n")
|
||||
os.print("error: failed to compile pipeline module: " + name + "\n")
|
||||
disrupt
|
||||
}
|
||||
ast = boot_fld(ast)
|
||||
@@ -126,7 +126,7 @@ function load_pipeline_module(name, env) {
|
||||
mach_blob = mach_compile_mcode_bin(name, text(mcode_blob))
|
||||
return mach_load(mach_blob, env)
|
||||
}
|
||||
print("error: cannot load pipeline module: " + name + "\n")
|
||||
os.print("error: cannot load pipeline module: " + name + "\n")
|
||||
disrupt
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ function analyze(src, filename) {
|
||||
col = e.column
|
||||
if (msg != prev_msg || line != prev_line) {
|
||||
if (line != null && col != null)
|
||||
print(`${filename}:${text(line)}:${text(col)}: error: ${msg}`)
|
||||
os.print(`${filename}:${text(line)}:${text(col)}: error: ${msg}\n`)
|
||||
else
|
||||
print(`${filename}: error: ${msg}`)
|
||||
os.print(`${filename}: error: ${msg}\n`)
|
||||
}
|
||||
prev_line = line
|
||||
prev_msg = msg
|
||||
@@ -473,7 +473,7 @@ function use_core(path) {
|
||||
result = mach_load(mach_blob, env)
|
||||
}
|
||||
} disruption {
|
||||
print("use('" + path + "'): failed to compile or load " + file_path + "\n")
|
||||
os.print("use('" + path + "'): failed to compile or load " + file_path + "\n")
|
||||
disrupt
|
||||
}
|
||||
_load_mod()
|
||||
@@ -701,7 +701,7 @@ function load_log_config() {
|
||||
terminal: {
|
||||
type: "console",
|
||||
format: "pretty",
|
||||
channels: ["console", "error", "system"],
|
||||
channels: ["*"],
|
||||
stack: ["error"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ function package_in_shop(package) {
|
||||
function abs_path_to_package(package_dir)
|
||||
{
|
||||
if (!fd.is_file(package_dir + '/cell.toml')) {
|
||||
print('Not a valid package directory (no cell.toml): ' + package_dir)
|
||||
log.error('Not a valid package directory (no cell.toml): ' + package_dir)
|
||||
disrupt
|
||||
}
|
||||
|
||||
@@ -339,12 +339,12 @@ Shop.resolve_package_info = function(pkg) {
|
||||
|
||||
// Verify if a package name is valid and return status
|
||||
Shop.verify_package_name = function(pkg) {
|
||||
if (!pkg) { print("Empty package name"); disrupt }
|
||||
if (pkg == 'local') { print("local is not a valid package name"); disrupt }
|
||||
if (pkg == 'core') { print("core is not a valid package name"); disrupt }
|
||||
if (!pkg) { log.error("Empty package name"); disrupt }
|
||||
if (pkg == 'local') { log.error("local is not a valid package name"); disrupt }
|
||||
if (pkg == 'core') { log.error("core is not a valid package name"); disrupt }
|
||||
|
||||
if (search(pkg, '://') != null) {
|
||||
print(`Invalid package name: ${pkg}; did you mean ${array(pkg, '://')[1]}?`)
|
||||
log.error(`Invalid package name: ${pkg}; did you mean ${array(pkg, '://')[1]}?`)
|
||||
disrupt
|
||||
}
|
||||
}
|
||||
@@ -667,10 +667,10 @@ var _streamline_mod = null
|
||||
// Compile a module and return its bytecode blob.
|
||||
// The bytecode is cached on disk by content hash.
|
||||
function resolve_mod_fn(path, pkg) {
|
||||
if (!fd.is_file(path)) { print(`path ${path} is not a file`); disrupt }
|
||||
if (!fd.is_file(path)) { log.error(`path ${path} is not a file`); disrupt }
|
||||
|
||||
var content = text(fd.slurp(path))
|
||||
if (length(content) == 0) { print(`${path}: empty file`); disrupt }
|
||||
if (length(content) == 0) { log.error(`${path}: empty file`); disrupt }
|
||||
var content_key = stone(blob(content))
|
||||
var native_result = null
|
||||
var cached = null
|
||||
@@ -745,7 +745,7 @@ function resolve_mod_fn(path, pkg) {
|
||||
if (!_mcode_mod) _mcode_mod = use_cache['core/mcode'] || use_cache['mcode']
|
||||
if (!_streamline_mod) _streamline_mod = use_cache['core/streamline'] || use_cache['streamline']
|
||||
if (!_mcode_mod || !_streamline_mod) {
|
||||
print(`error: compiler modules not loaded (mcode=${_mcode_mod != null}, streamline=${_streamline_mod != null})`)
|
||||
log.error(`error: compiler modules not loaded (mcode=${_mcode_mod != null}, streamline=${_streamline_mod != null})`)
|
||||
disrupt
|
||||
}
|
||||
ast = analyze(content, path)
|
||||
@@ -764,7 +764,7 @@ function resolve_mod_fn(path, pkg) {
|
||||
return compiled
|
||||
}
|
||||
|
||||
print(`Module ${path} could not be loaded: no artifact found or all methods blocked by policy`)
|
||||
log.error(`Module ${path} could not be loaded: no artifact found or all methods blocked by policy`)
|
||||
disrupt
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ function execute_module(info)
|
||||
log.shop(`Module could not be found (c_resolve scope=${info.c_resolve.scope}, mod_resolve scope=${info.mod_resolve.scope}, cache_key=${info.cache_key})`); disrupt
|
||||
}
|
||||
|
||||
if (!used) { print(`Module ${info} returned null`); disrupt }
|
||||
if (!used) { log.error(`Module ${info} returned null`); disrupt }
|
||||
|
||||
return used
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ Shop.extract = function(pkg) {
|
||||
var zip_blob = get_package_zip(pkg)
|
||||
|
||||
if (!zip_blob) {
|
||||
print("No zip blob available for " + pkg)
|
||||
log.error("No zip blob available for " + pkg)
|
||||
disrupt
|
||||
}
|
||||
|
||||
@@ -1729,7 +1729,7 @@ Shop.sync_with_deps = function(pkg, opts) {
|
||||
|
||||
function install_zip(zip_blob, target_dir) {
|
||||
var zip = miniz.read(zip_blob)
|
||||
if (!zip) { print("Failed to read zip archive"); disrupt }
|
||||
if (!zip) { log.error("Failed to read zip archive"); disrupt }
|
||||
|
||||
if (fd.is_link(target_dir)) fd.unlink(target_dir)
|
||||
if (fd.is_dir(target_dir)) fd.rmdir(target_dir, 1)
|
||||
@@ -1947,7 +1947,7 @@ Shop.load_as_mach = function(path, pkg) {
|
||||
var inject = null
|
||||
var env = null
|
||||
|
||||
if (!locator) { print('Module ' + path + ' not found'); disrupt }
|
||||
if (!locator) { log.error('Module ' + path + ' not found'); disrupt }
|
||||
|
||||
file_path = locator.path
|
||||
content = text(fd.slurp(file_path))
|
||||
@@ -1972,7 +1972,7 @@ Shop.load_as_mach = function(path, pkg) {
|
||||
if (!_mcode_mod) _mcode_mod = use_cache['core/mcode'] || use_cache['mcode']
|
||||
if (!_streamline_mod) _streamline_mod = use_cache['core/streamline'] || use_cache['streamline']
|
||||
if (!_mcode_mod || !_streamline_mod) {
|
||||
print('error: compiler modules not loaded')
|
||||
log.error('error: compiler modules not loaded')
|
||||
disrupt
|
||||
}
|
||||
ast = analyze(content, file_path)
|
||||
@@ -2008,7 +2008,7 @@ Shop.load_as_dylib = function(path, pkg) {
|
||||
var inject = null
|
||||
var env = null
|
||||
|
||||
if (!locator) { print('Module ' + path + ' not found'); disrupt }
|
||||
if (!locator) { log.error('Module ' + path + ' not found'); disrupt }
|
||||
|
||||
file_path = locator.path
|
||||
if (!real_pkg) {
|
||||
@@ -2076,7 +2076,7 @@ Shop.use_native = function(path, package_context) {
|
||||
var src_path = path
|
||||
if (!starts_with(path, '/'))
|
||||
src_path = fd.realpath(path)
|
||||
if (!fd.is_file(src_path)) { print('File not found: ' + path); disrupt }
|
||||
if (!fd.is_file(src_path)) { log.error('File not found: ' + path); disrupt }
|
||||
|
||||
var file_info = Shop.file_info(src_path)
|
||||
var pkg = file_info.package || package_context
|
||||
@@ -2089,7 +2089,7 @@ Shop.use_native = function(path, package_context) {
|
||||
var dylib_path = build.compile_native(src_path, null, null, pkg)
|
||||
|
||||
var handle = os.dylib_open(dylib_path)
|
||||
if (!handle) { print('Failed to open native dylib: ' + dylib_path); disrupt }
|
||||
if (!handle) { log.error('Failed to open native dylib: ' + dylib_path); disrupt }
|
||||
|
||||
// Build env with runtime functions and capabilities
|
||||
var inject = Shop.script_inject_for(file_info)
|
||||
|
||||
Reference in New Issue
Block a user