[vala/0.40] parser: Handle incomplete expression statements
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] parser: Handle incomplete expression statements
- Date: Tue, 21 Apr 2020 07:49:59 +0000 (UTC)
commit 5421541ab6ac6cabf9ca02b586f7235df5a42c99
Author: Princeton Ferro <princetonferro gmail com>
Date: Thu Apr 9 21:15:45 2020 +0200
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 26e9c6625..91594e3bd 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1640,7 +1640,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 (token == TokenType.DOT || token == TokenType.DOUBLE_COLON) {
+ rollback (begin);
+ return true;
+ } else {
+ throw e;
+ }
+ }
switch (current ()) {
// invocation expression
case TokenType.OPEN_PARENS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]