зеркало из https://github.com/github/ruby.git
[PRISM] Emit parse warnings before raising syntax errors
This commit is contained in:
Родитель
650b5e5aa2
Коммит
7baecc2e36
|
@ -8672,15 +8672,6 @@ pm_parse_process(pm_parse_result_t *result, pm_node_t *node)
|
|||
pm_scope_node_init(node, scope_node, NULL);
|
||||
scope_node->filepath_encoding = filepath_encoding;
|
||||
|
||||
// If there are errors, raise an appropriate error and free the result.
|
||||
if (parser->error_list.size > 0) {
|
||||
VALUE error = pm_parse_process_error(result);
|
||||
|
||||
// TODO: We need to set the backtrace.
|
||||
// rb_funcallv(error, rb_intern("set_backtrace"), 1, &path);
|
||||
return error;
|
||||
}
|
||||
|
||||
// Emit all of the various warnings from the parse.
|
||||
const pm_diagnostic_t *warning;
|
||||
const char *warning_filepath = (const char *) pm_string_source(&parser->filepath);
|
||||
|
@ -8696,6 +8687,15 @@ pm_parse_process(pm_parse_result_t *result, pm_node_t *node)
|
|||
}
|
||||
}
|
||||
|
||||
// If there are errors, raise an appropriate error and free the result.
|
||||
if (parser->error_list.size > 0) {
|
||||
VALUE error = pm_parse_process_error(result);
|
||||
|
||||
// TODO: We need to set the backtrace.
|
||||
// rb_funcallv(error, rb_intern("set_backtrace"), 1, &path);
|
||||
return error;
|
||||
}
|
||||
|
||||
// Now set up the constant pool and intern all of the various constants into
|
||||
// their corresponding IDs.
|
||||
scope_node->encoding = rb_enc_find(parser->encoding->name);
|
||||
|
|
|
@ -22,7 +22,6 @@ exclude(:test_methoddef_endless_command, "unknown")
|
|||
exclude(:test_numbered_parameter, "unknown")
|
||||
exclude(:test_optional_self_reference, "unknown")
|
||||
exclude(:test_parenthesised_statement_argument, "unknown")
|
||||
exclude(:test_range_at_eol, "unknown")
|
||||
exclude(:test_safe_call_in_massign_lhs, "unknown")
|
||||
exclude(:test_syntax_error_at_newline, "unknown")
|
||||
exclude(:test_unassignable, "unknown")
|
||||
|
|
Загрузка…
Ссылка в новой задаче