[vala/staging] vala: Unify backing symbol instance of data-types
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Unify backing symbol instance of data-types
- Date: Mon, 30 Sep 2019 14:22:19 +0000 (UTC)
commit 29a3caef34597b0d9d7f87891d011a67c54dd17a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Mar 12 16:51:23 2019 +0100
vala: Unify backing symbol instance of data-types
vala/valaarraytype.vala | 1 +
vala/valabooleantype.vala | 2 +-
vala/valacallabletype.vala | 4 ++++
vala/valaclasstype.vala | 8 ++++++--
vala/valadatatype.vala | 15 ++++++++++++++-
vala/valadelegatetype.vala | 8 ++++++--
vala/valaenumvaluetype.vala | 2 +-
vala/valaerrortype.vala | 9 ++++++---
vala/valafloatingtype.vala | 2 +-
vala/valaintegertype.vala | 2 +-
vala/valainterfacetype.vala | 8 ++++++--
vala/valamethodtype.vala | 8 ++++++--
vala/valanulltype.vala | 1 +
vala/valaobjecttype.vala | 9 ++++++---
vala/valareferencetype.vala | 3 +++
vala/valasignaltype.vala | 8 ++++++--
vala/valastructvaluetype.vala | 2 +-
vala/valavaluetype.vala | 4 ++++
18 files changed, 74 insertions(+), 22 deletions(-)
---
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 934af80b6..762168933 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -84,6 +84,7 @@ public class Vala.ArrayType : ReferenceType {
private ArrayCopyMethod copy_method;
public ArrayType (DataType element_type, int rank, SourceReference? source_reference) {
+ base (null);
this.element_type = element_type;
this.rank = rank;
this.source_reference = source_reference;
diff --git a/vala/valabooleantype.vala b/vala/valabooleantype.vala
index 13b0f04c7..b224a9359 100644
--- a/vala/valabooleantype.vala
+++ b/vala/valabooleantype.vala
@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.BooleanType : ValueType {
public BooleanType (Struct type_symbol) {
- this.type_symbol = type_symbol;
+ base (type_symbol);
}
public override DataType copy () {
diff --git a/vala/valacallabletype.vala b/vala/valacallabletype.vala
index dd883b079..c41e34cc9 100644
--- a/vala/valacallabletype.vala
+++ b/vala/valacallabletype.vala
@@ -26,6 +26,10 @@ using GLib;
* A callable type, i.e. a delegate, method, or signal type.
*/
public abstract class Vala.CallableType : DataType {
+ protected CallableType (Symbol symbol) {
+ base.with_symbol (symbol);
+ }
+
public override string to_prototype_string (string? override_name = null) {
StringBuilder builder = new StringBuilder ();
diff --git a/vala/valaclasstype.vala b/vala/valaclasstype.vala
index 20841cf13..39681225a 100644
--- a/vala/valaclasstype.vala
+++ b/vala/valaclasstype.vala
@@ -29,10 +29,14 @@ public class Vala.ClassType : ReferenceType {
/**
* The referred class.
*/
- public weak Class class_symbol { get; set; }
+ public weak Class class_symbol{
+ get {
+ return (Class) symbol;
+ }
+ }
public ClassType (Class class_symbol) {
- this.class_symbol = class_symbol;
+ base (class_symbol);
}
public override DataType copy () {
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index f4013136e..02cae4d61 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -39,10 +39,19 @@ public abstract class Vala.DataType : CodeNode {
*/
public bool nullable { get; set; }
+ /**
+ * The referred symbol.
+ */
+ public weak Symbol? symbol { get; private set; }
+
/**
* The referred type symbol.
*/
- public weak TypeSymbol type_symbol { get; set; }
+ public weak TypeSymbol? type_symbol {
+ get {
+ return symbol as TypeSymbol;
+ }
+ }
/**
* Specifies that the expression transfers a floating reference.
@@ -57,6 +66,10 @@ public abstract class Vala.DataType : CodeNode {
private List<DataType> type_argument_list;
private static List<DataType> _empty_type_list;
+ protected DataType.with_symbol (Symbol? symbol) {
+ this.symbol = symbol;
+ }
+
/**
* Appends the specified type as generic type argument.
*
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 01fd0d268..1de80c509 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -26,12 +26,16 @@ using GLib;
* The type of an instance of a delegate.
*/
public class Vala.DelegateType : CallableType {
- public weak Delegate delegate_symbol { get; set; }
+ public weak Delegate delegate_symbol {
+ get {
+ return (Delegate) symbol;
+ }
+ }
public bool is_called_once { get; set; }
public DelegateType (Delegate delegate_symbol) {
- this.delegate_symbol = delegate_symbol;
+ base (delegate_symbol);
this.is_called_once = (delegate_symbol.get_attribute_string ("CCode", "scope") == "async");
}
diff --git a/vala/valaenumvaluetype.vala b/vala/valaenumvaluetype.vala
index 0e2579295..6c6aca398 100644
--- a/vala/valaenumvaluetype.vala
+++ b/vala/valaenumvaluetype.vala
@@ -29,7 +29,7 @@ public class Vala.EnumValueType : ValueType {
private Method? to_string_method;
public EnumValueType (Enum type_symbol) {
- this.type_symbol = type_symbol;
+ base (type_symbol);
}
public override DataType copy () {
diff --git a/vala/valaerrortype.vala b/vala/valaerrortype.vala
index 09c58ceb8..868a41b28 100644
--- a/vala/valaerrortype.vala
+++ b/vala/valaerrortype.vala
@@ -30,7 +30,11 @@ public class Vala.ErrorType : ReferenceType {
/**
* The error domain or null for generic error.
*/
- public weak ErrorDomain? error_domain { get; set; }
+ public weak ErrorDomain? error_domain {
+ get {
+ return symbol as ErrorDomain;
+ }
+ }
/**
* The error code or null for generic error.
@@ -40,8 +44,7 @@ public class Vala.ErrorType : ReferenceType {
public bool dynamic_error { get; set; }
public ErrorType (ErrorDomain? error_domain, ErrorCode? error_code, SourceReference? source_reference
= null) {
- this.error_domain = error_domain;
- this.type_symbol = error_domain;
+ base (error_domain);
this.error_code = error_code;
this.source_reference = source_reference;
}
diff --git a/vala/valafloatingtype.vala b/vala/valafloatingtype.vala
index 060080919..83c4abee6 100644
--- a/vala/valafloatingtype.vala
+++ b/vala/valafloatingtype.vala
@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.FloatingType : ValueType {
public FloatingType (Struct type_symbol) {
- this.type_symbol = type_symbol;
+ base (type_symbol);
}
public override DataType copy () {
diff --git a/vala/valaintegertype.vala b/vala/valaintegertype.vala
index 5b1caa024..953958667 100644
--- a/vala/valaintegertype.vala
+++ b/vala/valaintegertype.vala
@@ -30,7 +30,7 @@ public class Vala.IntegerType : ValueType {
string? literal_type_name;
public IntegerType (Struct type_symbol, string? literal_value = null, string? literal_type_name =
null) {
- this.type_symbol = type_symbol;
+ base (type_symbol);
this.literal_value = literal_value;
this.literal_type_name = literal_type_name;
}
diff --git a/vala/valainterfacetype.vala b/vala/valainterfacetype.vala
index 6187044d1..90d20190c 100644
--- a/vala/valainterfacetype.vala
+++ b/vala/valainterfacetype.vala
@@ -29,10 +29,14 @@ public class Vala.InterfaceType : ReferenceType {
/**
* The referred interface.
*/
- public weak Interface interface_symbol { get; set; }
+ public weak Interface interface_symbol {
+ get {
+ return (Interface) symbol;
+ }
+ }
public InterfaceType (Interface interface_symbol) {
- this.interface_symbol = interface_symbol;
+ base (interface_symbol);
}
public override DataType copy () {
diff --git a/vala/valamethodtype.vala b/vala/valamethodtype.vala
index 4ced128eb..b59b3f375 100644
--- a/vala/valamethodtype.vala
+++ b/vala/valamethodtype.vala
@@ -26,10 +26,14 @@ using GLib;
* The type of a method referencea.
*/
public class Vala.MethodType : CallableType {
- public weak Method method_symbol { get; set; }
+ public weak Method method_symbol {
+ get {
+ return (Method) symbol;
+ }
+ }
public MethodType (Method method_symbol) {
- this.method_symbol = method_symbol;
+ base (method_symbol);
}
public override bool is_invokable () {
diff --git a/vala/valanulltype.vala b/vala/valanulltype.vala
index 92b02c8c0..ddb8c72b8 100644
--- a/vala/valanulltype.vala
+++ b/vala/valanulltype.vala
@@ -27,6 +27,7 @@ using GLib;
*/
public class Vala.NullType : ReferenceType {
public NullType (SourceReference? source_reference) {
+ base (null);
this.nullable = true;
this.source_reference = source_reference;
}
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index 999b746fa..97b56e169 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -29,11 +29,14 @@ public class Vala.ObjectType : ReferenceType {
/**
* The referred class or interface.
*/
- public weak ObjectTypeSymbol object_type_symbol { get; set; }
+ public weak ObjectTypeSymbol object_type_symbol {
+ get {
+ return (ObjectTypeSymbol) symbol;
+ }
+ }
public ObjectType (ObjectTypeSymbol type_symbol) {
- this.type_symbol = type_symbol;
- this.object_type_symbol = type_symbol;
+ base (type_symbol);
}
public override DataType copy () {
diff --git a/vala/valareferencetype.vala b/vala/valareferencetype.vala
index 6b49f53cc..8317c5d26 100644
--- a/vala/valareferencetype.vala
+++ b/vala/valareferencetype.vala
@@ -26,4 +26,7 @@ using GLib;
* A reference type, i.e. a class, interface, or array type.
*/
public abstract class Vala.ReferenceType : DataType {
+ protected ReferenceType (Symbol? symbol) {
+ base.with_symbol (symbol);
+ }
}
diff --git a/vala/valasignaltype.vala b/vala/valasignaltype.vala
index 5ee83dfdc..da38a2d05 100644
--- a/vala/valasignaltype.vala
+++ b/vala/valasignaltype.vala
@@ -26,14 +26,18 @@ using GLib;
* The type of a signal referencea.
*/
public class Vala.SignalType : CallableType {
- public weak Signal signal_symbol { get; set; }
+ public weak Signal signal_symbol {
+ get {
+ return (Signal) symbol;
+ }
+ }
Method? connect_method;
Method? connect_after_method;
Method? disconnect_method;
public SignalType (Signal signal_symbol) {
- this.signal_symbol = signal_symbol;
+ base (signal_symbol);
}
public override bool is_invokable () {
diff --git a/vala/valastructvaluetype.vala b/vala/valastructvaluetype.vala
index 02a0ca609..1413b5d32 100644
--- a/vala/valastructvaluetype.vala
+++ b/vala/valastructvaluetype.vala
@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.StructValueType : ValueType {
public StructValueType (Struct type_symbol) {
- this.type_symbol = type_symbol;
+ base (type_symbol);
}
public override bool is_invokable () {
diff --git a/vala/valavaluetype.vala b/vala/valavaluetype.vala
index edbeb5120..aa97f7c39 100644
--- a/vala/valavaluetype.vala
+++ b/vala/valavaluetype.vala
@@ -26,6 +26,10 @@ using GLib;
* A value type, i.e. a struct or an enum type.
*/
public abstract class Vala.ValueType : DataType {
+ protected ValueType (TypeSymbol type_symbol) {
+ base.with_symbol (type_symbol);
+ }
+
public override bool is_disposable () {
if (!value_owned) {
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]