summaryrefslogtreecommitdiff
path: root/vala/valagenieparser.vala
diff options
context:
space:
mode:
authorJamie McCracken <jamie.mccrack@gmail.com>2012-08-28 23:24:20 -0400
committerJamie McCracken <jamie.mccrack@gmail.com>2012-08-28 23:24:20 -0400
commit8558316a4c40fa8efbf6a7e128fddb9d864ce432 (patch)
tree8ffe45f79a7e86fdb8d269e9259ab07e82d42c65 /vala/valagenieparser.vala
parent049a77952370fcad5f6fbdab08dd84d89f40151a (diff)
downloadvala-8558316a4c40fa8efbf6a7e128fddb9d864ce432.tar.gz
Genie: Fix functions can take only one Generic as argument (611191)
Diffstat (limited to 'vala/valagenieparser.vala')
-rw-r--r--vala/valagenieparser.vala58
1 files changed, 39 insertions, 19 deletions
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index fe23c5f40..77fbd1c5d 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -3732,33 +3732,53 @@ public class Vala.Genie.Parser : CodeVisitor {
void skip_type_argument_list () throws ParseError {
if (accept (TokenType.OF)) {
- do {
- skip_type ();
- } while (accept (TokenType.COMMA));
+ if (accept (TokenType.OPEN_PARENS)) {
+ do {
+ skip_type ();
+ } while (accept (TokenType.COMMA));
+ expect (TokenType.CLOSE_PARENS);
+ } else {
+ do {
+ skip_type ();
+ } while (accept (TokenType.COMMA));
+ }
}
}
+
// try to parse type argument list
List<DataType>? parse_type_argument_list (bool maybe_expression) throws ParseError {
var begin = get_location ();
if (accept (TokenType.OF)) {
var list = new ArrayList<DataType> ();
- do {
- switch (current ()) {
- case TokenType.VOID:
- case TokenType.DYNAMIC:
- case TokenType.UNOWNED:
- case TokenType.WEAK:
- case TokenType.IDENTIFIER:
- var type = parse_type ();
-
- list.add (type);
- break;
- default:
- rollback (begin);
- return null;
- }
- } while (accept (TokenType.COMMA));
+ var inParens = false;
+
+ // Optional parens allow multi arg types in function signature: "dict of (int, string)"
+ // See: https://bugzilla.gnome.org/show_bug.cgi?id=611191
+ if (accept (TokenType.OPEN_PARENS)) {
+ inParens = true;
+ }
+
+ do {
+ switch (current ()) {
+ case TokenType.VOID:
+ case TokenType.DYNAMIC:
+ case TokenType.UNOWNED:
+ case TokenType.WEAK:
+ case TokenType.IDENTIFIER:
+ var type = parse_type ();
+
+ list.add (type);
+ break;
+ default:
+ rollback (begin);
+ return null;
+ }
+ } while (accept (TokenType.COMMA));
+
+ if (inParens) {
+ expect (TokenType.CLOSE_PARENS);
+ }
return list;
}