Commit 5764bac4 authored by Luca Bruno's avatar Luca Bruno

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

This reverts commit a09c9e93.

Fixes bug 709587.
parent a09c9e93
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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.
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment