[vala/wip/transform] Set parent_node to properties defult value



commit fc734939074162de220fbd5f907674260a105400
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Oct 30 00:00:45 2012 +0100

    Set parent_node to properties defult value

 tests/objects/properties.vala |    8 ++++++++
 vala/valaproperty.vala        |   11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/tests/objects/properties.vala b/tests/objects/properties.vala
index b051825..2e2b2ee 100644
--- a/tests/objects/properties.vala
+++ b/tests/objects/properties.vala
@@ -92,6 +92,14 @@ abstract class Maman.Foo : Object {
 	public abstract int abstract_base_property { get; set; }
 }
 
+enum FooEnum {
+	FOO
+}
+
+abstract class Maman.EnumDefault {
+	public abstract FooEnum bar { get; default = FooEnum.FOO; }
+}
+
 class Maman.Bar : Foo {
 	public int public_property { get; set; default = 3; }
 	public override int abstract_base_property { get; set; }
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index dcaf7e6..8be4bf3 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -132,7 +132,15 @@ public class Vala.Property : Symbol, Lockable {
 	/**
 	 * Specifies the default value of this property.
 	 */
-	public Expression initializer { get; set; }
+	public Expression initializer {
+		get {
+			return _initializer;
+		}
+		set {
+			_initializer = value;
+			_initializer.parent_node = this;
+		}
+	}
 
 	private bool lock_used = false;
 
@@ -143,6 +151,7 @@ public class Vala.Property : Symbol, Lockable {
 	private bool base_properties_valid;
 	PropertyAccessor? _get_accessor;
 	PropertyAccessor? _set_accessor;
+	Expression _initializer;
 
 	/**
 	 * Creates a new property.



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