From: Luca Bruno Date: Mon, 7 Oct 2013 18:50:47 +0000 (+0200) Subject: Revert "Set parent_node and always copy datatype when assigned to code nodes." X-Git-Tag: 0.22.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5764bac40da1cd4124ff9e16484c5971ffc07d57;p=thirdparty%2Fvala.git Revert "Set parent_node and always copy datatype when assigned to code nodes." This reverts commit a09c9e93af0d64b9331c274de573465fe070b722. Fixes bug 709587. --- diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala index c0f38300f..3b52748ff 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 11bf1a720..b37672335 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 c09e8abdc..c7a72b6f2 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 ef1f99840..b2f20a491 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 a88fb01ee..ba23a508f 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 0c789bd20..53b84c60e 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 376e1f172..085d321e0 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 (); } - 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 14f7ffade..d949c611f 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 96e037d02..620086e98 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 e10192d89..8c6522229 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 cc7ce13aa..49bc0ae2c 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 156f9aa91..af9f51f38 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 eef04ab72..663ae6fdf 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 56fb3ae34..a4121f3aa 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 5ec9228c5..4bfaf34ee 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 300fb4dd1..8a8ced49b 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 3903ae835..466fe6c18 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 866760fe2..3ddc453b3 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 1fd80c456..42c1ee599 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 1e932f16f..9b0e02e13 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 a65fcbeb2..e625e660b 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; } }