[vala/wip/ricotz/lsp-rev: 3/8] parser: Handle delimiters inside of parse_argument_list/parse_initializer
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp-rev: 3/8] parser: Handle delimiters inside of parse_argument_list/parse_initializer
- Date: Sat, 18 Jan 2020 20:43:22 +0000 (UTC)
commit bd7f22e67f6a8d5e7303f2660c2b2acf8a2a1bff
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 18 20:03:37 2020 +0100
parser: Handle delimiters inside of parse_argument_list/parse_initializer
vala/valaparser.vala | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index e927020d2..837f0a991 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -576,12 +576,14 @@ public class Vala.Parser : CodeVisitor {
}
List<Expression> parse_argument_list () throws ParseError {
+ expect (TokenType.OPEN_PARENS);
var list = new ArrayList<Expression> ();
if (current () != TokenType.CLOSE_PARENS) {
do {
list.add (parse_argument ());
} while (accept (TokenType.COMMA));
}
+ expect (TokenType.CLOSE_PARENS);
return list;
}
@@ -787,9 +789,7 @@ public class Vala.Parser : CodeVisitor {
}
Expression parse_method_call (SourceLocation begin, Expression inner) throws ParseError {
- expect (TokenType.OPEN_PARENS);
var arg_list = parse_argument_list ();
- expect (TokenType.CLOSE_PARENS);
var src = get_src (begin);
var init_list = parse_object_initializer ();
@@ -878,7 +878,7 @@ public class Vala.Parser : CodeVisitor {
}
var member = parse_member_name ();
- if (accept (TokenType.OPEN_PARENS)) {
+ if (current () == TokenType.OPEN_PARENS) {
var expr = parse_object_creation_expression (begin, member);
return expr;
} else {
@@ -902,7 +902,6 @@ public class Vala.Parser : CodeVisitor {
Expression parse_object_creation_expression (SourceLocation begin, MemberAccess member) throws
ParseError {
member.creation_member = true;
var arg_list = parse_argument_list ();
- expect (TokenType.CLOSE_PARENS);
var src = get_src (begin);
var init_list = parse_object_initializer ();
@@ -2734,8 +2733,7 @@ public class Vala.Parser : CodeVisitor {
expect (TokenType.OPEN_BRACE);
var initializer = new InitializerList (get_src (begin));
while (current () != TokenType.CLOSE_BRACE) {
- var init = parse_argument ();
- initializer.append (init);
+ initializer.append (parse_argument ());
if (!accept (TokenType.COMMA)) {
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]