[vala] Revert "Set parent_node and always copy datatype when assigned to code nodes."



commit 5764bac40da1cd4124ff9e16484c5971ffc07d57
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon Oct 7 20:50:47 2013 +0200

    Revert "Set parent_node and always copy datatype when assigned to code nodes."
    
    This reverts commit a09c9e93af0d64b9331c274de573465fe070b722.
    
    Fixes bug 709587.

 vala/valaarraycreationexpression.vala  |    2 +-
 vala/valaarraytype.vala                |    2 +-
 vala/valacastexpression.vala           |    2 +-
 vala/valacatchclause.vala              |    5 +--
 vala/valaclass.vala                    |    8 ++---
 vala/valaconstant.vala                 |    2 +-
 vala/valadatatype.vala                 |    6 +--
 vala/valadelegate.vala                 |    2 +-
 vala/valaexpression.vala               |   61 ++-----------------------------
 vala/valaforeachstatement.vala         |    5 +--
 vala/valainterface.vala                |   10 ++----
 vala/valamemberaccess.vala             |    6 +--
 vala/valamethod.vala                   |    2 +-
 vala/valaobjectcreationexpression.vala |    2 +-
 vala/valapointertype.vala              |    2 +-
 vala/valaproperty.vala                 |    3 +-
 vala/valapropertyaccessor.vala         |    3 +-
 vala/valasignal.vala                   |    2 +-
 vala/valasizeofexpression.vala         |    2 +-
 vala/valatypeofexpression.vala         |    2 +-
 vala/valavariable.vala                 |    5 +--
 21 files changed, 33 insertions(+), 101 deletions(-)
---
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index c0f3830..3b52748 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -34,7 +34,7 @@ public class Vala.ArrayCreationExpression : Expression {
        public DataType element_type {
                get { return _element_type; }
                set {
-                       _element_type = value.copy ();
+                       _element_type = value;
                        _element_type.parent_node = this;
                }
        }
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 11bf1a7..b376723 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -32,7 +32,7 @@ public class Vala.ArrayType : ReferenceType {
        public DataType element_type {
                get { return _element_type; }
                set {
-                       _element_type = value.copy ();
+                       _element_type = value;
                        _element_type.parent_node = this;
                }
        }
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index c09e8ab..c7a72b6 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -44,7 +44,7 @@ public class Vala.CastExpression : Expression {
        public DataType type_reference {
                get { return _data_type; }
                set {
-                       _data_type = value.copy ();
+                       _data_type = value;
                        _data_type.parent_node = this;
                }
        }
diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala
index ef1f998..b2f20a4 100644
--- a/vala/valacatchclause.vala
+++ b/vala/valacatchclause.vala
@@ -31,9 +31,8 @@ public class Vala.CatchClause : CodeNode {
        public DataType? error_type {
                get { return _data_type; }
                set {
-                       _data_type = null;
-                       if (value != null) {
-                               _data_type = value.copy ();
+                       _data_type = value;
+                       if (_data_type != null) {
                                _data_type.parent_node = this;
                        }
                }
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index a88fb01..ba23a50 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -225,11 +225,10 @@ public class Vala.Class : ObjectTypeSymbol {
         * @param type a class or interface reference
         */
        public void add_base_type (DataType type) {
-               var copy = type.copy ();
-               base_types.add (copy);
-               copy.parent_node = this;
+               base_types.add (type);
+               type.parent_node = this;
        }
-       
+
        /**
         * Returns a copy of the base type list.
         *
@@ -557,7 +556,6 @@ public class Vala.Class : ObjectTypeSymbol {
                for (int i = 0; i < base_types.size; i++) {
                        if (base_types[i] == old_type) {
                                base_types[i] = new_type;
-                               new_type.parent_node = this;
                                return;
                        }
                }
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 0c789bd..53b84c6 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -32,7 +32,7 @@ public class Vala.Constant : Symbol, Lockable {
        public DataType type_reference {
                get { return _data_type; }
                set {
-                       _data_type = value.copy ();
+                       _data_type = value;
                        _data_type.parent_node = this;
                }
        }
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 376e1f1..085d321 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -71,9 +71,8 @@ public abstract class Vala.DataType : CodeNode {
                if (type_argument_list == null) {
                        type_argument_list = new ArrayList<DataType> ();
                }
-               var copy = arg.copy ();
-               type_argument_list.add (copy);
-               copy.parent_node = this;
+               type_argument_list.add (arg);
+               arg.parent_node = this;
        }
        
        /**
@@ -252,7 +251,6 @@ public abstract class Vala.DataType : CodeNode {
                        for (int i = 0; i < type_argument_list.size; i++) {
                                if (type_argument_list[i] == old_type) {
                                        type_argument_list[i] = new_type;
-                                       new_type.parent_node = this;
                                        return;
                                }
                        }
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 14f7ffa..d949c61 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -32,7 +32,7 @@ public class Vala.Delegate : TypeSymbol {
        public DataType return_type {
                get { return _return_type; }
                set {
-                       _return_type = value.copy ();
+                       _return_type = value;
                        _return_type.parent_node = this;
                }
        }
diff --git a/vala/valaexpression.vala b/vala/valaexpression.vala
index 96e037d..620086e 100644
--- a/vala/valaexpression.vala
+++ b/vala/valaexpression.vala
@@ -31,71 +31,18 @@ public abstract class Vala.Expression : CodeNode {
         * 
         * The semantic analyzer computes this value.
         */
-       public DataType value_type {
-               get {
-                       return _value_type;
-               }
-
-               set {
-                       _value_type = null;
-                       if (value != null) {
-                               _value_type = value.copy ();
-                               _value_type.parent_node = this;
-                       }
-               }
-       }
-
-       private DataType _value_type;
-
-       public DataType? formal_value_type {
-               get {
-                       return _formal_value_type;
-               }
-               set {
-                       _formal_value_type = null;
-                       if (value != null) {
-                               _formal_value_type = value.copy ();
-                               _formal_value_type.parent_node = this;
-                       }
-               }
-       }
+       public DataType value_type { get; set; }
 
-       private DataType _formal_value_type;
+       public DataType? formal_value_type { get; set; }
 
        /*
         * The static type this expression is expected to have.
         *
         * The semantic analyzer computes this value, lambda expressions use it.
         */
-       public DataType target_type {
-               get {
-                       return _target_type;
-               }
-               set {
-                       _target_type = null;
-                       if (value != null) {
-                               _target_type = value.copy ();
-                               _target_type.parent_node = this;
-                       }
-               }
-       }
-
-       private DataType _target_type;
-
-       public DataType? formal_target_type {
-               get {
-                       return _formal_target_type;
-               }
-               set {
-                       _formal_target_type = null;
-                       if (value != null) {
-                               _formal_target_type = value.copy ();
-                               _formal_target_type.parent_node = this;
-                       }
-               }
-       }
+       public DataType target_type { get; set; }
 
-       private DataType _formal_target_type;
+       public DataType? formal_target_type { get; set; }
 
        /**
         * The symbol this expression refers to.
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index e10192d..8c65222 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -32,9 +32,8 @@ public class Vala.ForeachStatement : Block {
        public DataType? type_reference {
                get { return _data_type; }
                set {
-                       _data_type = null;
-                       if (value != null) {
-                               _data_type = value.copy ();
+                       _data_type = value;
+                       if (_data_type != null) {
                                _data_type.parent_node = this;
                        }
                }
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index cc7ce13..49bc0ae 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -95,9 +95,8 @@ public class Vala.Interface : ObjectTypeSymbol {
         * @param type an interface or class reference
         */
        public void add_prerequisite (DataType type) {
-               var copy = type.copy ();
-               prerequisites.add (copy);
-               copy.parent_node = this;
+               prerequisites.add (type);
+               type.parent_node = this;
        }
 
        /**
@@ -107,9 +106,7 @@ public class Vala.Interface : ObjectTypeSymbol {
         * @param type an interface or class reference
         */
        public void prepend_prerequisite (DataType type) {
-               var copy = type.copy ();
-               prerequisites.insert (0, copy);
-               copy.parent_node = this;
+               prerequisites.insert (0, type);
        }
 
        /**
@@ -352,7 +349,6 @@ public class Vala.Interface : ObjectTypeSymbol {
                for (int i = 0; i < prerequisites.size; i++) {
                        if (prerequisites[i] == old_type) {
                                prerequisites[i] = new_type;
-                               new_type.parent_node = this;
                                return;
                        }
                }
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 156f9aa..af9f51f 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -102,9 +102,8 @@ public class Vala.MemberAccess : Expression {
         * @param arg a type reference
         */
        public void add_type_argument (DataType arg) {
-               var copy = arg.copy ();
-               type_argument_list.add (copy);
-               copy.parent_node = this;
+               type_argument_list.add (arg);
+               arg.parent_node = this;
        }
        
        /**
@@ -161,7 +160,6 @@ public class Vala.MemberAccess : Expression {
                for (int i = 0; i < type_argument_list.size; i++) {
                        if (type_argument_list[i] == old_type) {
                                type_argument_list[i] = new_type;
-                               new_type.parent_node = this;
                                return;
                        }
                }
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index eef04ab..663ae6f 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -36,7 +36,7 @@ public class Vala.Method : Subroutine {
        public DataType return_type {
                get { return _return_type; }
                set {
-                       _return_type = value.copy ();
+                       _return_type = value;
                        _return_type.parent_node = this;
                }
        }
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 56fb3ae..a4121f3 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -32,7 +32,7 @@ public class Vala.ObjectCreationExpression : Expression {
        public DataType type_reference {
                get { return _data_type; }
                set {
-                       _data_type = value.copy ();
+                       _data_type = value;
                        _data_type.parent_node = this;
                }
        }
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index 5ec9228..4bfaf34 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -32,7 +32,7 @@ public class Vala.PointerType : DataType {
        public DataType base_type {
                get { return _base_type; }
                set {
-                       _base_type = value.copy ();
+                       _base_type = value;
                        _base_type.parent_node = this;
                }
        }
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 300fb4d..8a8ced4 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -33,9 +33,8 @@ public class Vala.Property : Symbol, Lockable {
        public DataType? property_type {
                get { return _data_type; }
                set {
-                       _data_type = null;
+                       _data_type = value;
                        if (value != null) {
-                               _data_type = value.copy ();
                                _data_type.parent_node = this;
                        }
                }
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 3903ae8..466fe6c 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -39,9 +39,8 @@ public class Vala.PropertyAccessor : Subroutine {
        public DataType? value_type {
                get { return _value_type; }
                set {
-                       _value_type = null;
+                       _value_type = value;
                        if (value != null) {
-                               _value_type = value.copy ();
                                _value_type.parent_node = this;
                        }
                }
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 866760f..3ddc453 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -32,7 +32,7 @@ public class Vala.Signal : Symbol, Lockable {
        public DataType return_type {
                get { return _return_type; }
                set {
-                       _return_type = value.copy ();
+                       _return_type = value;
                        _return_type.parent_node = this;
                }
        }
diff --git a/vala/valasizeofexpression.vala b/vala/valasizeofexpression.vala
index 1fd80c4..42c1ee5 100644
--- a/vala/valasizeofexpression.vala
+++ b/vala/valasizeofexpression.vala
@@ -32,7 +32,7 @@ public class Vala.SizeofExpression : Expression {
        public DataType type_reference {
                get { return _data_type; }
                set {
-                       _data_type = value.copy ();
+                       _data_type = value;
                        _data_type.parent_node = this;
                }
        }
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 1e932f1..9b0e02e 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -32,7 +32,7 @@ public class Vala.TypeofExpression : Expression {
        public DataType type_reference {
                get { return _data_type; }
                set {
-                       _data_type = value.copy ();
+                       _data_type = value;
                        _data_type.parent_node = this;
                }
        }
diff --git a/vala/valavariable.vala b/vala/valavariable.vala
index a65fcbe..e625e66 100644
--- a/vala/valavariable.vala
+++ b/vala/valavariable.vala
@@ -42,9 +42,8 @@ public class Vala.Variable : Symbol {
        public DataType? variable_type {
                get { return _variable_type; }
                set {
-                       _variable_type = null;
-                       if (value != null) {
-                               _variable_type = value.copy ();
+                       _variable_type = value;
+                       if (_variable_type != null) {
                                _variable_type.parent_node = this;
                        }
                }


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