[vala: 7/8] vala: More copying of dedicated data-type instances for code-nodes




commit 9ccdd25eaf0c57ac0cb18380b81d76a9d7113f7f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Nov 13 22:51:53 2020 +0100

    vala: More copying of dedicated data-type instances for code-nodes

 codegen/valaccodemethodcallmodule.vala |  4 ++--
 vala/valabaseaccess.vala               |  2 +-
 vala/valabinaryexpression.vala         | 10 +++++-----
 vala/valabooleanliteral.vala           |  2 +-
 vala/valacastexpression.vala           |  2 +-
 vala/valaelementaccess.vala            |  2 +-
 vala/valapointerindirection.vala       |  2 +-
 vala/valasizeofexpression.vala         |  2 +-
 vala/valatypecheck.vala                |  2 +-
 vala/valatypeofexpression.vala         |  2 +-
 vala/valaunaryexpression.vala          | 10 +++++-----
 11 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 2d10ad046..c196928c8 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -431,7 +431,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                                var temp_var = get_temp_variable (param.variable_type, 
param.variable_type.value_owned, null, true);
                                                emit_temp_var (temp_var);
                                                set_cvalue (arg, get_variable_cexpression (temp_var.name));
-                                               arg.target_value.value_type = arg.target_type;
+                                               arg.target_value.value_type = arg.target_type.copy ();
 
                                                cexpr = new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, get_cvalue (arg));
 
@@ -476,7 +476,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                        var temp_var = get_temp_variable (arg.value_type, 
arg.value_type.value_owned, null, true);
                                        emit_temp_var (temp_var);
                                        set_cvalue (arg, get_variable_cexpression (temp_var.name));
-                                       arg.target_value.value_type = arg.value_type;
+                                       arg.target_value.value_type = arg.value_type.copy ();
 
                                        if (arg.value_type is DelegateType && ((DelegateType) 
arg.value_type).delegate_symbol.has_target) {
                                                // Initialize target/destroy cvalues to allow assignment of 
delegates from varargs
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index 14258af14..32458feee 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -72,7 +72,7 @@ public class Vala.BaseAccess : Expression {
                                Report.error (source_reference, "Base access invalid without base type");
                                return false;
                        }
-                       value_type = context.analyzer.current_struct.base_type;
+                       value_type = context.analyzer.current_struct.base_type.copy ();
                } else if (context.analyzer.current_class.base_class == null) {
                        error = true;
                        Report.error (source_reference, "Base access invalid without base class");
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index f831c7cb7..f434ba877 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -416,7 +416,7 @@ public class Vala.BinaryExpression : Expression {
                                        }
                                } else if (right.value_type is PointerType) {
                                        // pointer arithmetic: pointer - pointer
-                                       value_type = context.analyzer.size_t_type;
+                                       value_type = context.analyzer.size_t_type.copy ();
                                }
                        } else {
                                left.target_type.nullable = false;
@@ -480,7 +480,7 @@ public class Vala.BinaryExpression : Expression {
                                right.target_type.nullable = false;
                        }
 
-                       value_type = context.analyzer.bool_type;
+                       value_type = context.analyzer.bool_type.copy ();
                        break;
                case BinaryOperator.EQUALITY:
                case BinaryOperator.INEQUALITY:
@@ -534,7 +534,7 @@ public class Vala.BinaryExpression : Expression {
                                right.target_type.nullable = true;
                        }
 
-                       value_type = context.analyzer.bool_type;
+                       value_type = context.analyzer.bool_type.copy ();
                        break;
                case BinaryOperator.BITWISE_AND:
                case BinaryOperator.BITWISE_OR:
@@ -560,7 +560,7 @@ public class Vala.BinaryExpression : Expression {
                        left.target_type.nullable = false;
                        right.target_type.nullable = false;
 
-                       value_type = context.analyzer.bool_type;
+                       value_type = context.analyzer.bool_type.copy ();
                        break;
                case BinaryOperator.IN:
                        if (left.value_type.compatible (context.analyzer.int_type)
@@ -598,7 +598,7 @@ public class Vala.BinaryExpression : Expression {
                                return contains_call.check (context);
                        }
 
-                       value_type = context.analyzer.bool_type;
+                       value_type = context.analyzer.bool_type.copy ();
                        break;
                default:
                        error = true;
diff --git a/vala/valabooleanliteral.vala b/vala/valabooleanliteral.vala
index db3a6b5cf..0cef20d6f 100644
--- a/vala/valabooleanliteral.vala
+++ b/vala/valabooleanliteral.vala
@@ -68,7 +68,7 @@ public class Vala.BooleanLiteral : Literal {
 
                checked = true;
 
-               value_type = context.analyzer.bool_type;
+               value_type = context.analyzer.bool_type.copy ();
 
                return !error;
        }
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 86b9f9a12..0bc9d5cbf 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -193,7 +193,7 @@ public class Vala.CastExpression : Expression {
                        return temp_access.check (context);
                }
 
-               value_type = type_reference;
+               value_type = type_reference.copy ();
                value_type.value_owned = inner.value_type.value_owned;
                value_type.floating_reference = inner.value_type.floating_reference;
 
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index d866d2f0b..fb1c764fb 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -209,7 +209,7 @@ public class Vala.ElementAccess : Expression {
                        index_int_type_check = false;
 
                        symbol_reference = container.symbol_reference;
-                       value_type = container.value_type;
+                       value_type = container.value_type.copy ();
                } else {
                        if (lvalue) {
                                var set_method = container.value_type.get_member ("set") as Method;
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index bcf32b548..0397eb37c 100644
--- a/vala/valapointerindirection.vala
+++ b/vala/valapointerindirection.vala
@@ -101,7 +101,7 @@ public class Vala.PointerIndirection : Expression {
                                Report.error (source_reference, "Pointer indirection not supported for this 
expression");
                                return false;
                        }
-                       value_type = pointer_type.base_type;
+                       value_type = pointer_type.base_type.copy ();
                } else {
                        error = true;
                        Report.error (source_reference, "Pointer indirection not supported for this 
expression");
diff --git a/vala/valasizeofexpression.vala b/vala/valasizeofexpression.vala
index 1942b8eed..53ad29038 100644
--- a/vala/valasizeofexpression.vala
+++ b/vala/valasizeofexpression.vala
@@ -84,7 +84,7 @@ public class Vala.SizeofExpression : Expression {
 
                type_reference.check (context);
 
-               value_type = context.analyzer.ulong_type;
+               value_type = context.analyzer.ulong_type.copy ();
 
                return !error;
        }
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 848b4f457..d031e842b 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -126,7 +126,7 @@ public class Vala.TypeCheck : Expression {
                        Report.warning (_data_type.source_reference, "Type argument list has no effect");
                }
 
-               value_type = context.analyzer.bool_type;
+               value_type = context.analyzer.bool_type.copy ();
 
                return !error;
        }
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 2449b6086..97259afb1 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -80,7 +80,7 @@ public class Vala.TypeofExpression : Expression {
 
                type_reference.check (context);
 
-               value_type = context.analyzer.type_type;
+               value_type = context.analyzer.type_type.copy ();
 
                if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) {
                        Report.warning (_data_type.source_reference, "Type argument list without effect");
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index 76c31cd7a..a46a4a9c2 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -176,7 +176,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type;
+                       value_type = inner.value_type.copy ();
                        break;
                case UnaryOperator.LOGICAL_NEGATION:
                        // boolean type
@@ -186,7 +186,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type;
+                       value_type = inner.value_type.copy ();
                        break;
                case UnaryOperator.BITWISE_COMPLEMENT:
                        // integer type
@@ -196,7 +196,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type;
+                       value_type = inner.value_type.copy ();
                        break;
                case UnaryOperator.INCREMENT:
                case UnaryOperator.DECREMENT:
@@ -214,7 +214,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type;
+                       value_type = inner.value_type.copy ();
                        break;
                case UnaryOperator.REF:
                case UnaryOperator.OUT:
@@ -223,7 +223,7 @@ public class Vala.UnaryExpression : Expression {
                            (ea != null && ea.container.value_type is ArrayType)) {
                                // ref and out can only be used with fields, parameters, local variables, and 
array element access
                                lvalue = true;
-                               value_type = inner.value_type;
+                               value_type = inner.value_type.copy ();
                        } else {
                                error = true;
                                Report.error (source_reference, "ref and out method arguments can only be 
used with fields, parameters, local variables, and array element access");


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