[vala/wip/ricotz/lsp-rev: 8/8] parser: Make parse_embedded_statement_without_block more robust



commit da29caf4889affa4096cb521b9b37d0ddd4536ee
Author: Princeton Ferro <princetonferro gmail com>
Date:   Sat Jan 18 20:03:37 2020 +0100

    parser: Make parse_embedded_statement_without_block more robust

 vala/valaparser.vala | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 83e0c9320..da0c3a161 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1745,8 +1745,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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]