_error_count = _error_count + 1
end
+ # Add an error, show errors and quit
+ fun fatal_error(l: nullable Location, s: String)
+ do
+ error(l,s)
+ check_errors
+ end
+
# Display a warning
fun warning(l: nullable Location, s: String)
do
var full_name = dir.full_name_for(module_name)
if _processing_modules.has(full_name) then
# FIXME: Generate better error
- error(null, "Error: Dependency loop for module {full_name}")
- check_errors
+ fatal_error(null, "Error: Dependency loop for module {full_name}")
end
_processing_modules.add(full_name)
var m = l.load_and_process_module(self, module_name, dir)
end
if not filename.file_exists then
- error(null, "Error: File {filename} not found.")
- check_errors
+ fatal_error(null, "Error: File {filename} not found.")
abort
end
var m = try_to_load(module_name, dir)
if m != null then return m
- error(null, "Error: {filename} is not a NIT source module.")
- check_errors
+ fatal_error(null, "Error: {filename} is not a NIT source module.")
abort
end
if m != null then return m
end
# FIXME: Generate better error
- error(null, "Error: No ressource found for module {module_name}.")
- check_errors
+ fatal_error(null, "Error: No ressource found for module {module_name}.")
abort
end
end
if file.eof then
- context.error(null, "Error: Problem in opening file {filename}")
- context.check_errors
+ context.fatal_error(null, "Error: Problem in opening file {filename}")
end
var m = parse_file(context, file, filename, module_name, dir)
if file != stdin then file.close
if dir.file_exists then clibdir = dir
end
if clibdir == null then
- error(null, "Error: Cannot locate NIT C library directory. Uses --clibdir or envvar NIT_DIR.")
- check_errors
+ fatal_error(null, "Error: Cannot locate NIT C library directory. Uses --clibdir or envvar NIT_DIR.")
end
end
bindir = opt_bindir.value
if dir.file_exists then bindir = dir
end
if bindir == null then
- error(null, "Error: Cannot locate NIT tools directory. Uses --bindir or envvar NIT_DIR.")
- check_errors
+ fatal_error(null, "Error: Cannot locate NIT tools directory. Uses --bindir or envvar NIT_DIR.")
end
end
end
if node_tree.n_base == null then
var err = node_tree.n_eof
assert err isa PError
- context.error(err.location, "{err.locate}: {err.message}")
- context.check_errors
+ context.fatal_error(err.location, "{err.locate}: {err.message}")
end
var node_module = node_tree.n_base
assert node_module isa AModule
_tc.error(n.location, "{locate(n)}: {s}")
end
+ # Add an error, show errors and quit
+ fun fatal_error(n: nullable PNode, s: String)
+ do
+ _tc.fatal_error(n.location, "{locate(n)}: {s}")
+ end
+
# Display a warning for a given syntax node
fun warning(n: nullable PNode, s: String)
do