From: Rico Tzschichholz Date: Wed, 6 Dec 2017 19:34:21 +0000 (+0100) Subject: vala: Convert last non-type-check-based usages of GenericType instances X-Git-Tag: 0.39.2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55be33eba965e5f52b2d58232aeb3a7891b8849b;p=thirdparty%2Fvala.git vala: Convert last non-type-check-based usages of GenericType instances --- diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala index d34055434..2655e437a 100644 --- a/vala/valadatatype.vala +++ b/vala/valadatatype.vala @@ -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 () { diff --git a/vala/valasignal.vala b/vala/valasignal.vala index d11180fb3..d0a6ac0c3 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -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)); } } }