end
# Display an error
- fun error(s: String)
+ fun error(l: nullable Location, s: String)
do
stderr.write("{s}\n")
_error_count = _error_count + 1
end
# Display a warning
- fun warning(s: String)
+ fun warning(l: nullable Location, s: String)
do
if _opt_warn.value == 0 then return
stderr.write("{s}\n")
var full_name = dir.full_name_for(module_name)
if _processing_modules.has(full_name) then
# FIXME: Generate better error
- error("Error: Dependency loop for module {full_name}")
+ error(null, "Error: Dependency loop for module {full_name}")
check_errors
end
_processing_modules.add(full_name)
end
if not filename.file_exists then
- error("Error: File {filename} not found.")
+ error(null, "Error: File {filename} not found.")
check_errors
abort
end
var m = try_to_load(module_name, dir)
if m != null then return m
- error("Error: {filename} is not a NIT source module.")
+ error(null, "Error: {filename} is not a NIT source module.")
check_errors
abort
end
if m != null then return m
end
# FIXME: Generate better error
- error("Error: No ressource found for module {module_name}.")
+ error(null, "Error: No ressource found for module {module_name}.")
check_errors
abort
end
end
if file.eof then
- context.error("Error: Problem in opening file {filename}")
+ context.error(null, "Error: Problem in opening file {filename}")
context.check_errors
end
var m = parse_file(context, file, filename, module_name, dir)
if dir.file_exists then clibdir = dir
end
if clibdir == null then
- error("Error: Cannot locate NIT C library directory. Uses --clibdir or envvar NIT_DIR.")
+ error(null, "Error: Cannot locate NIT C library directory. Uses --clibdir or envvar NIT_DIR.")
check_errors
end
end
if dir.file_exists then bindir = dir
end
if bindir == null then
- error("Error: Cannot locate NIT tools directory. Uses --bindir or envvar NIT_DIR.")
+ error(null, "Error: Cannot locate NIT tools directory. Uses --bindir or envvar NIT_DIR.")
check_errors
end
end
end
if no_import != null then
if not module_names_to_import.is_empty then
- tc.error("{no_import.locate}: Error: Top modules cannot import other modules.")
+ tc.error(null, "{no_import.locate}: Error: Top modules cannot import other modules.")
end
else if module_names_to_import.is_empty then
var stdname = once "standard".to_symbol
if node_tree.n_base == null then
var err = node_tree.n_eof
assert err isa PError
- context.error("{err.locate}: {err.message}")
+ context.error(err.location, "{err.locate}: {err.message}")
context.check_errors
end
var node_module = node_tree.n_base
# Display an error for a given syntax node
fun error(n: nullable PNode, s: String)
do
- _tc.error("{locate(n)}: {s}")
+ _tc.error(n.location, "{locate(n)}: {s}")
end
# Display a warning for a given syntax node
fun warning(n: nullable PNode, s: String)
do
- _tc.warning("{locate(n)}: {s}")
+ _tc.warning(n.location, "{locate(n)}: {s}")
end
#