[vala] Report error for non-automatic properties with default value



commit 940dc8eefed5613e8f32a4cf0c2ff3d0ab44d331
Author: JiÅ?í Zárevúcky <zarevucky jiri gmail com>
Date:   Sat Jan 9 14:32:47 2010 +0100

    Report error for non-automatic properties with default value
    
    Fixes bug 584065.

 vala/valaparser.vala |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 6542bfe..5a29d13 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2507,6 +2507,8 @@ public class Vala.Parser : CodeVisitor {
 				prop.field = new Field ("_%s".printf (prop.name), field_type, prop.default_expression, prop.source_reference);
 				prop.field.access = SymbolAccessibility.PRIVATE;
 				prop.field.binding = prop.binding;
+			} else if (prop.default_expression != null) {
+				Report.error (prop.default_expression.source_reference, "only automatic properties can have default values");
 			}
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]