vala r813 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r813 - in trunk: . vala
- Date: Wed, 9 Jan 2008 16:48:32 +0000 (GMT)
Author: juergbi
Date: Wed Jan 9 16:48:32 2008
New Revision: 813
URL: http://svn.gnome.org/viewvc/vala?rev=813&view=rev
Log:
2008-01-09 Juerg Billeter <j bitron ch>
* vala/valasemanticanalyzer.vala: report error when using invalid
expression for ref/out arguments, fixes bug 480022
Modified:
trunk/ChangeLog
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Wed Jan 9 16:48:32 2008
@@ -2019,14 +2019,15 @@
expr.parent_node.replace_expression (expr, parenthexp);
parenthexp.accept (this);
return;
- } else if (expr.operator == UnaryOperator.REF) {
- // value type
-
- expr.static_type = expr.inner.static_type;
- } else if (expr.operator == UnaryOperator.OUT) {
- // reference type
-
- expr.static_type = expr.inner.static_type;
+ } else if (expr.operator == UnaryOperator.REF || expr.operator == UnaryOperator.OUT) {
+ if (expr.inner.symbol_reference is Field || expr.inner.symbol_reference is FormalParameter || expr.inner.symbol_reference is VariableDeclarator) {
+ // ref and out can only be used with fields, parameters, and local variables
+ expr.static_type = expr.inner.static_type;
+ } else {
+ expr.error = true;
+ Report.error (expr.source_reference, "ref and out method arguments can only be used with fields, parameters, and local variables");
+ return;
+ }
} else {
expr.error = true;
Report.error (expr.source_reference, "internal error: unsupported unary operator");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]