mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
[PRISM] Emit parse warnings
This commit is contained in:
parent
b47d43fa9b
commit
332d2c92d8
3 changed files with 19 additions and 6 deletions
|
@ -7620,7 +7620,20 @@ pm_parse_input(pm_parse_result_t *result, VALUE filepath)
|
|||
return error;
|
||||
}
|
||||
|
||||
// TODO: we should be emitting warnings here as well.
|
||||
// Emit all of the various warnings from the parse.
|
||||
const pm_diagnostic_t *warning;
|
||||
const char *warning_filepath = (const char *) pm_string_source(&result->parser.filepath);
|
||||
|
||||
for (warning = (pm_diagnostic_t *) result->parser.warning_list.head; warning != NULL; warning = (pm_diagnostic_t *) warning->node.next) {
|
||||
int line = (int) pm_newline_list_line_column(&result->parser.newline_list, warning->location.start).line;
|
||||
|
||||
if (warning->level == PM_WARNING_LEVEL_VERBOSE) {
|
||||
rb_compile_warning(warning_filepath, line, "%s", warning->message);
|
||||
}
|
||||
else {
|
||||
rb_compile_warn(warning_filepath, line, "%s", warning->message);
|
||||
}
|
||||
}
|
||||
|
||||
// Now set up the constant pool and intern all of the various constants into
|
||||
// their corresponding IDs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue