]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Convert last non-type-check-based usages of GenericType instances
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Dec 2017 19:34:21 +0000 (20:34 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Dec 2017 19:34:21 +0000 (20:34 +0100)
vala/valadatatype.vala
vala/valasignal.vala

index d3405543470f9bcea8c9a11c80c2289a2ab48885..2655e437ab622f3edd02bd0fbb73aea469fd3229 100644 (file)
@@ -197,11 +197,11 @@ public abstract class Vala.DataType : CodeNode {
                if (type2.data_type != data_type) {
                        return false;
                }
-               if (type2.type_parameter != null || type_parameter != null) {
-                       if (type2.type_parameter == null || type_parameter == null) {
+               if (type2 is GenericType || this is GenericType) {
+                       if (!(type2 is GenericType) || !(this is GenericType)) {
                                return false;
                        }
-                       if (!type2.type_parameter.equals (type_parameter)) {
+                       if (!((GenericType) type2).type_parameter.equals (((GenericType) this).type_parameter)) {
                                return false;
                        }
                }
@@ -240,7 +240,7 @@ public abstract class Vala.DataType : CodeNode {
                }
 
                /* temporarily ignore type parameters */
-               if (type_parameter != null || type2.type_parameter != null) {
+               if (this is GenericType || type2 is GenericType) {
                        return true;
                }
 
@@ -287,7 +287,7 @@ public abstract class Vala.DataType : CodeNode {
 
                if (target_type is PointerType) {
                        /* any reference or array type or pointer type can be cast to a generic pointer */
-                       if (type_parameter != null ||
+                       if (this is GenericType ||
                                (data_type != null && (
                                        data_type.is_reference_type () ||
                                        this is DelegateType))) {
@@ -298,7 +298,7 @@ public abstract class Vala.DataType : CodeNode {
                }
 
                /* temporarily ignore type parameters */
-               if (target_type.type_parameter != null) {
+               if (target_type is GenericType) {
                        return true;
                }
 
@@ -380,7 +380,7 @@ public abstract class Vala.DataType : CodeNode {
        public virtual bool is_reference_type_or_type_parameter () {
                return (data_type != null &&
                        data_type.is_reference_type ()) ||
-                      type_parameter != null;
+                      this is GenericType;
        }
 
        public virtual bool is_array () {
index d11180fb3977f51d9fa42d189ce3639561514ceb..d0a6ac0c3897d9a839bef024014fa7adc4249133 100644 (file)
@@ -138,8 +138,9 @@ public class Vala.Signal : Symbol, Lockable, Callable {
                        // parameter types must refer to the delegate type parameters
                        // instead of to the class type parameters
                        foreach (var param in generated_delegate.get_parameters ()) {
-                               if (param.variable_type is GenericType) {
-                                       param.variable_type.type_parameter = generated_delegate.get_type_parameters ().get (generated_delegate.get_type_parameter_index (param.variable_type.type_parameter.name));
+                               var generic_type = param.variable_type as GenericType;
+                               if (generic_type != null) {
+                                       generic_type.type_parameter = generated_delegate.get_type_parameters ().get (generated_delegate.get_type_parameter_index (generic_type.type_parameter.name));
                                }
                        }
                }