summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vala/valaparser.vala6
-rw-r--r--vala/valatuple.vala17
2 files changed, 19 insertions, 4 deletions
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index b3d3454c5..d0649cd66 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1,6 +1,6 @@
/* valaparser.vala
*
- * Copyright (C) 2006-2009 Jürg Billeter
+ * Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -632,6 +632,8 @@ public class Vala.Parser : CodeVisitor {
}
Expression parse_tuple () throws ParseError {
+ var begin = get_location ();
+
expect (TokenType.OPEN_PARENS);
var expr_list = new ArrayList<Expression> ();
if (current () != TokenType.CLOSE_PARENS) {
@@ -641,7 +643,7 @@ public class Vala.Parser : CodeVisitor {
}
expect (TokenType.CLOSE_PARENS);
if (expr_list.size != 1) {
- var tuple = new Tuple ();
+ var tuple = new Tuple (get_src (begin));
foreach (Expression expr in expr_list) {
tuple.add_expression (expr);
}
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index 0efab3e46..b723d391d 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -1,6 +1,6 @@
/* valatuple.vala
*
- * Copyright (C) 2006-2008 Jürg Billeter
+ * Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,8 @@ using GLib;
public class Vala.Tuple : Expression {
private List<Expression> expression_list = new ArrayList<Expression> ();
- public Tuple () {
+ public Tuple (SourceReference? source_reference = null) {
+ this.source_reference = source_reference;
}
public void add_expression (Expression expr) {
@@ -42,5 +43,17 @@ public class Vala.Tuple : Expression {
public override bool is_pure () {
return false;
}
+
+ public override bool check (SemanticAnalyzer analyzer) {
+ if (checked) {
+ return !error;
+ }
+
+ checked = true;
+
+ Report.error (source_reference, "tuples are not supported");
+ error = true;
+ return false;
+ }
}