[vala/wip/ricotz/lsp-rev: 7/13] parser: Handle incomplete expression statements.
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp-rev: 7/13] parser: Handle incomplete expression statements.
- Date: Wed, 5 Feb 2020 11:48:40 +0000 (UTC)
commit a58101b8b7b4f70b450bd8d9efea401f2a655821
Author: Princeton Ferro <princetonferro gmail com>
Date: Sat Jan 25 18:14:09 2020 -0500
parser: Handle incomplete expression statements.
Incomplete expression statements are parsed as expression statements
now, rather than local variable declarations. This primarily affects
incomplete member access expressions at the end of blocks.
vala/valaparser.vala | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 2b480ce59..c0c0a7192 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1662,7 +1662,19 @@ public class Vala.Parser : CodeVisitor {
var begin = get_location ();
// decide between declaration and expression statement
- skip_type ();
+ try {
+ skip_type ();
+ } catch (ParseError e) {
+ prev ();
+ var token = current ();
+ next ();
+ if (context.keep_going && (token == TokenType.DOT || token ==
TokenType.DOUBLE_COLON)) {
+ rollback (begin);
+ return true;
+ } else {
+ throw e; // rethrow
+ }
+ }
switch (current ()) {
// invocation expression
case TokenType.OPEN_PARENS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]