[vala/staging] vala: Convert last non-type-check-based usages of GenericType instances
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Convert last non-type-check-based usages of GenericType instances
- Date: Wed, 6 Dec 2017 19:59:38 +0000 (UTC)
commit 55be33eba965e5f52b2d58232aeb3a7891b8849b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Dec 6 20:34:21 2017 +0100
vala: Convert last non-type-check-based usages of GenericType instances
vala/valadatatype.vala | 14 +++++++-------
vala/valasignal.vala | 5 +++--
2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index d340554..2655e43 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 d11180f..d0a6ac0 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));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]