[vala/wip/issue/987] vala: Don't rollback for possible member-access inside of type-argument-list
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/987] vala: Don't rollback for possible member-access inside of type-argument-list
- Date: Sun, 10 May 2020 19:10:36 +0000 (UTC)
commit d2273e4bf1bd05d6615d1d8118e0b356529ede2e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun May 10 21:09:29 2020 +0200
vala: Don't rollback for possible member-access inside of type-argument-list
Fixes https://gitlab.gnome.org/GNOME/vala/issues/987
vala/valaparser.vala | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 9f0b976fc..7c528e157 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -108,6 +108,10 @@ public class Vala.Parser : CodeVisitor {
return tokens[index].type;
}
+ inline TokenType previous () {
+ return tokens[(index - 1 + BUFFER_SIZE) % BUFFER_SIZE].type;
+ }
+
inline bool accept (TokenType type) {
if (current () == type) {
next ();
@@ -1666,13 +1670,12 @@ public class Vala.Parser : CodeVisitor {
var begin = get_location ();
// decide between declaration and expression statement
+ bool maybe_type_argument_list = previous () == TokenType.OP_LT;
try {
skip_type ();
} catch (ParseError e) {
- prev ();
- var token = current ();
- next ();
- if (token == TokenType.DOT || token == TokenType.DOUBLE_COLON) {
+ var token = previous ();
+ if (!maybe_type_argument_list && (token == TokenType.DOT || token ==
TokenType.DOUBLE_COLON)) {
rollback (begin);
return true;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]