2007-08-31 Jürg Billeter <j@bitron.ch>
+ * vala/valasemanticanalyzer.vala: improve error reporting for
+ expression, while, and for statements and for parenthesized
+ expressions
+
+2007-08-31 Jürg Billeter <j@bitron.ch>
+
* configure.ac: Post-release version bump
2007-08-31 Jürg Billeter <j@bitron.ch>
}
public override void visit_expression_statement (ExpressionStatement! stmt) {
+ if (stmt.expression.error) {
+ // ignore inner error
+ stmt.error = true;
+ return;
+ }
+
if (stmt.expression.static_type != null &&
stmt.expression.static_type.transfers_ownership) {
Report.warning (stmt.source_reference, "Short-living reference");
}
public override void visit_while_statement (WhileStatement! stmt) {
+ if (stmt.condition.error) {
+ /* if there was an error in the condition, skip this check */
+ stmt.error = true;
+ return;
+ }
+
if (stmt.condition.static_type.data_type != bool_type.data_type) {
stmt.error = true;
Report.error (stmt.condition.source_reference, "Condition must be boolean");
}
public override void visit_for_statement (ForStatement! stmt) {
+ if (stmt.condition.error) {
+ /* if there was an error in the condition, skip this check */
+ stmt.error = true;
+ return;
+ }
+
if (stmt.condition.static_type.data_type != bool_type.data_type) {
stmt.error = true;
Report.error (stmt.condition.source_reference, "Condition must be boolean");
return;
}
+ if (expr.inner.static_type == null) {
+ // static type may be null for method references
+ expr.error = true;
+ Report.error (expr.inner.source_reference, "Invalid expression type");
+ return;
+ }
+
expr.static_type = expr.inner.static_type.copy ();
// don't call g_object_ref_sink on inner and outer expression
expr.static_type.floating_reference = false;