[vala] Revert errornous git push



commit 50b373b68474732225a89f3476bb46dd9c0012c0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Nov 14 16:13:01 2020 +0100

    Revert errornous git push
    
    This reverts commit 9319f309dd97532a3174de995a83884739d70460.
    This reverts commit 9ccdd25eaf0c57ac0cb18380b81d76a9d7113f7f.
    This reverts commit 6689c356dade08a0d04a4d6f3add15a71125e925.
    This reverts commit 4f560d0bb2753bed14b2f0688f2d3e686a39d6ca.

 codegen/valaccodebasemodule.vala       | 46 +++++++++-------------------------
 codegen/valaccodemethodcallmodule.vala |  5 ++--
 codegen/valaglibvalue.vala             |  2 +-
 codegen/valagvaluemodule.vala          |  2 +-
 codegen/valagvariantmodule.vala        |  2 +-
 vala/valabaseaccess.vala               |  2 +-
 vala/valabinaryexpression.vala         | 10 ++++----
 vala/valabooleanliteral.vala           |  2 +-
 vala/valacastexpression.vala           |  2 +-
 vala/valaelementaccess.vala            |  2 +-
 vala/valaparameter.vala                |  5 ----
 vala/valapointerindirection.vala       |  2 +-
 vala/valasizeofexpression.vala         |  2 +-
 vala/valatargetvalue.vala              |  4 +--
 vala/valatypecheck.vala                |  2 +-
 vala/valatypeofexpression.vala         |  2 +-
 vala/valaunaryexpression.vala          | 10 ++++----
 17 files changed, 37 insertions(+), 65 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c6391d387..9a801e369 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2720,12 +2720,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public TargetValue store_temp_value (TargetValue initializer, CodeNode node_reference, bool? 
value_owned = null) {
                var lvalue = create_temp_value (initializer.value_type, false, node_reference, value_owned);
                store_value (lvalue, initializer, node_reference.source_reference);
-               if (lvalue.value_type is ArrayType) {
-                       stdout.printf ("%s tweaked\n", node_reference.to_string ());
-                       /*((GLibValue) lvalue).array_length_cvalues = null;
-                       ((GLibValue) lvalue).array_size_cvalue = null;
-                       ((GLibValue) lvalue).array_length_cexpr = null;*/
-               }
                return load_temp_value (lvalue);
        }
 
@@ -5230,12 +5224,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_sizeof_expression (SizeofExpression expr) {
-               // FIXME
-               if (expr.value_type == null) {
-                       warning ("BAD %s\n", expr.to_string ());
-                       expr.value_type = context.analyzer.ulong_type.copy ();
-               }
-
                generate_type_declaration (expr.type_reference, cfile);
 
                var csizeof = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
@@ -5250,7 +5238,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_unary_expression (UnaryExpression expr) {
-               assert (expr.checked);
                if (expr.operator == UnaryOperator.REF || expr.operator == UnaryOperator.OUT) {
                        var glib_value = (GLibValue) expr.inner.target_value;
 
@@ -5343,15 +5330,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return;
                }
 
-               unowned DataType? value_type = expr.inner.value_type;
-               unowned DataType? target_type = expr.target_type;
-
                generate_type_declaration (expr.type_reference, cfile);
 
                // recompute array length when casting to other array type
-               unowned ArrayType array_type = target_type as ArrayType;
-               if (array_type != null && value_type is ArrayType) {
-                       if (array_type.element_type is GenericType || ((ArrayType) value_type).element_type 
is GenericType) {
+               var array_type = expr.type_reference as ArrayType;
+               if (array_type != null && expr.inner.value_type is ArrayType) {
+                       if (array_type.element_type is GenericType || ((ArrayType) 
expr.inner.value_type).element_type is GenericType) {
                                // element size unknown for generic arrays, retain array length as is
                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                        append_array_length (expr, get_array_length_cexpression (expr.inner, 
dim));
@@ -5361,7 +5345,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                sizeof_to.add_argument (new CCodeConstant (get_ccode_name 
(array_type.element_type)));
 
                                var sizeof_from = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-                               sizeof_from.add_argument (new CCodeConstant (get_ccode_name (((ArrayType) 
value_type).element_type)));
+                               sizeof_from.add_argument (new CCodeConstant (get_ccode_name (((ArrayType) 
expr.inner.value_type).element_type)));
 
                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                        append_array_length (expr, new CCodeBinaryExpression 
(CCodeBinaryOperator.DIV, new CCodeBinaryExpression (CCodeBinaryOperator.MUL, get_array_length_cexpression 
(expr.inner, dim), sizeof_from), sizeof_to));
@@ -5374,6 +5358,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        sizeof_to.add_argument (new CCodeConstant (get_ccode_name (array_type.element_type)));
                        var sizeof_from = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
 
+                       var value_type = expr.inner.value_type;
                        if (value_type is ValueType) {
                                sizeof_from.add_argument (new CCodeConstant (get_ccode_name 
(value_type.type_symbol)));
                                array_length_expr = new CCodeBinaryExpression (CCodeBinaryOperator.DIV, 
sizeof_from, sizeof_to);
@@ -5392,22 +5377,22 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                }
 
                var innercexpr = get_cvalue (expr.inner);
-               if (target_type is ValueType && !target_type.nullable &&
-                       value_type is ValueType && value_type.nullable) {
+               if (expr.type_reference is ValueType && !expr.type_reference.nullable &&
+                       expr.inner.value_type is ValueType && expr.inner.value_type.nullable) {
                        // nullable integer or float or boolean or struct or enum cast to non-nullable
                        innercexpr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, 
innercexpr);
-               } else if (target_type is ValueType && target_type.nullable &&
-                       value_type.is_real_non_null_struct_type ()) {
+               } else if (expr.type_reference is ValueType && expr.type_reference.nullable &&
+                       expr.inner.value_type.is_real_non_null_struct_type ()) {
                        // real non-null struct cast to nullable
                        innercexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, innercexpr);
-               } else if (target_type is ArrayType && !(expr.inner is Literal)
-                   && value_type is ValueType && !value_type.nullable) {
+               } else if (expr.type_reference is ArrayType && !(expr.inner is Literal)
+                   && expr.inner.value_type is ValueType && !expr.inner.value_type.nullable) {
                        // integer or float or boolean or struct or enum to array cast
                        innercexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, innercexpr);
                }
                set_cvalue (expr, new CCodeCastExpression (innercexpr, get_ccode_name (expr.type_reference)));
 
-               if (target_type is DelegateType) {
+               if (expr.type_reference is DelegateType) {
                        var target = get_delegate_target (expr.inner);
                        if (target != null) {
                                set_delegate_target (expr, target);
@@ -5858,13 +5843,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_type_check (TypeCheck expr) {
-               assert (expr.checked);
-               // FIXME
-               if (expr.value_type == null) {
-                       warning ("BAD %s\n", expr.to_string ());
-                       expr.value_type = context.analyzer.bool_type.copy ();
-               }
-
                generate_type_declaration (expr.type_reference, cfile);
 
                var type = expr.expression.value_type;
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 6abc25e2d..2d10ad046 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -431,8 +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));
-                                               stdout.printf ("%s.%s\n", param.parent_symbol.to_string (), 
param.name);
-                                               arg.target_value.value_type = arg.target_type.copy ();
+                                               arg.target_value.value_type = arg.target_type;
 
                                                cexpr = new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, get_cvalue (arg));
 
@@ -477,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.copy ();
+                                       arg.target_value.value_type = arg.value_type;
 
                                        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/codegen/valaglibvalue.vala b/codegen/valaglibvalue.vala
index 3437c10e3..ed095cf83 100644
--- a/codegen/valaglibvalue.vala
+++ b/codegen/valaglibvalue.vala
@@ -36,7 +36,7 @@ public class Vala.GLibValue : TargetValue {
        public CCodeExpression? delegate_target_cvalue;
        public CCodeExpression? delegate_target_destroy_notify_cvalue;
 
-       public GLibValue (DataType value_type, CCodeExpression? cvalue = null, bool lvalue = false) {
+       public GLibValue (DataType? value_type = null, CCodeExpression? cvalue = null, bool lvalue = false) {
                base (value_type);
                this.cvalue = cvalue;
                this.lvalue = lvalue;
diff --git a/codegen/valagvaluemodule.vala b/codegen/valagvaluemodule.vala
index 2b13d473d..0429085e6 100644
--- a/codegen/valagvaluemodule.vala
+++ b/codegen/valagvaluemodule.vala
@@ -23,7 +23,7 @@
 public class Vala.GValueModule : GAsyncModule {
        public override void visit_cast_expression (CastExpression expr) {
                unowned DataType? value_type = expr.inner.value_type;
-               unowned DataType? target_type = expr.target_type;
+               unowned DataType? target_type = expr.type_reference;
 
                if (expr.is_non_null_cast || value_type == null || gvalue_type == null
                    || value_type.type_symbol != gvalue_type || target_type.type_symbol == gvalue_type
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index 5190efd9c..03a7193aa 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -104,7 +104,7 @@ public class Vala.GVariantModule : GValueModule {
 
        public override void visit_cast_expression (CastExpression expr) {
                var value = expr.inner.target_value;
-               unowned DataType? target_type = expr.target_type;
+               var target_type = expr.type_reference;
 
                if (expr.is_non_null_cast || value.value_type == null || gvariant_type == null || 
value.value_type.type_symbol != gvariant_type) {
                        base.visit_cast_expression (expr);
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index 32458feee..14258af14 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.copy ();
+                       value_type = context.analyzer.current_struct.base_type;
                } 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 f434ba877..f831c7cb7 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.copy ();
+                                       value_type = context.analyzer.size_t_type;
                                }
                        } 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.copy ();
+                       value_type = context.analyzer.bool_type;
                        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.copy ();
+                       value_type = context.analyzer.bool_type;
                        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.copy ();
+                       value_type = context.analyzer.bool_type;
                        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.copy ();
+                       value_type = context.analyzer.bool_type;
                        break;
                default:
                        error = true;
diff --git a/vala/valabooleanliteral.vala b/vala/valabooleanliteral.vala
index 0cef20d6f..db3a6b5cf 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.copy ();
+               value_type = context.analyzer.bool_type;
 
                return !error;
        }
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 0bc9d5cbf..86b9f9a12 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.copy ();
+               value_type = type_reference;
                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 fb1c764fb..d866d2f0b 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.copy ();
+                       value_type = container.value_type;
                } else {
                        if (lvalue) {
                                var set_method = container.value_type.get_member ("set") as Method;
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 05a1e9f65..41a59da61 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -138,11 +138,6 @@ public class Vala.Parameter : Variable {
                if (source_reference != null) {
                        context.analyzer.current_source_file = source_reference.file;
                }
-               
-               if (parent_symbol == null) {
-                       stdout.printf ("%s\n", name);
-                       assert_not_reached ();
-               }
                context.analyzer.current_symbol = parent_symbol;
 
                if (variable_type != null) {
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index 0397eb37c..bcf32b548 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.copy ();
+                       value_type = pointer_type.base_type;
                } 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 53ad29038..1942b8eed 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.copy ();
+               value_type = context.analyzer.ulong_type;
 
                return !error;
        }
diff --git a/vala/valatargetvalue.vala b/vala/valatargetvalue.vala
index 6cd67645f..4cdbccc27 100644
--- a/vala/valatargetvalue.vala
+++ b/vala/valatargetvalue.vala
@@ -21,10 +21,10 @@
  */
 
 public abstract class Vala.TargetValue {
-       public DataType value_type { get; set; }
+       public DataType? value_type { get; set; }
        public DataType? actual_value_type { get; set; }
 
-       protected TargetValue (DataType value_type) {
+       protected TargetValue (DataType? value_type) {
                this.value_type = value_type;
        }
 }
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index d031e842b..848b4f457 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.copy ();
+               value_type = context.analyzer.bool_type;
 
                return !error;
        }
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 97259afb1..2449b6086 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.copy ();
+               value_type = context.analyzer.type_type;
 
                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 a46a4a9c2..76c31cd7a 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.copy ();
+                       value_type = inner.value_type;
                        break;
                case UnaryOperator.LOGICAL_NEGATION:
                        // boolean type
@@ -186,7 +186,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type.copy ();
+                       value_type = inner.value_type;
                        break;
                case UnaryOperator.BITWISE_COMPLEMENT:
                        // integer type
@@ -196,7 +196,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type.copy ();
+                       value_type = inner.value_type;
                        break;
                case UnaryOperator.INCREMENT:
                case UnaryOperator.DECREMENT:
@@ -214,7 +214,7 @@ public class Vala.UnaryExpression : Expression {
                                return false;
                        }
 
-                       value_type = inner.value_type.copy ();
+                       value_type = inner.value_type;
                        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.copy ();
+                               value_type = inner.value_type;
                        } 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]