summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-10-19 13:01:04 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-09-30 14:42:58 +0200
commit061c02a91056b2f8c8b4cc985db4aec9c0a235fc (patch)
tree32a66908183d59f04c77b1f4db204e5c482924d5
parent2b00c992ed8f5ac900131f17a995abf992c20d64 (diff)
downloadvala-061c02a91056b2f8c8b4cc985db4aec9c0a235fc.tar.gz
vala: Rename DataType.data_type property to DataType.type_symbol
-rw-r--r--vala/valaarraytype.vala8
-rw-r--r--vala/valaassignment.vala2
-rw-r--r--vala/valabaseaccess.vala4
-rw-r--r--vala/valabinaryexpression.vala20
-rw-r--r--vala/valabooleantype.vala2
-rw-r--r--vala/valacastexpression.vala2
-rw-r--r--vala/valaclass.vala24
-rw-r--r--vala/valaconstant.vala2
-rw-r--r--vala/valadatatype.vala70
-rw-r--r--vala/valaenumvaluetype.vala2
-rw-r--r--vala/valaerrortype.vala2
-rw-r--r--vala/valafloatingtype.vala2
-rw-r--r--vala/valaflowanalyzer.vala6
-rw-r--r--vala/valagirparser.vala6
-rw-r--r--vala/valainitializerlist.vala6
-rw-r--r--vala/valaintegertype.vala8
-rw-r--r--vala/valainterface.vala4
-rw-r--r--vala/valalambdaexpression.vala2
-rw-r--r--vala/valamemberaccess.vala16
-rw-r--r--vala/valamethod.vala14
-rw-r--r--vala/valamethodcall.vala2
-rw-r--r--vala/valanulltype.vala6
-rw-r--r--vala/valaobjectcreationexpression.vala2
-rw-r--r--vala/valaobjecttype.vala10
-rw-r--r--vala/valapointertype.vala6
-rw-r--r--vala/valaproperty.vala4
-rw-r--r--vala/valasemanticanalyzer.vala98
-rw-r--r--vala/valasignal.vala2
-rw-r--r--vala/valastruct.vala4
-rw-r--r--vala/valastructvaluetype.vala2
-rw-r--r--vala/valaswitchlabel.vala4
-rw-r--r--vala/valasymbolresolver.vala10
-rw-r--r--vala/valatypecheck.vala2
-rw-r--r--vala/valaunaryexpression.vala8
-rw-r--r--vala/valavaluetype.vala12
35 files changed, 182 insertions, 192 deletions
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index e9104db54..934af80b6 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -200,19 +200,19 @@ public class Vala.ArrayType : ReferenceType {
}
public override bool compatible (DataType target_type) {
- if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null) {
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type) && element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
+ if (CodeContext.get ().profile == Profile.GOBJECT && target_type.type_symbol != null) {
+ if (target_type.type_symbol.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.type_symbol) && element_type.type_symbol == CodeContext.get ().root.scope.lookup ("string")) {
// allow implicit conversion from string[] to GValue
return true;
}
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+ if (target_type.type_symbol.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.type_symbol)) {
// allow implicit conversion to GVariant
return true;
}
}
- if (target_type is PointerType || (target_type.data_type != null && target_type.data_type.get_attribute ("PointerType") != null)) {
+ if (target_type is PointerType || (target_type.type_symbol != null && target_type.type_symbol.get_attribute ("PointerType") != null)) {
/* any array type can be cast to a generic pointer */
return true;
}
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 9db0ec163..562aba637 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -191,7 +191,7 @@ public class Vala.Assignment : Expression {
} else if (left is ElementAccess) {
var ea = (ElementAccess) left;
- if (ea.container.value_type.data_type == context.analyzer.string_type.data_type) {
+ if (ea.container.value_type.type_symbol == context.analyzer.string_type.type_symbol) {
error = true;
Report.error (ea.source_reference, "strings are immutable");
return false;
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index 955233bdc..9a7d7ceb6 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -88,14 +88,14 @@ public class Vala.BaseAccess : Expression {
return false;
} else {
foreach (var base_type in context.analyzer.current_class.get_base_types ()) {
- if (base_type.data_type is Class) {
+ if (base_type.type_symbol is Class) {
value_type = base_type.copy ();
value_type.value_owned = false;
}
}
}
- symbol_reference = value_type.data_type;
+ symbol_reference = value_type.type_symbol;
return !error;
}
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 0578ba93d..893670232 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -271,18 +271,18 @@ public class Vala.BinaryExpression : Expression {
}
// enum-type inference
- if (target_type != null && target_type.data_type is Enum
+ if (target_type != null && target_type.type_symbol is Enum
&& (operator == BinaryOperator.BITWISE_AND || operator == BinaryOperator.BITWISE_OR)) {
left.target_type = target_type.copy ();
right.target_type = target_type.copy ();
}
left.check (context);
- if (left.value_type != null && left.value_type.data_type is Enum
+ if (left.value_type != null && left.value_type.type_symbol is Enum
&& (operator == BinaryOperator.EQUALITY || operator == BinaryOperator.INEQUALITY)) {
right.target_type = left.value_type.copy ();
}
right.check (context);
- if (right.value_type != null && right.value_type.data_type is Enum
+ if (right.value_type != null && right.value_type.type_symbol is Enum
&& (operator == BinaryOperator.EQUALITY || operator == BinaryOperator.INEQUALITY)) {
left.target_type = right.value_type.copy ();
//TODO bug 666035 -- re-check left how?
@@ -322,11 +322,11 @@ public class Vala.BinaryExpression : Expression {
right.target_type = right.value_type.copy ();
right.target_type.value_owned = false;
- if (left.value_type.data_type == context.analyzer.string_type.data_type
+ if (left.value_type.type_symbol == context.analyzer.string_type.type_symbol
&& operator == BinaryOperator.PLUS) {
// string concatenation
- if (right.value_type == null || right.value_type.data_type != context.analyzer.string_type.data_type) {
+ if (right.value_type == null || right.value_type.type_symbol != context.analyzer.string_type.type_symbol) {
error = true;
Report.error (source_reference, "Operands must be strings");
return false;
@@ -366,7 +366,7 @@ public class Vala.BinaryExpression : Expression {
return false;
}
- var offset_type = right.value_type.data_type as Struct;
+ var offset_type = right.value_type.type_symbol as Struct;
if (offset_type != null && offset_type.is_integer_type ()) {
if (operator == BinaryOperator.PLUS
|| operator == BinaryOperator.MINUS) {
@@ -444,12 +444,12 @@ public class Vala.BinaryExpression : Expression {
if (context.profile == Profile.GOBJECT) {
// Implicit cast for comparsion expression of GValue with other type
- var gvalue_type = context.analyzer.gvalue_type.data_type;
- if ((left.target_type.data_type == gvalue_type && right.target_type.data_type != gvalue_type)
- || (left.target_type.data_type != gvalue_type && right.target_type.data_type == gvalue_type)) {
+ var gvalue_type = context.analyzer.gvalue_type.type_symbol;
+ if ((left.target_type.type_symbol == gvalue_type && right.target_type.type_symbol != gvalue_type)
+ || (left.target_type.type_symbol != gvalue_type && right.target_type.type_symbol == gvalue_type)) {
Expression gvalue_expr;
DataType target_type;
- if (left.target_type.data_type == gvalue_type) {
+ if (left.target_type.type_symbol == gvalue_type) {
gvalue_expr = left;
target_type = right.target_type;
} else {
diff --git a/vala/valabooleantype.vala b/vala/valabooleantype.vala
index b224a9359..13b0f04c7 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) {
- base (type_symbol);
+ this.type_symbol = type_symbol;
}
public override DataType copy () {
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 63e356155..1a1e6ad05 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -195,7 +195,7 @@ public class Vala.CastExpression : Expression {
}
bool is_gvariant (CodeContext context, DataType type) {
- return type.data_type != null && type.data_type.is_subtype_of (context.analyzer.gvariant_type.data_type);
+ return type.type_symbol != null && type.type_symbol.is_subtype_of (context.analyzer.gvariant_type.type_symbol);
}
public override void emit (CodeGenerator codegen) {
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index c8baeaab7..6fb3ff660 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -473,7 +473,7 @@ public class Vala.Class : ObjectTypeSymbol {
}
foreach (DataType base_type in base_types) {
- if (base_type.data_type != null && base_type.data_type.is_subtype_of (t)) {
+ if (base_type.type_symbol != null && base_type.type_symbol.is_subtype_of (t)) {
return true;
}
}
@@ -493,7 +493,7 @@ public class Vala.Class : ObjectTypeSymbol {
private void get_all_prerequisites (Interface iface, List<TypeSymbol> list) {
foreach (DataType prereq in iface.get_prerequisites ()) {
- TypeSymbol type = prereq.data_type;
+ TypeSymbol type = prereq.type_symbol;
/* skip on previous errors */
if (type == null) {
continue;
@@ -513,11 +513,11 @@ public class Vala.Class : ObjectTypeSymbol {
}
foreach (DataType base_type in cl.get_base_types ()) {
- if (base_type.data_type is Class) {
- if (class_is_a ((Class) base_type.data_type, t)) {
+ if (base_type.type_symbol is Class) {
+ if (class_is_a ((Class) base_type.type_symbol, t)) {
return true;
}
- } else if (base_type.data_type == t) {
+ } else if (base_type.type_symbol == t) {
return true;
}
}
@@ -560,7 +560,7 @@ public class Vala.Class : ObjectTypeSymbol {
}
int n_type_args = base_type_reference.get_type_arguments ().size;
- int n_type_params = ((ObjectTypeSymbol) base_type_reference.data_type).get_type_parameters ().size;
+ int n_type_params = ((ObjectTypeSymbol) base_type_reference.type_symbol).get_type_parameters ().size;
if (n_type_args < n_type_params) {
error = true;
Report.error (base_type_reference.source_reference, "too few type arguments");
@@ -678,7 +678,7 @@ public class Vala.Class : ObjectTypeSymbol {
/* compact classes cannot implement interfaces */
if (is_compact) {
foreach (DataType base_type in get_base_types ()) {
- if (base_type.data_type is Interface) {
+ if (base_type.type_symbol is Interface) {
error = true;
Report.error (source_reference, "compact classes `%s' may not implement interfaces".printf (get_full_name ()));
}
@@ -698,8 +698,8 @@ public class Vala.Class : ObjectTypeSymbol {
/* gather all prerequisites */
List<TypeSymbol> prerequisites = new ArrayList<TypeSymbol> ();
foreach (DataType base_type in get_base_types ()) {
- if (base_type.data_type is Interface) {
- get_all_prerequisites ((Interface) base_type.data_type, prerequisites);
+ if (base_type.type_symbol is Interface) {
+ get_all_prerequisites ((Interface) base_type.type_symbol, prerequisites);
}
}
/* check whether all prerequisites are met */
@@ -731,8 +731,8 @@ public class Vala.Class : ObjectTypeSymbol {
if (source_type == SourceFileType.SOURCE) {
/* all abstract symbols defined in base types have to be at least defined (or implemented) also in this type */
foreach (DataType base_type in get_base_types ()) {
- if (base_type.data_type is Interface) {
- Interface iface = (Interface) base_type.data_type;
+ if (base_type.type_symbol is Interface) {
+ Interface iface = (Interface) base_type.type_symbol;
if (base_class != null && base_class.is_subtype_of (iface)) {
// reimplementation of interface, class is not required to reimplement all methods
@@ -752,7 +752,7 @@ public class Vala.Class : ObjectTypeSymbol {
foreach (var impl in base_class.get_methods ()) {
if (impl.base_interface_method == m || (base_class != this
&& impl.base_interface_method == null && impl.name == m.name
- && (impl.base_interface_type == null || impl.base_interface_type.data_type == iface)
+ && (impl.base_interface_type == null || impl.base_interface_type.type_symbol == iface)
&& impl.compatible_no_error (m))) {
// method is used as interface implementation, so it is not unused
impl.version.check (source_reference);
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 0a9266cf1..2fc75afab 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -185,7 +185,7 @@ public class Vala.Constant : Symbol {
} else if (type is ArrayType) {
var array_type = type as ArrayType;
return check_const_type (array_type.element_type, context);
- } else if (type.data_type.is_subtype_of (context.analyzer.string_type.data_type)) {
+ } else if (type.type_symbol.is_subtype_of (context.analyzer.string_type.type_symbol)) {
return true;
} else {
return false;
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 2e42c475a..f4013136e 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -40,9 +40,9 @@ public abstract class Vala.DataType : CodeNode {
public bool nullable { get; set; }
/**
- * The referred data type.
+ * The referred type symbol.
*/
- public weak TypeSymbol data_type { get; set; }
+ public weak TypeSymbol type_symbol { get; set; }
/**
* Specifies that the expression transfers a floating reference.
@@ -121,8 +121,8 @@ public abstract class Vala.DataType : CodeNode {
string s;
- if (data_type != null) {
- Symbol global_symbol = data_type;
+ if (type_symbol != null) {
+ Symbol global_symbol = type_symbol;
while (global_symbol.parent_symbol.name != null) {
global_symbol = global_symbol.parent_symbol;
}
@@ -135,9 +135,9 @@ public abstract class Vala.DataType : CodeNode {
}
if (sym != null && global_symbol != sym) {
- s = "global::" + data_type.get_full_name ();;
+ s = "global::" + type_symbol.get_full_name ();;
} else {
- s = data_type.get_full_name ();
+ s = type_symbol.get_full_name ();
}
} else {
s = "null";
@@ -189,7 +189,7 @@ public abstract class Vala.DataType : CodeNode {
if (type2.nullable != nullable) {
return false;
}
- if (type2.data_type != data_type) {
+ if (type2.type_symbol != type_symbol) {
return false;
}
if (type2 is GenericType || this is GenericType) {
@@ -239,7 +239,7 @@ public abstract class Vala.DataType : CodeNode {
return true;
}
- if (type2.data_type != data_type) {
+ if (type2.type_symbol != type_symbol) {
// FIXME: allow this type reference to refer to a
// subtype of the type type2 is referring to
return false;
@@ -268,13 +268,13 @@ public abstract class Vala.DataType : CodeNode {
return false;
}
- if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null) {
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
+ if (CodeContext.get ().profile == Profile.GOBJECT && target_type.type_symbol != null) {
+ if (target_type.type_symbol.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.type_symbol)) {
// allow implicit conversion to GValue
return true;
}
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+ if (target_type.type_symbol.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.type_symbol)) {
// allow implicit conversion to GVariant
return true;
}
@@ -283,8 +283,8 @@ 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 (this is GenericType ||
- (data_type != null && (
- data_type.is_reference_type () ||
+ (type_symbol != null && (
+ type_symbol.is_reference_type () ||
this is DelegateType))) {
return true;
}
@@ -301,7 +301,7 @@ public abstract class Vala.DataType : CodeNode {
return false;
}
- if (data_type is Enum && target_type.data_type is Struct && ((Struct) target_type.data_type).is_integer_type ()) {
+ if (type_symbol is Enum && target_type.type_symbol is Struct && ((Struct) target_type.type_symbol).is_integer_type ()) {
return true;
}
@@ -320,8 +320,8 @@ public abstract class Vala.DataType : CodeNode {
}
}
- if (data_type != null && target_type.data_type != null && data_type.is_subtype_of (target_type.data_type)) {
- var base_type = SemanticAnalyzer.get_instance_base_type_for_member(this, target_type.data_type, this);
+ if (type_symbol != null && target_type.type_symbol != null && type_symbol.is_subtype_of (target_type.type_symbol)) {
+ var base_type = SemanticAnalyzer.get_instance_base_type_for_member(this, target_type.type_symbol, this);
// check compatibility of generic type arguments
var base_type_args = base_type.get_type_arguments();
if (base_type_args.size == target_type_args.size) {
@@ -339,9 +339,9 @@ public abstract class Vala.DataType : CodeNode {
return true;
}
- if (data_type is Struct && target_type.data_type is Struct) {
- var expr_struct = (Struct) data_type;
- var expect_struct = (Struct) target_type.data_type;
+ if (type_symbol is Struct && target_type.type_symbol is Struct) {
+ var expr_struct = (Struct) type_symbol;
+ var expect_struct = (Struct) target_type.type_symbol;
/* integer types may be implicitly cast to floating point types */
if (expr_struct.is_integer_type () && expect_struct.is_floating_type ()) {
@@ -387,8 +387,8 @@ public abstract class Vala.DataType : CodeNode {
}
public virtual bool is_reference_type_or_type_parameter () {
- return (data_type != null &&
- data_type.is_reference_type ()) ||
+ return (type_symbol != null &&
+ type_symbol.is_reference_type ()) ||
this is GenericType;
}
@@ -399,15 +399,15 @@ public abstract class Vala.DataType : CodeNode {
return false;
}
}
- if (data_type != null) {
- return data_type.is_accessible (sym);
+ if (type_symbol != null) {
+ return type_symbol.is_accessible (sym);
}
return true;
}
public virtual Symbol? get_member (string member_name) {
- if (data_type != null) {
- return SemanticAnalyzer.symbol_lookup_inherited (data_type, member_name);
+ if (type_symbol != null) {
+ return SemanticAnalyzer.symbol_lookup_inherited (type_symbol, member_name);
}
return null;
}
@@ -421,7 +421,7 @@ public abstract class Vala.DataType : CodeNode {
* is a struct which is not a simple (fundamental) type.
*/
public virtual bool is_real_struct_type () {
- var s = data_type as Struct;
+ unowned Struct? s = type_symbol as Struct;
if (s != null && !s.is_simple_type ()) {
return true;
}
@@ -433,7 +433,7 @@ public abstract class Vala.DataType : CodeNode {
}
public bool is_non_null_simple_type () {
- unowned Struct s = data_type as Struct;
+ unowned Struct? s = type_symbol as Struct;
if (s != null && s.is_simple_type ()) {
return !nullable;
}
@@ -538,13 +538,13 @@ public abstract class Vala.DataType : CodeNode {
}
return string.nfill (array_type.rank, 'a') + element_type_signature;
- } else if (data_type != null && data_type is Enum && data_type.get_attribute_bool ("DBus", "use_string_marshalling")) {
+ } else if (type_symbol != null && type_symbol is Enum && type_symbol.get_attribute_bool ("DBus", "use_string_marshalling")) {
return "s";
- } else if (data_type != null) {
- string sig = data_type.get_attribute_string ("CCode", "type_signature");
+ } else if (type_symbol != null) {
+ string sig = type_symbol.get_attribute_string ("CCode", "type_signature");
- unowned Struct? st = data_type as Struct;
- unowned Enum? en = data_type as Enum;
+ unowned Struct? st = type_symbol as Struct;
+ unowned Enum? en = type_symbol as Enum;
if (sig == null && st != null) {
var str = new StringBuilder ();
str.append_c ('(');
@@ -577,9 +577,9 @@ public abstract class Vala.DataType : CodeNode {
}
if (sig == null &&
- (data_type.get_full_name () == "GLib.UnixInputStream" ||
- data_type.get_full_name () == "GLib.UnixOutputStream" ||
- data_type.get_full_name () == "GLib.Socket")) {
+ (type_symbol.get_full_name () == "GLib.UnixInputStream" ||
+ type_symbol.get_full_name () == "GLib.UnixOutputStream" ||
+ type_symbol.get_full_name () == "GLib.Socket")) {
return "h";
}
diff --git a/vala/valaenumvaluetype.vala b/vala/valaenumvaluetype.vala
index 6c6aca398..0e2579295 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) {
- base (type_symbol);
+ this.type_symbol = type_symbol;
}
public override DataType copy () {
diff --git a/vala/valaerrortype.vala b/vala/valaerrortype.vala
index 054fe8031..09c58ceb8 100644
--- a/vala/valaerrortype.vala
+++ b/vala/valaerrortype.vala
@@ -41,7 +41,7 @@ public class Vala.ErrorType : ReferenceType {
public ErrorType (ErrorDomain? error_domain, ErrorCode? error_code, SourceReference? source_reference = null) {
this.error_domain = error_domain;
- this.data_type = error_domain;
+ this.type_symbol = error_domain;
this.error_code = error_code;
this.source_reference = source_reference;
}
diff --git a/vala/valafloatingtype.vala b/vala/valafloatingtype.vala
index 83c4abee6..060080919 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) {
- base (type_symbol);
+ this.type_symbol = type_symbol;
}
public override DataType copy () {
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index 29349e7a1..4e81db9e2 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -871,7 +871,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
node.get_error_types (error_types);
foreach (DataType error_data_type in error_types) {
var error_type = error_data_type as ErrorType;
- var error_class = error_data_type.data_type as Class;
+ var error_class = error_data_type.type_symbol as Class;
current_block = last_block;
unreachable_reported = true;
@@ -990,9 +990,9 @@ public class Vala.FlowAnalyzer : CodeVisitor {
if (catch_clause.error_type != null) {
if (context.profile == Profile.GOBJECT) {
var error_type = (ErrorType) catch_clause.error_type;
- jump_stack.add (new JumpTarget.error_target (error_block, catch_clause, catch_clause.error_type.data_type as ErrorDomain, error_type.error_code, null));
+ jump_stack.add (new JumpTarget.error_target (error_block, catch_clause, catch_clause.error_type.type_symbol as ErrorDomain, error_type.error_code, null));
} else {
- var error_class = catch_clause.error_type.data_type as Class;
+ var error_class = catch_clause.error_type.type_symbol as Class;
jump_stack.add (new JumpTarget.error_target (error_block, catch_clause, null, null, error_class));
}
} else {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 36d249c90..828cc6959 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3691,7 +3691,7 @@ public class Vala.GirParser : CodeVisitor {
var unresolved_symbol = ((UnresolvedType) prereq).unresolved_symbol;
sym = resolve_symbol (iface_node.parent, unresolved_symbol);
} else {
- sym = prereq.data_type;
+ sym = prereq.type_symbol;
}
if (sym is Class) {
has_instantiable_prereq = true;
@@ -3722,7 +3722,7 @@ public class Vala.GirParser : CodeVisitor {
simple_type = true;
} else {
base_type = alias.base_type;
- type_sym = base_type.data_type;
+ type_sym = base_type.type_symbol;
if (type_sym != null) {
base_node = resolve_node (alias.parent, parse_symbol_from_string (type_sym.get_full_name (), alias.source_reference));
}
@@ -3881,7 +3881,7 @@ public class Vala.GirParser : CodeVisitor {
if (type is UnresolvedType) {
st = resolve_symbol (node.parent, ((UnresolvedType) type).unresolved_symbol) as Struct;
} else if (type is ValueType) {
- st = type.data_type as Struct;
+ st = type.type_symbol as Struct;
}
if (st != null && st.is_simple_type ()) {
type.nullable = false;
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index cdafd0923..5183640f8 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -156,7 +156,7 @@ public class Vala.InitializerList : Expression {
}
if (!(parent_node is ArrayCreationExpression) && !requires_constants_only
- && (!(parent_node is InitializerList) || ((InitializerList) parent_node).target_type.data_type is Struct)) {
+ && (!(parent_node is InitializerList) || ((InitializerList) parent_node).target_type.type_symbol is Struct)) {
// transform shorthand form
// int[] array = { 42 };
// into
@@ -187,9 +187,9 @@ public class Vala.InitializerList : Expression {
foreach (Expression e in get_initializers ()) {
e.target_type = inner_target_type;
}
- } else if (target_type.data_type is Struct) {
+ } else if (target_type.type_symbol is Struct) {
/* initializer is used as struct initializer */
- var st = (Struct) target_type.data_type;
+ var st = (Struct) target_type.type_symbol;
while (st.base_struct != null) {
st = st.base_struct;
}
diff --git a/vala/valaintegertype.vala b/vala/valaintegertype.vala
index 274fe4716..5b1caa024 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) {
- base (type_symbol);
+ this.type_symbol = type_symbol;
this.literal_value = literal_value;
this.literal_type_name = literal_type_name;
}
@@ -44,11 +44,11 @@ public class Vala.IntegerType : ValueType {
}
public override bool compatible (DataType target_type) {
- if (target_type.data_type is Struct && literal_type_name == "int") {
+ if (target_type.type_symbol is Struct && literal_type_name == "int") {
// int literals are implicitly convertible to integer types
// of a lower rank if the value of the literal is within
// the range of the target type
- var target_st = (Struct) target_type.data_type;
+ var target_st = (Struct) target_type.type_symbol;
if (target_st.is_integer_type ()) {
var int_attr = target_st.get_attribute ("IntegerType");
if (int_attr != null && int_attr.has_argument ("min") && int_attr.has_argument ("max")) {
@@ -59,7 +59,7 @@ public class Vala.IntegerType : ValueType {
return true;
}
}
- } else if (target_type.data_type is Enum && (literal_type_name == "int" || literal_type_name == "uint")) {
+ } else if (target_type.type_symbol is Enum && (literal_type_name == "int" || literal_type_name == "uint")) {
// allow implicit conversion from 0 to enum and flags types
if (int.parse (literal_value) == 0) {
return true;
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 6b715356f..2d0933eda 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -169,7 +169,7 @@ public class Vala.Interface : ObjectTypeSymbol {
}
foreach (DataType prerequisite in prerequisites) {
- if (prerequisite.data_type != null && prerequisite.data_type.is_subtype_of (t)) {
+ if (prerequisite.type_symbol != null && prerequisite.type_symbol.is_subtype_of (t)) {
return true;
}
}
@@ -214,7 +214,7 @@ public class Vala.Interface : ObjectTypeSymbol {
/* check prerequisites */
Class prereq_class = null;
foreach (DataType prereq in get_prerequisites ()) {
- TypeSymbol class_or_interface = prereq.data_type;
+ TypeSymbol class_or_interface = prereq.type_symbol;
/* skip on previous errors */
if (class_or_interface == null) {
error = true;
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 8a930ef61..62c22a9a7 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -207,7 +207,7 @@ public class Vala.LambdaExpression : Expression {
var block = new Block (source_reference);
block.scope.parent_scope = method.scope;
- if (method.return_type.data_type != null) {
+ if (method.return_type.type_symbol != null) {
block.add_statement (new ReturnStatement (expression_body, source_reference));
} else {
block.add_statement (new ExpressionStatement (expression_body, source_reference));
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index fdc336f78..1ce6b94d6 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -365,8 +365,8 @@ public class Vala.MemberAccess : Expression {
if (pointer_member_access) {
symbol_reference = inner.value_type.get_pointer_member (member_name);
} else {
- if (inner.value_type.data_type != null) {
- base_symbol = inner.value_type.data_type;
+ if (inner.value_type.type_symbol != null) {
+ base_symbol = inner.value_type.type_symbol;
}
symbol_reference = inner.value_type.get_member (member_name);
}
@@ -412,7 +412,7 @@ public class Vala.MemberAccess : Expression {
var prop = new DynamicProperty (inner.value_type, member_name, source_reference);
prop.access = SymbolAccessibility.PUBLIC;
prop.set_accessor = new PropertyAccessor (false, true, false, null, null, prop.source_reference);
- prop.owner = inner.value_type.data_type.scope;
+ prop.owner = inner.value_type.type_symbol.scope;
dynamic_object_type.type_symbol.scope.add (null, prop);
symbol_reference = prop;
}
@@ -442,7 +442,7 @@ public class Vala.MemberAccess : Expression {
}
prop.access = SymbolAccessibility.PUBLIC;
prop.get_accessor = new PropertyAccessor (true, false, false, prop.property_type.copy (), null, prop.source_reference);
- prop.owner = inner.value_type.data_type.scope;
+ prop.owner = inner.value_type.type_symbol.scope;
dynamic_object_type.type_symbol.scope.add (null, prop);
symbol_reference = prop;
}
@@ -454,8 +454,8 @@ public class Vala.MemberAccess : Expression {
}
// enum-type inference
- if (inner == null && symbol_reference == null && target_type != null && target_type.data_type is Enum) {
- var enum_type = (Enum) target_type.data_type;
+ if (inner == null && symbol_reference == null && target_type != null && target_type.type_symbol is Enum) {
+ var enum_type = (Enum) target_type.type_symbol;
foreach (var val in enum_type.get_values ()) {
if (member_name == val.name) {
symbol_reference = val;
@@ -471,7 +471,7 @@ public class Vala.MemberAccess : Expression {
unowned Symbol? base_type = null;
if (inner != null && inner.value_type != null) {
base_type_name = inner.value_type.to_string ();
- base_type = inner.value_type.data_type;
+ base_type = inner.value_type.type_symbol;
} else if (base_symbol != null) {
base_type_name = base_symbol.get_full_name ();
base_type = base_symbol;
@@ -778,7 +778,7 @@ public class Vala.MemberAccess : Expression {
// instance type might be a subtype of the parent symbol of the member
// that subtype might not be generic, so do not report an error in that case
var object_type = instance_type as ObjectType;
- if (object_type != null && object_type.type_symbol.has_type_parameters ()
+ if (object_type != null && object_type.object_type_symbol.has_type_parameters ()
&& !instance_type.has_type_arguments ()) {
error = true;
Report.error (inner.source_reference, "missing generic type arguments");
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 71c3a4787..4cca286a3 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -339,7 +339,7 @@ public class Vala.Method : Subroutine, Callable {
ObjectType object_type = null;
if (parent_symbol is ObjectTypeSymbol) {
object_type = new ObjectType ((ObjectTypeSymbol) parent_symbol);
- foreach (TypeParameter type_parameter in object_type.type_symbol.get_type_parameters ()) {
+ foreach (TypeParameter type_parameter in object_type.object_type_symbol.get_type_parameters ()) {
var type_arg = new GenericType (type_parameter);
type_arg.value_owned = true;
object_type.add_type_argument (type_arg);
@@ -641,12 +641,12 @@ public class Vala.Method : Subroutine, Callable {
Method? invalid_base_match = null;
foreach (DataType type in cl.get_base_types ()) {
- if (type.data_type is Interface) {
- if (base_interface_type != null && base_interface_type.data_type != type.data_type) {
+ if (type.type_symbol is Interface) {
+ if (base_interface_type != null && base_interface_type.type_symbol != type.type_symbol) {
continue;
}
- var sym = type.data_type.scope.lookup (name);
+ var sym = type.type_symbol.scope.lookup (name);
if (sym is Signal) {
var sig = (Signal) sym;
sym = sig.default_handler;
@@ -811,7 +811,7 @@ public class Vala.Method : Subroutine, Callable {
error = true;
Report.error (param.source_reference, "Reference parameters are not supported for async methods");
}
- if (!external_package && coroutine && (param.ellipsis || param.variable_type.data_type == context.analyzer.va_list_type.data_type)) {
+ if (!external_package && coroutine && (param.ellipsis || param.variable_type.type_symbol == context.analyzer.va_list_type.type_symbol)) {
error = true;
Report.error (param.source_reference, "Variadic parameters are not supported for async methods");
return false;
@@ -1049,7 +1049,7 @@ public class Vala.Method : Subroutine, Callable {
}
if (return_type is VoidType) {
- } else if (return_type.data_type == context.analyzer.int_type.data_type) {
+ } else if (return_type.type_symbol == context.analyzer.int_type.type_symbol) {
} else {
// return type must be void or int
return false;
@@ -1081,7 +1081,7 @@ public class Vala.Method : Subroutine, Callable {
}
var array_type = (ArrayType) param.variable_type;
- if (array_type.element_type.data_type != context.analyzer.string_type.data_type) {
+ if (array_type.element_type.type_symbol != context.analyzer.string_type.type_symbol) {
// parameter must be an array of strings
return false;
}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 0a9d7465a..d4c53a52a 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -644,7 +644,7 @@ public class Vala.MethodCall : Expression {
/* Check for constructv chain up */
if (base_cm != null && base_cm.is_variadic () && args.size == base_cm.get_parameters ().size) {
var this_last_arg = args[args.size-1];
- if (this_last_arg.value_type is StructValueType && this_last_arg.value_type.data_type == context.analyzer.va_list_type.data_type) {
+ if (this_last_arg.value_type is StructValueType && this_last_arg.value_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
is_constructv_chainup = true;
}
}
diff --git a/vala/valanulltype.vala b/vala/valanulltype.vala
index c82791447..92b02c8c0 100644
--- a/vala/valanulltype.vala
+++ b/vala/valanulltype.vala
@@ -36,7 +36,7 @@ public class Vala.NullType : ReferenceType {
return target_type.nullable;
}
- if (!(target_type is PointerType) && (target_type is NullType || (target_type.data_type == null && !(target_type is GenericType)))) {
+ if (!(target_type is PointerType) && (target_type is NullType || (target_type.type_symbol == null && !(target_type is GenericType)))) {
return true;
}
@@ -44,11 +44,11 @@ public class Vala.NullType : ReferenceType {
if (target_type is GenericType ||
target_type is PointerType ||
target_type.nullable ||
- target_type.data_type.get_attribute ("PointerType") != null) {
+ target_type.type_symbol.get_attribute ("PointerType") != null) {
return true;
}
- if (target_type.data_type.is_reference_type () ||
+ if (target_type.type_symbol.is_reference_type () ||
target_type is ArrayType ||
target_type is DelegateType) {
return true;
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 19063a9d0..9e688cf70 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -250,7 +250,7 @@ public class Vala.ObjectCreationExpression : Expression {
type_reference.add_type_argument (type_arg);
}
} else {
- type = type_reference.data_type;
+ type = type_reference.type_symbol;
}
value_type = type_reference.copy ();
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index 9cd9523ba..999b746fa 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -29,15 +29,15 @@ public class Vala.ObjectType : ReferenceType {
/**
* The referred class or interface.
*/
- public weak ObjectTypeSymbol type_symbol { get; set; }
+ public weak ObjectTypeSymbol object_type_symbol { get; set; }
public ObjectType (ObjectTypeSymbol type_symbol) {
this.type_symbol = type_symbol;
- data_type = type_symbol;
+ this.object_type_symbol = type_symbol;
}
public override DataType copy () {
- var result = new ObjectType (type_symbol);
+ var result = new ObjectType (object_type_symbol);
result.source_reference = source_reference;
result.value_owned = value_owned;
result.nullable = nullable;
@@ -101,10 +101,10 @@ public class Vala.ObjectType : ReferenceType {
}
int n_type_args = get_type_arguments ().size;
- if (n_type_args > 0 && n_type_args < type_symbol.get_type_parameters ().size) {
+ if (n_type_args > 0 && n_type_args < object_type_symbol.get_type_parameters ().size) {
Report.error (source_reference, "too few type arguments");
return false;
- } else if (n_type_args > 0 && n_type_args > type_symbol.get_type_parameters ().size) {
+ } else if (n_type_args > 0 && n_type_args > object_type_symbol.get_type_parameters ().size) {
Report.error (source_reference, "too many type arguments");
return false;
}
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index 01d759eda..ee2864fbd 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -69,7 +69,7 @@ public class Vala.PointerType : DataType {
return base_type.compatible (tt.base_type);
}
- if ((target_type.data_type != null && target_type.data_type.get_attribute ("PointerType") != null)) {
+ if ((target_type.type_symbol != null && target_type.type_symbol.get_attribute ("PointerType") != null)) {
return true;
}
@@ -83,7 +83,7 @@ public class Vala.PointerType : DataType {
return base_type.compatible (target_type);
}
- if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
+ if (CodeContext.get ().profile == Profile.GOBJECT && target_type.type_symbol != null && target_type.type_symbol.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.type_symbol)) {
// allow implicit conversion to GValue
return true;
}
@@ -96,7 +96,7 @@ public class Vala.PointerType : DataType {
}
public override Symbol? get_pointer_member (string member_name) {
- Symbol base_symbol = base_type.data_type;
+ Symbol base_symbol = base_type.type_symbol;
if (base_symbol == null) {
return null;
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 2ae3d4ace..f9cf4d916 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -381,8 +381,8 @@ public class Vala.Property : Symbol, Lockable {
private void find_base_interface_property (Class cl) {
// FIXME report error if multiple possible base properties are found
foreach (DataType type in cl.get_base_types ()) {
- if (type.data_type is Interface) {
- var sym = type.data_type.scope.lookup (name);
+ if (type.type_symbol is Interface) {
+ var sym = type.type_symbol.scope.lookup (name);
if (sym is Property) {
var base_property = (Property) sym;
if (base_property.is_abstract || base_property.is_virtual) {
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 1b40b34ee..51bb771d9 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -305,8 +305,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
// first check interfaces without prerequisites
// (prerequisites can be assumed to be met already)
foreach (DataType base_type in cl.get_base_types ()) {
- if (base_type.data_type is Interface) {
- result = base_type.data_type.scope.lookup (name);
+ if (base_type.type_symbol is Interface) {
+ result = base_type.type_symbol.scope.lookup (name);
if (result != null) {
return result;
}
@@ -319,7 +319,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
} else if (sym is Struct) {
var st = (Struct) sym;
if (st.base_type != null) {
- result = symbol_lookup_inherited (st.base_type.data_type, name);
+ result = symbol_lookup_inherited (st.base_type.type_symbol, name);
if (result != null) {
return result;
}
@@ -328,8 +328,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
var iface = (Interface) sym;
// first check interface prerequisites recursively
foreach (DataType prerequisite in iface.get_prerequisites ()) {
- if (prerequisite.data_type is Interface) {
- result = symbol_lookup_inherited (prerequisite.data_type, name);
+ if (prerequisite.type_symbol is Interface) {
+ result = symbol_lookup_inherited (prerequisite.type_symbol, name);
if (result != null) {
return result;
}
@@ -337,8 +337,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
// then check class prerequisite recursively
foreach (DataType prerequisite in iface.get_prerequisites ()) {
- if (prerequisite.data_type is Class) {
- result = symbol_lookup_inherited (prerequisite.data_type, name);
+ if (prerequisite.type_symbol is Class) {
+ result = symbol_lookup_inherited (prerequisite.type_symbol, name);
if (result != null) {
return result;
}
@@ -460,7 +460,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool is_gobject_property_type (DataType property_type) {
- var st = property_type.data_type as Struct;
+ var st = property_type.type_symbol as Struct;
if (st != null) {
if (!st.is_simple_type () && st.get_attribute_bool ("CCode", "has_type_id", true)) {
// Allow GType-based struct types
@@ -469,7 +469,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
}
- if (property_type is ArrayType && ((ArrayType) property_type).element_type.data_type != string_type.data_type) {
+ if (property_type is ArrayType && ((ArrayType) property_type).element_type.type_symbol != string_type.type_symbol) {
return false;
}
@@ -825,10 +825,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
private static DataType? get_instance_base_type (DataType instance_type, DataType base_type, CodeNode node_reference) {
// construct a new type reference for the base type with correctly linked type arguments
DataType instance_base_type;
- if (base_type.data_type is ObjectTypeSymbol) {
- instance_base_type = new ObjectType ((ObjectTypeSymbol) base_type.data_type);
- } else if (base_type.data_type is Struct) {
- instance_base_type = new StructValueType ((Struct) base_type.data_type);
+ if (base_type.type_symbol is ObjectTypeSymbol) {
+ instance_base_type = new ObjectType ((ObjectTypeSymbol) base_type.type_symbol);
+ } else if (base_type.type_symbol is Struct) {
+ instance_base_type = new StructValueType ((Struct) base_type.type_symbol);
} else {
assert_not_reached ();
}
@@ -850,19 +850,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (instance_type is DelegateType && ((DelegateType) instance_type).delegate_symbol == type_symbol) {
return instance_type;
- } else if (instance_type.data_type == type_symbol) {
+ } else if (instance_type.type_symbol == type_symbol) {
return instance_type;
}
DataType instance_base_type = null;
// use same algorithm as symbol_lookup_inherited
- if (instance_type.data_type is Class) {
- var cl = (Class) instance_type.data_type;
+ if (instance_type.type_symbol is Class) {
+ unowned Class cl = (Class) instance_type.type_symbol;
// first check interfaces without prerequisites
// (prerequisites can be assumed to be met already)
foreach (DataType base_type in cl.get_base_types ()) {
- if (base_type.data_type is Interface) {
+ if (base_type.type_symbol is Interface) {
instance_base_type = get_instance_base_type_for_member (get_instance_base_type (instance_type, base_type, node_reference), type_symbol, node_reference);
if (instance_base_type != null) {
return instance_base_type;
@@ -872,7 +872,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
// then check base class recursively
if (instance_base_type == null) {
foreach (DataType base_type in cl.get_base_types ()) {
- if (base_type.data_type is Class) {
+ if (base_type.type_symbol is Class) {
instance_base_type = get_instance_base_type_for_member (get_instance_base_type (instance_type, base_type, node_reference), type_symbol, node_reference);
if (instance_base_type != null) {
return instance_base_type;
@@ -880,19 +880,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
}
}
- } else if (instance_type.data_type is Struct) {
- var st = (Struct) instance_type.data_type;
+ } else if (instance_type.type_symbol is Struct) {
+ unowned Struct st = (Struct) instance_type.type_symbol;
if (st.base_type != null) {
instance_base_type = get_instance_base_type_for_member (get_instance_base_type (instance_type, st.base_type, node_reference), type_symbol, node_reference);
if (instance_base_type != null) {
return instance_base_type;
}
}
- } else if (instance_type.data_type is Interface) {
- var iface = (Interface) instance_type.data_type;
+ } else if (instance_type.type_symbol is Interface) {
+ unowned Interface iface = (Interface) instance_type.type_symbol;
// first check interface prerequisites recursively
foreach (DataType prerequisite in iface.get_prerequisites ()) {
- if (prerequisite.data_type is Interface) {
+ if (prerequisite.type_symbol is Interface) {
instance_base_type = get_instance_base_type_for_member (get_instance_base_type (instance_type, prerequisite, node_reference), type_symbol, node_reference);
if (instance_base_type != null) {
return instance_base_type;
@@ -902,7 +902,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (instance_base_type == null) {
// then check class prerequisite recursively
foreach (DataType prerequisite in iface.get_prerequisites ()) {
- if (prerequisite.data_type is Class) {
+ if (prerequisite.type_symbol is Class) {
instance_base_type = get_instance_base_type_for_member (get_instance_base_type (instance_type, prerequisite, node_reference), type_symbol, node_reference);
if (instance_base_type != null) {
return instance_base_type;
@@ -935,7 +935,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (instance_type is DelegateType) {
param_index = ((DelegateType) instance_type).delegate_symbol.get_type_parameter_index (generic_type.type_parameter.name);
} else {
- param_index = instance_type.data_type.get_type_parameter_index (generic_type.type_parameter.name);
+ param_index = instance_type.type_symbol.get_type_parameter_index (generic_type.type_parameter.name);
}
if (param_index == -1) {
if (node_reference != null) {
@@ -1019,10 +1019,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public void visit_member_initializer (MemberInitializer init, DataType type) {
- init.symbol_reference = symbol_lookup_inherited (type.data_type, init.name);
+ init.symbol_reference = symbol_lookup_inherited (type.type_symbol, init.name);
if (!(init.symbol_reference is Field || init.symbol_reference is Property)) {
init.error = true;
- Report.error (init.source_reference, "Invalid member `%s' in `%s'".printf (init.name, type.data_type.get_full_name ()));
+ Report.error (init.source_reference, "Invalid member `%s' in `%s'".printf (init.name, type.type_symbol.get_full_name ()));
return;
}
if (init.symbol_reference.access != SymbolAccessibility.PUBLIC) {
@@ -1057,9 +1057,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
Struct? get_arithmetic_struct (DataType type) {
- var result = type.data_type as Struct;
+ unowned Struct? result = type.type_symbol as Struct;
if (result == null && type is EnumValueType) {
- return (Struct) int_type.data_type;
+ return (Struct) int_type.type_symbol;
}
return result;
}
@@ -1200,7 +1200,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool is_reference_type_argument (DataType type_arg) {
- if (type_arg is ErrorType || (type_arg.data_type != null && type_arg.data_type.is_reference_type ())) {
+ if (type_arg is ErrorType || (type_arg.type_symbol != null && type_arg.type_symbol.is_reference_type ())) {
return true;
} else {
return false;
@@ -1216,32 +1216,32 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool is_signed_integer_type_argument (DataType type_arg) {
- var st = type_arg.data_type as Struct;
+ unowned Struct? st = type_arg.type_symbol as Struct;
if (type_arg is EnumValueType) {
return true;
} else if (type_arg.nullable) {
return false;
} else if (st == null) {
return false;
- } else if (st.is_subtype_of (bool_type.data_type)) {
+ } else if (st.is_subtype_of (bool_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (char_type.data_type)) {
+ } else if (st.is_subtype_of (char_type.type_symbol)) {
return true;
- } else if (unichar_type != null && st.is_subtype_of (unichar_type.data_type)) {
+ } else if (unichar_type != null && st.is_subtype_of (unichar_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (short_type.data_type)) {
+ } else if (st.is_subtype_of (short_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (int_type.data_type)) {
+ } else if (st.is_subtype_of (int_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (long_type.data_type)) {
+ } else if (st.is_subtype_of (long_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (int8_type.data_type)) {
+ } else if (st.is_subtype_of (int8_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (int16_type.data_type)) {
+ } else if (st.is_subtype_of (int16_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (int32_type.data_type)) {
+ } else if (st.is_subtype_of (int32_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (type_type.data_type)) {
+ } else if (st.is_subtype_of (type_type.type_symbol)) {
return true;
} else {
return false;
@@ -1249,24 +1249,24 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool is_unsigned_integer_type_argument (DataType type_arg) {
- var st = type_arg.data_type as Struct;
+ unowned Struct? st = type_arg.type_symbol as Struct;
if (st == null) {
return false;
} else if (type_arg.nullable) {
return false;
- } else if (st.is_subtype_of (uchar_type.data_type)) {
+ } else if (st.is_subtype_of (uchar_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (ushort_type.data_type)) {
+ } else if (st.is_subtype_of (ushort_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (uint_type.data_type)) {
+ } else if (st.is_subtype_of (uint_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (ulong_type.data_type)) {
+ } else if (st.is_subtype_of (ulong_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (uint8_type.data_type)) {
+ } else if (st.is_subtype_of (uint8_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (uint16_type.data_type)) {
+ } else if (st.is_subtype_of (uint16_type.type_symbol)) {
return true;
- } else if (st.is_subtype_of (uint32_type.data_type)) {
+ } else if (st.is_subtype_of (uint32_type.type_symbol)) {
return true;
} else {
return false;
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index e7caf0bff..607b75ba7 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -191,7 +191,7 @@ public class Vala.Signal : Symbol, Callable {
if (parent_cl != null) {
foreach (DataType base_type in parent_cl.get_base_types ()) {
- if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, name) is Signal) {
+ if (SemanticAnalyzer.symbol_lookup_inherited (base_type.type_symbol, name) is Signal) {
error = true;
Report.error (source_reference, "Signals with the same name as a signal in a base type are not supported");
return false;
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 7b8232dba..b777c4c12 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -63,7 +63,7 @@ public class Vala.Struct : TypeSymbol {
public Struct? base_struct {
get {
if (_base_type != null) {
- return _base_type.data_type as Struct;
+ return _base_type.type_symbol as Struct;
}
return null;
}
@@ -434,7 +434,7 @@ public class Vala.Struct : TypeSymbol {
}
if (base_type != null) {
- if (base_type.data_type != null && base_type.data_type.is_subtype_of (t)) {
+ if (base_type.type_symbol != null && base_type.type_symbol.is_subtype_of (t)) {
return true;
}
}
diff --git a/vala/valastructvaluetype.vala b/vala/valastructvaluetype.vala
index 1413b5d32..02a0ca609 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) {
- base (type_symbol);
+ this.type_symbol = type_symbol;
}
public override bool is_invokable () {
diff --git a/vala/valaswitchlabel.vala b/vala/valaswitchlabel.vala
index ca92de04c..52b781729 100644
--- a/vala/valaswitchlabel.vala
+++ b/vala/valaswitchlabel.vala
@@ -89,8 +89,8 @@ public class Vala.SwitchLabel : CodeNode {
// enum-type inference
var condition_target_type = switch_statement.expression.target_type;
- if (expression.symbol_reference == null && condition_target_type != null && condition_target_type.data_type is Enum) {
- var enum_type = (Enum) condition_target_type.data_type;
+ if (expression.symbol_reference == null && condition_target_type != null && condition_target_type.type_symbol is Enum) {
+ var enum_type = (Enum) condition_target_type.type_symbol;
foreach (var val in enum_type.get_values ()) {
if (expression.to_string () == val.name) {
expression.target_type = condition_target_type.copy ();
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 1c0da5bcf..bb36b54be 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -64,13 +64,13 @@ public class Vala.SymbolResolver : CodeVisitor {
cl.base_class = null;
foreach (DataType type in cl.get_base_types ()) {
- if (type.data_type is Class) {
+ if (type.type_symbol is Class) {
if (cl.base_class != null) {
cl.error = true;
- Report.error (type.source_reference, "%s: Classes cannot have multiple base classes (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name (), type.data_type.get_full_name ()));
+ Report.error (type.source_reference, "%s: Classes cannot have multiple base classes (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name (), type.type_symbol.get_full_name ()));
return;
}
- cl.base_class = (Class) type.data_type;
+ cl.base_class = (Class) type.type_symbol;
if (cl.base_class.is_subtype_of (cl)) {
cl.error = true;
Report.error (type.source_reference, "Base class cycle (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name ()));
@@ -115,9 +115,9 @@ public class Vala.SymbolResolver : CodeVisitor {
iface.accept_children (this);
foreach (DataType type in iface.get_prerequisites ()) {
- if (type.data_type != null && type.data_type.is_subtype_of (iface)) {
+ if (type.type_symbol != null && type.type_symbol.is_subtype_of (iface)) {
iface.error = true;
- Report.error (type.source_reference, "Prerequisite cycle (`%s' and `%s')".printf (iface.get_full_name (), type.data_type.get_full_name ()));
+ Report.error (type.source_reference, "Prerequisite cycle (`%s' and `%s')".printf (iface.get_full_name (), type.type_symbol.get_full_name ()));
return;
}
}
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 3674b5c45..167ed1128 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -110,7 +110,7 @@ public class Vala.TypeCheck : Expression {
return false;
}
- if (type_reference.data_type == null) {
+ if (type_reference.type_symbol == null) {
/* if type resolving didn't succeed, skip this check */
error = true;
return false;
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index c2ef3ab08..af4ede95d 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -111,20 +111,20 @@ public class Vala.UnaryExpression : Expression {
}
bool is_numeric_type (DataType type) {
- if (type.nullable || !(type.data_type is Struct)) {
+ if (type.nullable || !(type.type_symbol is Struct)) {
return false;
}
- var st = (Struct) type.data_type;
+ var st = (Struct) type.type_symbol;
return st.is_integer_type () || st.is_floating_type ();
}
bool is_integer_type (DataType type) {
- if (type.nullable || !(type.data_type is Struct)) {
+ if (type.nullable || !(type.type_symbol is Struct)) {
return false;
}
- var st = (Struct) type.data_type;
+ var st = (Struct) type.type_symbol;
return st.is_integer_type ();
}
diff --git a/vala/valavaluetype.vala b/vala/valavaluetype.vala
index ed1225d6d..edbeb5120 100644
--- a/vala/valavaluetype.vala
+++ b/vala/valavaluetype.vala
@@ -26,16 +26,6 @@ using GLib;
* A value type, i.e. a struct or an enum type.
*/
public abstract class Vala.ValueType : DataType {
- /**
- * The referred struct or enum.
- */
- public weak TypeSymbol type_symbol { get; set; }
-
- protected ValueType (TypeSymbol type_symbol) {
- this.type_symbol = type_symbol;
- data_type = type_symbol;
- }
-
public override bool is_disposable () {
if (!value_owned) {
return false;
@@ -46,7 +36,7 @@ public abstract class Vala.ValueType : DataType {
return true;
}
- var st = type_symbol as Struct;
+ unowned Struct? st = type_symbol as Struct;
if (st != null) {
return st.is_disposable ();
}