Report parse warnings and compile errors when running script files
This commit is contained in:
parent
46b5e510ac
commit
fb36bde326
|
@ -76,12 +76,21 @@ pub fn evaluate_file(
|
||||||
trace!("parsing file: {}", file_path_str);
|
trace!("parsing file: {}", file_path_str);
|
||||||
let block = parse(&mut working_set, Some(file_path_str), &file, false);
|
let block = parse(&mut working_set, Some(file_path_str), &file, false);
|
||||||
|
|
||||||
|
if let Some(warning) = working_set.parse_warnings.first() {
|
||||||
|
report_error(&working_set, warning);
|
||||||
|
}
|
||||||
|
|
||||||
// If any parse errors were found, report the first error and exit.
|
// If any parse errors were found, report the first error and exit.
|
||||||
if let Some(err) = working_set.parse_errors.first() {
|
if let Some(err) = working_set.parse_errors.first() {
|
||||||
report_error(&working_set, err);
|
report_error(&working_set, err);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(err) = working_set.compile_errors.first() {
|
||||||
|
report_error(&working_set, err);
|
||||||
|
// Not a fatal error, for now
|
||||||
|
}
|
||||||
|
|
||||||
// Look for blocks whose name starts with "main" and replace it with the filename.
|
// Look for blocks whose name starts with "main" and replace it with the filename.
|
||||||
for block in working_set.delta.blocks.iter_mut().map(Arc::make_mut) {
|
for block in working_set.delta.blocks.iter_mut().map(Arc::make_mut) {
|
||||||
if block.signature.name == "main" {
|
if block.signature.name == "main" {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user