]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Revert errornous git push
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 14 Nov 2020 15:13:01 +0000 (16:13 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 14 Nov 2020 15:14:34 +0000 (16:14 +0100)
This reverts commit 9319f309dd97532a3174de995a83884739d70460.
This reverts commit 9ccdd25eaf0c57ac0cb18380b81d76a9d7113f7f.
This reverts commit 6689c356dade08a0d04a4d6f3add15a71125e925.
This reverts commit 4f560d0bb2753bed14b2f0688f2d3e686a39d6ca.

17 files changed:
codegen/valaccodebasemodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valaglibvalue.vala
codegen/valagvaluemodule.vala
codegen/valagvariantmodule.vala
vala/valabaseaccess.vala
vala/valabinaryexpression.vala
vala/valabooleanliteral.vala
vala/valacastexpression.vala
vala/valaelementaccess.vala
vala/valaparameter.vala
vala/valapointerindirection.vala
vala/valasizeofexpression.vala
vala/valatargetvalue.vala
vala/valatypecheck.vala
vala/valatypeofexpression.vala
vala/valaunaryexpression.vala

index c6391d387f4fedb845ad573752aff766145eb439..9a801e36986d26fe98ccff3d133d6a0643a548de 100644 (file)
@@ -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;
index 6abc25e2d1b489f089d28b72da4cddc3036d6db7..2d10ad046a845714975dded7cb734b18eafc876c 100644 (file)
@@ -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
index 3437c10e36453654d7426f77854414f62f28ef2a..ed095cf838e9bdb2bfbb60ade050a668ca980c4a 100644 (file)
@@ -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;
index 2b13d473d814ce1d577edce903bd3865af5ec0af..0429085e6b44b8f1a1182759a1caa53bb28ced3f 100644 (file)
@@ -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
index 5190efd9c5b63bb3ed363b44782798aa7188f6fc..03a7193aa38e10fd82511d6428477283c1affc42 100644 (file)
@@ -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);
index 32458feee610c956d57f202b4a0e08d7411a3ee1..14258af144cd12583a9d3b0c7afb2533a2e3ba40 100644 (file)
@@ -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");
index f434ba87782b6c135c9d2b93e59f7edc9803a8cc..f831c7cb7b2b61df73ab95584234b4e0c32f5c5d 100644 (file)
@@ -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;
index 0cef20d6f9694b126d8a9aa7926c562d554f3f4d..db3a6b5cfd237680ce8238c9d7acc540b59fbd9b 100644 (file)
@@ -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;
        }
index 0bc9d5cbf3e93e670fb3b0216a837b1688c74c4b..86b9f9a1289f0ffbaadfb56b0610e7c2483ae947 100644 (file)
@@ -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;
 
index fb1c764fbda36021b7055f963b24666322e0ab16..d866d2f0b894c32df0ae1dd170f5d203ca6064b4 100644 (file)
@@ -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;
index 05a1e9f659230776fefdba2328c51236d73b239c..41a59da6105a80a12ff9363eefbaa9f23d21456d 100644 (file)
@@ -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) {
index 0397eb37ca6212d2513ec049284b181d3313cb70..bcf32b548228b64feb3dde7985317504c20c43d7 100644 (file)
@@ -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");
index 53ad29038c83204b119cb31fbb5ef37aa5ef6229..1942b8eede2282f24eea3c534a2213c938d9709c 100644 (file)
@@ -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;
        }
index 6cd67645f9ef63ebafa8a75984ad378d9c25ecf1..4cdbccc276db60d803a8852475c08478ce8f0686 100644 (file)
  */
 
 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;
        }
 }
index d031e842b60214dc13efce5483f838ac235841fd..848b4f45743224c8eae9369138669b7f6845b39e 100644 (file)
@@ -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;
        }
index 97259afb1478b06d53a203e1b3d9af70d9ea8734..2449b6086fad8db3fe67a51a7a1373f10bc57a0a 100644 (file)
@@ -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");
index a46a4a9c26ddc5cf369d9f311c878af424541083..76c31cd7aba254913cf427b2bf200cbdf594e1da 100644 (file)
@@ -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");