diff options
author | Princeton Ferro <princetonferro@gmail.com> | 2020-01-18 20:03:37 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-02-03 13:33:40 +0100 |
commit | a8c1babc5562c1db14c959cdd89e21c4b77f0d07 (patch) | |
tree | cb571278db779f4f1009082517b9862e2cc04438 /vala/valaparser.vala | |
parent | 2517adbe43d77b7afe94e4c581996ad07b4c3e4e (diff) | |
download | vala-a8c1babc5562c1db14c959cdd89e21c4b77f0d07.tar.gz |
parser: Make parse_embedded_statement_without_block more robust
... when --keep-going was passed
Diffstat (limited to 'vala/valaparser.vala')
-rw-r--r-- | vala/valaparser.vala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vala/valaparser.vala b/vala/valaparser.vala index aaae5a25a..5f9bd3464 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -1734,8 +1734,16 @@ public class Vala.Parser : CodeVisitor { var block = new Block (get_src (get_location ())); - var stmt = parse_embedded_statement_without_block (statement_name, accept_empty_body); - block.add_statement (stmt); + try { + var stmt = parse_embedded_statement_without_block (statement_name, accept_empty_body); + block.add_statement (stmt); + } catch (ParseError e) { + if (context.keep_going) { + report_parse_error (e); + } else { + throw e; + } + } block.source_reference.end = get_last_src ().end; return block; |