diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-04-12 13:24:10 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-04-12 17:46:31 -0400 |
| commit | 7baecc2e36521dbfacffe25e1522ca2a3d85bac8 (patch) | |
| tree | 321bbb409817b62f4e0388a19b1bf54ca00b2067 | |
| parent | 650b5e5aa2ece3446633fa2ecfb202334ad655d3 (diff) | |
[PRISM] Emit parse warnings before raising syntax errors
| -rw-r--r-- | prism_compile.c | 18 | ||||
| -rw-r--r-- | test/.excludes-prism/TestSyntax.rb | 1 |
2 files changed, 9 insertions, 10 deletions
diff --git a/prism_compile.c b/prism_compile.c index 2c50c19c1d..26d94e979d 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -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); diff --git a/test/.excludes-prism/TestSyntax.rb b/test/.excludes-prism/TestSyntax.rb index b32eb1823c..46f84cd163 100644 --- a/test/.excludes-prism/TestSyntax.rb +++ b/test/.excludes-prism/TestSyntax.rb @@ -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") |
