[vala/staging] codegen: Follow rename of DataType data_type property to type_symbol



commit a6bdd4c53b371a979d6ff68c2a81f53e570853d6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Nov 15 20:50:02 2018 +0100

    codegen: Follow rename of DataType data_type property to type_symbol

 codegen/valaccode.vala                     |   6 +-
 codegen/valaccodearraymodule.vala          |   4 +-
 codegen/valaccodeattribute.vala            |  44 ++---
 codegen/valaccodebasemodule.vala           | 262 ++++++++++++++---------------
 codegen/valaccodedelegatemodule.vala       |   4 +-
 codegen/valaccodememberaccessmodule.vala   |  12 +-
 codegen/valaccodemethodcallmodule.vala     |   8 +-
 codegen/valaccodemethodmodule.vala         |  10 +-
 codegen/valaclassregisterfunction.vala     |   8 +-
 codegen/valagasyncmodule.vala              |   4 +-
 codegen/valagdbusclientmodule.vala         |  16 +-
 codegen/valagdbusmodule.vala               |  28 +--
 codegen/valagdbusservermodule.vala         |  16 +-
 codegen/valagerrormodule.vala              |  10 +-
 codegen/valagirwriter.vala                 |   8 +-
 codegen/valagobjectmodule.vala             |  26 +--
 codegen/valagsignalmodule.vala             |  44 ++---
 codegen/valagtkmodule.vala                 |   2 +-
 codegen/valagtypemodule.vala               |  34 ++--
 codegen/valagvariantmodule.vala            |  38 ++---
 codegen/valainterfaceregisterfunction.vala |   2 +-
 21 files changed, 293 insertions(+), 293 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index a9b93ce18..c8dfb167c 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -113,7 +113,7 @@ namespace Vala {
                        return "valavoid";
                } else {
                        unowned DataType type = (DataType) node;
-                       return get_ccode_lower_case_name (type.data_type, infix);
+                       return get_ccode_lower_case_name (type.type_symbol, infix);
                }
        }
 
@@ -164,7 +164,7 @@ namespace Vala {
        }
 
        public static bool is_ref_function_void (DataType type) {
-               unowned Class? cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                if (cl != null) {
                        return get_ccode_ref_function_void (cl);
                } else {
@@ -173,7 +173,7 @@ namespace Vala {
        }
 
        public static bool is_free_function_address_of (DataType type) {
-               unowned Class? cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                if (cl != null) {
                        return get_ccode_free_function_address_of (cl);
                } else {
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index ebef88793..35274bf24 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -83,7 +83,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                }
 
                // add extra item to have array NULL-terminated for all reference types
-               if (expr.element_type.data_type != null && expr.element_type.data_type.is_reference_type ()) {
+               if (expr.element_type.type_symbol != null && expr.element_type.type_symbol.is_reference_type 
()) {
                        cexpr = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, cexpr, new CCodeConstant 
("1"));
                }
 
@@ -514,7 +514,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 
                        CCodeExpression length_expr = new CCodeIdentifier ("length");
                        // add extra item to have array NULL-terminated for all reference types
-                       if (array_type.element_type.data_type != null && 
array_type.element_type.data_type.is_reference_type ()) {
+                       if (array_type.element_type.type_symbol != null && 
array_type.element_type.type_symbol.is_reference_type ()) {
                                length_expr = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, 
length_expr, new CCodeConstant ("1"));
                        }
                        gnew.add_argument (length_expr);
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 87d5142e8..b6dc5da86 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -804,7 +804,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (node is PointerType) {
                        var type = (PointerType) node;
-                       if (type.base_type.data_type != null && type.base_type.data_type.is_reference_type 
()) {
+                       if (type.base_type.type_symbol != null && 
type.base_type.type_symbol.is_reference_type ()) {
                                return get_ccode_name (type.base_type);
                        } else {
                                return "%s*".printf (get_ccode_name (type.base_type));
@@ -919,7 +919,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               var ref_func = get_ccode_ref_function ((ObjectTypeSymbol) prereq.data_type);
+                               string ref_func = get_ccode_ref_function ((ObjectTypeSymbol) 
prereq.type_symbol);
                                if (ref_func != null) {
                                        return ref_func;
                                }
@@ -938,7 +938,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               string unref_func = get_ccode_unref_function ((ObjectTypeSymbol) 
prereq.data_type);
+                               string unref_func = get_ccode_unref_function ((ObjectTypeSymbol) 
prereq.type_symbol);
                                if (unref_func != null) {
                                        return unref_func;
                                }
@@ -955,7 +955,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               string ref_sink_func = get_ccode_ref_sink_function ((ObjectTypeSymbol) 
prereq.data_type);
+                               string ref_sink_func = get_ccode_ref_sink_function ((ObjectTypeSymbol) 
prereq.type_symbol);
                                if (ref_sink_func != "") {
                                        return ref_sink_func;
                                }
@@ -1008,7 +1008,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        } else {
                                return "G_TYPE_POINTER";
                        }
-               } else if (node is ArrayType && ((ArrayType) node).element_type.data_type.get_full_name () == 
"string") {
+               } else if (node is ArrayType && ((ArrayType) node).element_type.type_symbol.get_full_name () 
== "string") {
                        return "G_TYPE_STRV";
                } else if (node is PointerType || node is DelegateType) {
                        return "G_TYPE_POINTER";
@@ -1018,8 +1018,8 @@ public class Vala.CCodeAttribute : AttributeCache {
                        return "G_TYPE_NONE";
                } else {
                        var type = (DataType) node;
-                       if (type.data_type != null) {
-                               return get_ccode_type_id (type.data_type);
+                       if (type.type_symbol != null) {
+                               return get_ccode_type_id (type.type_symbol);
                        }
                }
                return "";
@@ -1055,7 +1055,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                }
                        } else if (sym is Interface) {
                                foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                                       var type_name = get_ccode_marshaller_type_name (prereq.data_type);
+                                       var type_name = get_ccode_marshaller_type_name (prereq.type_symbol);
                                        if (type_name != "") {
                                                return type_name;
                                        }
@@ -1096,11 +1096,11 @@ public class Vala.CCodeAttribute : AttributeCache {
                        return "POINTER";
                } else if (node is ArrayType) {
                        unowned ArrayType array_type = (ArrayType) node;
-                       if (array_type.element_type.data_type.get_full_name () == "string") {
-                               return "BOXED,%s".printf (get_ccode_marshaller_type_name 
(array_type.length_type.data_type));
+                       if (array_type.element_type.type_symbol.get_full_name () == "string") {
+                               return "BOXED,%s".printf (get_ccode_marshaller_type_name 
(array_type.length_type.type_symbol));
                        } else {
                                var ret = "POINTER";
-                               var length_marshaller_type_name = get_ccode_marshaller_type_name 
(array_type.length_type.data_type);
+                               var length_marshaller_type_name = get_ccode_marshaller_type_name 
(array_type.length_type.type_symbol);
                                for (var i = 0; i < array_type.rank; i++) {
                                        ret = "%s,%s".printf (ret, length_marshaller_type_name);
                                }
@@ -1119,7 +1119,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                } else if (node is VoidType) {
                        return "VOID";
                } else {
-                       return get_ccode_marshaller_type_name (((DataType) node).data_type);
+                       return get_ccode_marshaller_type_name (((DataType) node).type_symbol);
                }
                return "";
        }
@@ -1153,7 +1153,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               var type_name = get_ccode_get_value_function (prereq.data_type);
+                               var type_name = get_ccode_get_value_function (prereq.type_symbol);
                                if (type_name != "") {
                                        return type_name;
                                }
@@ -1211,7 +1211,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               var type_name = get_ccode_set_value_function (prereq.data_type);
+                               var type_name = get_ccode_set_value_function (prereq.type_symbol);
                                if (type_name != "") {
                                        return type_name;
                                }
@@ -1269,7 +1269,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                               var func = get_ccode_take_value_function (prereq.data_type);
+                               var func = get_ccode_take_value_function (prereq.type_symbol);
                                if (func != "") {
                                        return func;
                                }
@@ -1313,7 +1313,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                }
                        } else if (sym is Interface) {
                                foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
-                                       var func = get_ccode_param_spec_function (prereq.data_type);
+                                       var func = get_ccode_param_spec_function (prereq.type_symbol);
                                        if (func != "") {
                                                return func;
                                        }
@@ -1364,10 +1364,10 @@ public class Vala.CCodeAttribute : AttributeCache {
                                        return "g_param_spec_boxed";
                                }
                        }
-               } else if (node is ArrayType && ((ArrayType)node).element_type.data_type == 
CodeContext.get().analyzer.string_type.data_type) {
+               } else if (node is ArrayType && ((ArrayType)node).element_type.type_symbol == 
CodeContext.get().analyzer.string_type.type_symbol) {
                        return "g_param_spec_boxed";
-               } else if (node is DataType && ((DataType) node).data_type != null) {
-                       return get_ccode_param_spec_function (((DataType) node).data_type);
+               } else if (node is DataType && ((DataType) node).type_symbol != null) {
+                       return get_ccode_param_spec_function (((DataType) node).type_symbol);
                }
 
                return "g_param_spec_pointer";
@@ -1426,7 +1426,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                }
                                if (m.base_interface_type != null) {
                                        return "%sreal_%s%s".printf (get_ccode_lower_case_prefix 
(m.parent_symbol),
-                                                                                                
get_ccode_lower_case_prefix (m.base_interface_type.data_type),
+                                                                                                
get_ccode_lower_case_prefix (m.base_interface_type.type_symbol),
                                                                                                 m_name);
                                } else {
                                        return "%sreal_%s".printf (get_ccode_lower_case_prefix 
(m.parent_symbol), m_name);
@@ -1457,9 +1457,9 @@ public class Vala.CCodeAttribute : AttributeCache {
                        TypeSymbol t;
                        // FIXME: workaround to make constant arrays possible
                        if (type is ArrayType) {
-                               t = ((ArrayType) type).element_type.data_type;
+                               t = ((ArrayType) type).element_type.type_symbol;
                        } else {
-                               t = type.data_type;
+                               t = type.type_symbol;
                        }
                        if (!t.is_reference_type ()) {
                                ptr = "";
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ff41df47c..dcf5b916c 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -503,7 +503,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (context.module_init_method != null) {
                                foreach (Parameter parameter in context.module_init_method.get_parameters ()) 
{
-                                       if (parameter.variable_type.data_type.is_subtype_of 
(type_module_type)) {
+                                       if (parameter.variable_type.type_symbol.is_subtype_of 
(type_module_type)) {
                                                in_plugin = true;
                                                module_init_param_name = parameter.name;
                                                break;
@@ -678,9 +678,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        public CCodeIdentifier get_value_setter_function (DataType type_reference) {
                var array_type = type_reference as ArrayType;
-               if (type_reference.data_type != null) {
-                       return new CCodeIdentifier (get_ccode_set_value_function (type_reference.data_type));
-               } else if (array_type != null && array_type.element_type.data_type == string_type.data_type) {
+               if (type_reference.type_symbol != null) {
+                       return new CCodeIdentifier (get_ccode_set_value_function 
(type_reference.type_symbol));
+               } else if (array_type != null && array_type.element_type.type_symbol == 
string_type.type_symbol) {
                        // G_TYPE_STRV
                        return new CCodeIdentifier ("g_value_set_boxed");
                } else {
@@ -690,9 +690,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        public CCodeIdentifier get_value_taker_function (DataType type_reference) {
                var array_type = type_reference as ArrayType;
-               if (type_reference.data_type != null) {
-                       return new CCodeIdentifier (get_ccode_take_value_function (type_reference.data_type));
-               } else if (array_type != null && array_type.element_type.data_type == string_type.data_type) {
+               if (type_reference.type_symbol != null) {
+                       return new CCodeIdentifier (get_ccode_take_value_function 
(type_reference.type_symbol));
+               } else if (array_type != null && array_type.element_type.type_symbol == 
string_type.type_symbol) {
                        // G_TYPE_STRV
                        return new CCodeIdentifier ("g_value_take_boxed");
                } else {
@@ -702,9 +702,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        CCodeIdentifier get_value_getter_function (DataType type_reference) {
                var array_type = type_reference as ArrayType;
-               if (type_reference.data_type != null) {
-                       return new CCodeIdentifier (get_ccode_get_value_function (type_reference.data_type));
-               } else if (array_type != null && array_type.element_type.data_type == string_type.data_type) {
+               if (type_reference.type_symbol != null) {
+                       return new CCodeIdentifier (get_ccode_get_value_function 
(type_reference.type_symbol));
+               } else if (array_type != null && array_type.element_type.type_symbol == 
string_type.type_symbol) {
                        // G_TYPE_STRV
                        return new CCodeIdentifier ("g_value_get_boxed");
                } else {
@@ -1500,8 +1500,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        generate_type_declaration (delegate_target_destroy_type, decl_space);
                                }
                        }
-               } else if (type.data_type is Enum) {
-                       var en = (Enum) type.data_type;
+               } else if (type.type_symbol is Enum) {
+                       var en = (Enum) type.type_symbol;
                        generate_enum_declaration (en, decl_space);
                } else if (type is ValueType) {
                        var value_type = (ValueType) type;
@@ -1879,7 +1879,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        get_call.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("old_value")));
                                                        ccode.add_expression (get_call);
                                                }
-                                               var equalfunc = generate_struct_equal_function ((Struct) 
property_type.data_type);
+                                               var equalfunc = generate_struct_equal_function ((Struct) 
property_type.type_symbol);
                                                var ccall = new CCodeFunctionCall (new CCodeIdentifier 
(equalfunc));
                                                ccall.add_argument (new CCodeIdentifier ("value"));
                                                if (property_type.nullable) {
@@ -1935,7 +1935,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        public bool no_implicit_copy (DataType type) {
                // note: implicit copy of array is planned to be forbidden
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                return (type is DelegateType ||
                                type is ArrayType ||
                                (cl != null && !cl.is_immutable && !is_reference_counting (cl) && 
!get_ccode_is_gboxed (cl)));
@@ -2422,10 +2422,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public bool is_simple_struct_creation (Variable variable, Expression expr) {
-               var st = variable.variable_type.data_type as Struct;
+               unowned Struct? st = variable.variable_type.type_symbol as Struct;
                var creation = expr as ObjectCreationExpression;
                if (creation != null && st != null && (!st.is_simple_type () || get_ccode_name (st) == 
"va_list") && !variable.variable_type.nullable &&
-                   variable.variable_type.data_type != gvalue_type && creation.get_object_initializer 
().size == 0) {
+                   variable.variable_type.type_symbol != gvalue_type && creation.get_object_initializer 
().size == 0) {
                        return true;
                } else {
                        return false;
@@ -2599,9 +2599,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_initializer_list (InitializerList list) {
-               if (list.target_type.data_type is Struct) {
+               if (list.target_type.type_symbol is Struct) {
                        /* initializer is used as struct initializer */
-                       var st = (Struct) list.target_type.data_type;
+                       unowned Struct st = (Struct) list.target_type.type_symbol;
                        while (st.base_struct != null) {
                                st = st.base_struct;
                        }
@@ -2737,18 +2737,18 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public virtual CCodeExpression? get_dup_func_expression (DataType type, SourceReference? 
source_reference, bool is_chainup = false) {
                if (type is ErrorType) {
                        return new CCodeIdentifier ("g_error_copy");
-               } else if (type.data_type != null) {
+               } else if (type.type_symbol != null) {
                        string dup_function;
-                       var cl = type.data_type as Class;
-                       if (is_reference_counting (type.data_type)) {
-                               dup_function = get_ccode_ref_function ((ObjectTypeSymbol) type.data_type);
-                               if (type.data_type is Interface && dup_function == null) {
-                                       Report.error (source_reference, "missing class prerequisite for 
interface `%s', add GLib.Object to interface declaration if unsure".printf (type.data_type.get_full_name ()));
+                       unowned Class? cl = type.type_symbol as Class;
+                       if (is_reference_counting (type.type_symbol)) {
+                               dup_function = get_ccode_ref_function ((ObjectTypeSymbol) type.type_symbol);
+                               if (type.type_symbol is Interface && dup_function == null) {
+                                       Report.error (source_reference, "missing class prerequisite for 
interface `%s', add GLib.Object to interface declaration if unsure".printf (type.type_symbol.get_full_name 
()));
                                        return new CCodeInvalidExpression();
                                }
                        } else if (cl != null && cl.is_immutable) {
                                // allow duplicates of immutable instances as for example strings
-                               dup_function = get_ccode_dup_function (type.data_type);
+                               dup_function = get_ccode_dup_function (type.type_symbol);
                                if (dup_function == null) {
                                        dup_function = "";
                                }
@@ -2759,7 +2759,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        dup_function = "";
                                }
                        } else if (type is ValueType) {
-                               dup_function = get_ccode_dup_function (type.data_type);
+                               dup_function = get_ccode_dup_function (type.type_symbol);
                                if (dup_function == null && type.nullable) {
                                        dup_function = generate_struct_dup_wrapper ((ValueType) type);
                                } else if (dup_function == null) {
@@ -2767,7 +2767,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                }
                        } else {
                                // duplicating non-reference counted objects may cause side-effects (and 
performance issues)
-                               Report.error (source_reference, "duplicating %s instance, use unowned 
variable or explicitly invoke copy method".printf (type.data_type.name));
+                               Report.error (source_reference, "duplicating %s instance, use unowned 
variable or explicitly invoke copy method".printf (type.type_symbol.name));
                                return new CCodeInvalidExpression();
                        }
 
@@ -2802,10 +2802,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        void make_comparable_cexpression (ref DataType left_type, ref CCodeExpression cleft, ref DataType 
right_type, ref CCodeExpression cright) {
-               unowned Struct? left_type_as_struct = left_type.data_type as Struct;
-               unowned Struct? right_type_as_struct = right_type.data_type as Struct;
-               unowned ObjectTypeSymbol? left_type_as_object_type = left_type.data_type as ObjectTypeSymbol;
-               unowned ObjectTypeSymbol? right_type_as_object_type = right_type.data_type as 
ObjectTypeSymbol;
+               unowned Struct? left_type_as_struct = left_type.type_symbol as Struct;
+               unowned Struct? right_type_as_struct = right_type.type_symbol as Struct;
+               unowned ObjectTypeSymbol? left_type_as_object_type = left_type.type_symbol as 
ObjectTypeSymbol;
+               unowned ObjectTypeSymbol? right_type_as_object_type = right_type.type_symbol as 
ObjectTypeSymbol;
 
                if (left_type_as_object_type != null && (!(left_type_as_object_type is Class) || !((Class) 
left_type_as_object_type).is_compact)
                    && right_type_as_object_type != null && (!(right_type_as_object_type is Class) || 
!((Class) right_type_as_object_type).is_compact)) {
@@ -2902,7 +2902,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                ccall.add_argument (s2);
                                cexp = ccall;
                        } else if (f.variable_type is StructValueType) {
-                               var equalfunc = generate_struct_equal_function (f.variable_type.data_type as 
Struct);
+                               var equalfunc = generate_struct_equal_function (f.variable_type.type_symbol 
as Struct);
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier (equalfunc));
                                ccall.add_argument (s1);
                                ccall.add_argument (s2);
@@ -3010,11 +3010,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        ccode.add_declaration (get_ccode_name (value_type), new CCodeVariableDeclarator 
("dup"));
 
                        var creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
-                       creation_call.add_argument (new CCodeConstant (get_ccode_name 
(value_type.data_type)));
+                       creation_call.add_argument (new CCodeConstant (get_ccode_name 
(value_type.type_symbol)));
                        creation_call.add_argument (new CCodeConstant ("1"));
                        ccode.add_assignment (new CCodeIdentifier ("dup"), creation_call);
 
-                       var st = value_type.data_type as Struct;
+                       var st = value_type.type_symbol as Struct;
                        if (st != null && st.is_disposable ()) {
                                if (!get_ccode_has_copy_function (st)) {
                                        generate_struct_copy_function (st);
@@ -3028,7 +3028,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                cfile.add_include ("string.h");
 
                                var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-                               sizeof_call.add_argument (new CCodeConstant (get_ccode_name 
(value_type.data_type)));
+                               sizeof_call.add_argument (new CCodeConstant (get_ccode_name 
(value_type.type_symbol)));
 
                                var copy_call = new CCodeFunctionCall (new CCodeIdentifier ("memcpy"));
                                copy_call.add_argument (new CCodeIdentifier ("dup"));
@@ -3049,7 +3049,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        protected string generate_dup_func_wrapper (DataType type) {
-               string destroy_func = "_vala_%s_copy".printf (get_ccode_name (type.data_type));
+               string destroy_func = "_vala_%s_copy".printf (get_ccode_name (type.type_symbol));
 
                if (!add_wrapper (destroy_func)) {
                        // wrapper already defined
@@ -3062,7 +3062,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                push_function (function);
 
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                assert (cl != null && get_ccode_is_gboxed (cl));
 
                var free_call = new CCodeFunctionCall (new CCodeIdentifier ("g_boxed_copy"));
@@ -3080,7 +3080,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        protected string generate_free_function_address_of_wrapper (DataType type) {
-               string destroy_func = "_vala_%s_free_function_address_of".printf (get_ccode_name 
(type.data_type));
+               string destroy_func = "_vala_%s_free_function_address_of".printf (get_ccode_name 
(type.type_symbol));
 
                if (!add_wrapper (destroy_func)) {
                        // wrapper already defined
@@ -3093,7 +3093,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                push_function (function);
 
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
+               assert (cl != null);
+
                var free_call = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_free_function (cl)));
                free_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("self")));
 
@@ -3109,7 +3111,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        protected string generate_destroy_function_content_of_wrapper (DataType type) {
                // g_array_set_clear_func has a specific GDestroyNotify where the content of an element is 
given
-               string destroy_func = "_vala_%s_free_function_content_of".printf (get_ccode_name 
(type.data_type));
+               string destroy_func = "_vala_%s_free_function_content_of".printf (get_ccode_name 
(type.type_symbol));
 
                if (!add_wrapper (destroy_func)) {
                        // wrapper already defined
@@ -3139,7 +3141,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        protected string generate_free_func_wrapper (DataType type) {
-               string destroy_func = "_vala_%s_free".printf (get_ccode_name (type.data_type));
+               string destroy_func = "_vala_%s_free".printf (get_ccode_name (type.type_symbol));
 
                if (!add_wrapper (destroy_func)) {
                        // wrapper already defined
@@ -3152,7 +3154,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                push_function (function);
 
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                if (cl != null && get_ccode_is_gboxed (cl)) {
                        var free_call = new CCodeFunctionCall (new CCodeIdentifier ("g_boxed_free"));
                        free_call.add_argument (new CCodeIdentifier (get_ccode_type_id (cl)));
@@ -3160,7 +3162,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        ccode.add_expression (free_call);
                } else {
-                       var st = type.data_type as Struct;
+                       unowned Struct? st = type.type_symbol as Struct;
                        if (st != null && st.is_disposable ()) {
                                if (!get_ccode_has_destroy_function (st)) {
                                        generate_struct_destroy_function (st);
@@ -3215,7 +3217,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public CCodeExpression? get_destroy_func_expression (DataType type, bool is_chainup = false) {
-               if (context.profile == Profile.GOBJECT && (type.data_type == glist_type || type.data_type == 
gslist_type || type.data_type == gnode_type || type.data_type == gqueue_type)) {
+               if (context.profile == Profile.GOBJECT && (type.type_symbol == glist_type || type.type_symbol 
== gslist_type || type.type_symbol == gnode_type || type.type_symbol == gqueue_type)) {
                        // create wrapper function to free list elements if necessary
 
                        bool elements_require_free = false;
@@ -3244,36 +3246,36 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                }
                                return cexpr;
                        } else {
-                               return new CCodeIdentifier (get_ccode_free_function (type.data_type));
+                               return new CCodeIdentifier (get_ccode_free_function (type.type_symbol));
                        }
                } else if (type is ErrorType) {
                        return new CCodeIdentifier ("g_error_free");
-               } else if (type.data_type != null) {
+               } else if (type.type_symbol != null) {
                        string unref_function;
                        if (type is ReferenceType) {
-                               if (is_reference_counting (type.data_type)) {
-                                       unref_function = get_ccode_unref_function ((ObjectTypeSymbol) 
type.data_type);
-                                       if (type.data_type is Interface && unref_function == null) {
-                                               Report.error (type.source_reference, "missing class 
prerequisite for interface `%s', add GLib.Object to interface declaration if unsure".printf 
(type.data_type.get_full_name ()));
+                               if (is_reference_counting (type.type_symbol)) {
+                                       unref_function = get_ccode_unref_function ((ObjectTypeSymbol) 
type.type_symbol);
+                                       if (type.type_symbol is Interface && unref_function == null) {
+                                               Report.error (type.source_reference, "missing class 
prerequisite for interface `%s', add GLib.Object to interface declaration if unsure".printf 
(type.type_symbol.get_full_name ()));
                                                return null;
                                        }
                                } else {
-                                       var cl = type.data_type as Class;
+                                       unowned Class? cl = type.type_symbol as Class;
                                        if (cl != null && get_ccode_is_gboxed (cl)) {
                                                unref_function = generate_free_func_wrapper (type);
                                        } else {
                                                if (is_free_function_address_of (type)) {
                                                        unref_function = 
generate_free_function_address_of_wrapper (type);
                                                } else {
-                                                       unref_function = get_ccode_free_function 
(type.data_type);
+                                                       unref_function = get_ccode_free_function 
(type.type_symbol);
                                                }
                                        }
                                }
                        } else {
                                if (type.nullable) {
-                                       unref_function = get_ccode_free_function (type.data_type);
+                                       unref_function = get_ccode_free_function (type.type_symbol);
                                        if (unref_function == null) {
-                                               if (type.data_type is Struct && ((Struct) 
type.data_type).is_disposable ()) {
+                                               if (type.type_symbol is Struct && ((Struct) 
type.type_symbol).is_disposable ()) {
                                                        unref_function = generate_free_func_wrapper (type);
                                                } else {
                                                        unref_function = "g_free";
@@ -3282,8 +3284,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                } else if (type is EnumValueType) {
                                        unref_function = null;
                                } else {
-                                       var st = (Struct) type.data_type;
-                                       if (st.is_disposable ()) {
+                                       unowned Struct? st = type.type_symbol as Struct;
+                                       if (st != null && st.is_disposable ()) {
                                                if (!get_ccode_has_destroy_function (st)) {
                                                        generate_struct_destroy_function (st);
                                                }
@@ -3340,14 +3342,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                string? destroy_func_wrapper = null;
                if (element_destroy_func_expression != null) {
-                       destroy_func_wrapper = "_%s_%s".printf (get_ccode_free_function 
(collection_type.data_type), element_destroy_func_expression.name);
+                       destroy_func_wrapper = "_%s_%s".printf (get_ccode_free_function 
(collection_type.type_symbol), element_destroy_func_expression.name);
                        if (!add_wrapper (destroy_func_wrapper)) {
                                // wrapper already defined
                                return destroy_func_wrapper;
                        }
                }
 
-               if (collection_type.data_type == gnode_type) {
+               if (collection_type.type_symbol == gnode_type) {
                        destroy_func = "_g_node_free_all";
                        if (!add_wrapper (destroy_func)) {
                                // wrapper already defined
@@ -3406,11 +3408,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        cfile.add_function_declaration (function);
                        cfile.add_function (function);
-               } else if (collection_type.data_type == glist_type) {
+               } else if (collection_type.type_symbol == glist_type) {
                        destroy_func = "g_list_free_full";
-               } else if (collection_type.data_type == gslist_type) {
+               } else if (collection_type.type_symbol == gslist_type) {
                        destroy_func = "g_slist_free_full";
-               } else if (collection_type.data_type == gqueue_type) {
+               } else if (collection_type.type_symbol == gqueue_type) {
                        destroy_func = "g_queue_free_full";
                } else {
                        Report.error (null, "internal error: type of collection not supported");
@@ -3490,7 +3492,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return ccomma;
                }
 
-               bool is_gcollection = (type.data_type == glist_type || type.data_type == gslist_type || 
type.data_type == gnode_type || type.data_type == gqueue_type);
+               bool is_gcollection = (type.type_symbol == glist_type || type.type_symbol == gslist_type || 
type.type_symbol == gnode_type || type.type_symbol == gqueue_type);
                CCodeFunctionCall ccall;
                var cexpr = get_destroy_func_expression (type);
                if (is_gcollection && cexpr is CCodeFunctionCall) {
@@ -3501,7 +3503,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (type is ValueType && !type.nullable) {
                        // normal value type, no null check
-                       var st = type.data_type as Struct;
+                       unowned Struct? st = type.type_symbol as Struct;
                        if (st != null && st.is_simple_type ()) {
                                // used for va_list
                                ccall.add_argument (cvar);
@@ -3509,7 +3511,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
cvar));
                        }
 
-                       if (gvalue_type != null && type.data_type == gvalue_type) {
+                       if (gvalue_type != null && type.type_symbol == gvalue_type) {
                                // g_value_unset must not be called for already unset values
                                var cisvalid = new CCodeFunctionCall (new CCodeIdentifier ("G_IS_VALUE"));
                                cisvalid.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, cvar));
@@ -3519,14 +3521,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                ccomma.append_expression (new CCodeConstant ("NULL"));
 
                                return new CCodeConditionalExpression (cisvalid, ccomma, new CCodeConstant 
("NULL"));
-                       } else if ((type.data_type == gmutex_type ||
-                                   type.data_type == grecmutex_type ||
-                                   type.data_type == grwlock_type ||
-                                   type.data_type == gcond_type)) {
+                       } else if ((type.type_symbol == gmutex_type ||
+                                   type.type_symbol == grecmutex_type ||
+                                   type.type_symbol == grwlock_type ||
+                                   type.type_symbol == gcond_type)) {
                                // g_mutex_clear must not be called for uninitialized mutex
                                // also, g_mutex_clear does not clear the struct
                                requires_clear_mutex = true;
-                               ccall.call = new CCodeIdentifier ("_vala_clear_" + get_ccode_name 
(type.data_type));
+                               ccall.call = new CCodeIdentifier ("_vala_clear_" + get_ccode_name 
(type.type_symbol));
                                return ccall;
                        } else {
                                return ccall;
@@ -3581,13 +3583,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                var ccomma = new CCodeCommaExpression ();
 
                if (context.profile == Profile.GOBJECT) {
-                       if (type.data_type != null && !is_reference_counting (type.data_type) &&
-                           (type.data_type.is_subtype_of (gstringbuilder_type)
-                            || type.data_type.is_subtype_of (garray_type)
-                            || type.data_type.is_subtype_of (gbytearray_type)
-                            || type.data_type.is_subtype_of (gptrarray_type))) {
+                       if (type.type_symbol != null && !is_reference_counting (type.type_symbol) &&
+                           (type.type_symbol.is_subtype_of (gstringbuilder_type)
+                            || type.type_symbol.is_subtype_of (garray_type)
+                            || type.type_symbol.is_subtype_of (gbytearray_type)
+                            || type.type_symbol.is_subtype_of (gptrarray_type))) {
                                ccall.add_argument (new CCodeConstant ("TRUE"));
-                       } else if (type.data_type == gthreadpool_type) {
+                       } else if (type.type_symbol == gthreadpool_type) {
                                ccall.add_argument (new CCodeConstant ("FALSE"));
                                ccall.add_argument (new CCodeConstant ("TRUE"));
                        } else if (type is ArrayType) {
@@ -3606,7 +3608,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        }
 
                                        if (csizeexpr != null) {
-                                               var st = array_type.element_type.data_type as Struct;
+                                               unowned Struct? st = array_type.element_type.type_symbol as 
Struct;
                                                if (st != null && !array_type.element_type.nullable) {
                                                        ccall.call = new CCodeIdentifier 
(append_struct_array_free (st));
                                                        ccall.add_argument (csizeexpr);
@@ -3627,7 +3629,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                var cassign = new CCodeAssignment (cvar, ccomma);
 
                // g_free (NULL) is allowed
-               bool uses_gfree = (type.data_type != null && !is_reference_counting (type.data_type) && 
get_ccode_free_function (type.data_type) == "g_free");
+               bool uses_gfree = (type.type_symbol != null && !is_reference_counting (type.type_symbol) && 
get_ccode_free_function (type.type_symbol) == "g_free");
                uses_gfree = uses_gfree || type is ArrayType;
                if (uses_gfree) {
                        return cassign;
@@ -4025,7 +4027,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public override void visit_delete_statement (DeleteStatement stmt) {
                unowned DataType type = stmt.expression.value_type;
                unowned PointerType? pointer_type = type as PointerType;
-               if (pointer_type != null && pointer_type.base_type.data_type != null && 
pointer_type.base_type.data_type.is_reference_type ()) {
+               if (pointer_type != null && pointer_type.base_type.type_symbol != null && 
pointer_type.base_type.type_symbol.is_reference_type ()) {
                        type = pointer_type.base_type;
                }
 
@@ -4035,7 +4037,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        static bool is_compact_class_destructor_call (Expression expr) {
-               unowned Class? cl = expr.value_type.data_type as Class;
+               unowned Class? cl = expr.value_type.type_symbol as Class;
                if (cl != null && cl.is_compact && expr.parent_node is MemberAccess) {
                        unowned MethodType? mt = ((MemberAccess) expr.parent_node).value_type as MethodType;
                        if (mt != null && mt.method_symbol != null && mt.method_symbol.get_attribute 
("DestroysInstance") != null) {
@@ -4257,7 +4259,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_base_access (BaseAccess expr) {
-               set_cvalue (expr, generate_instance_cast (get_this_cexpression (), 
expr.value_type.data_type));
+               set_cvalue (expr, generate_instance_cast (get_this_cexpression (), 
expr.value_type.type_symbol));
        }
 
        public override void visit_postfix_expression (PostfixExpression expr) {
@@ -4302,8 +4304,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        static bool is_limited_generic_type (GenericType type) {
-               var cl = type.type_parameter.parent_symbol as Class;
-               var st = type.type_parameter.parent_symbol as Struct;
+               unowned Class? cl = type.type_parameter.parent_symbol as Class;
+               unowned Struct? st = type.type_parameter.parent_symbol as Struct;
                if ((cl != null && cl.is_compact) || st != null) {
                        // compact classes and structs only
                        // have very limited generics support
@@ -4317,7 +4319,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return false;
                }
 
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                if (cl != null && is_reference_counting (cl)
                    && get_ccode_ref_function (cl) == "") {
                        // empty ref_function => no ref necessary
@@ -4343,7 +4345,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return requires_destroy (array_type.element_type);
                }
 
-               var cl = type.data_type as Class;
+               unowned Class? cl = type.type_symbol as Class;
                if (cl != null && is_reference_counting (cl)
                    && get_ccode_unref_function (cl) == "") {
                        // empty unref_function => no unref necessary
@@ -4394,7 +4396,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                generate_struct_copy_function (st);
                        }
 
-                       if (gvalue_type != null && type.data_type == gvalue_type) {
+                       if (gvalue_type != null && type.type_symbol == gvalue_type) {
                                var cisvalid = new CCodeFunctionCall (new CCodeIdentifier ("G_IS_VALUE"));
                                cisvalid.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, cexpr));
 
@@ -4510,7 +4512,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
 
                        CCodeExpression cifnull;
-                       if (type.data_type != null) {
+                       if (type.type_symbol != null) {
                                cifnull = new CCodeConstant ("NULL");
                        } else {
                                // the value might be non-null even when the dup function is null,
@@ -4581,7 +4583,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                CCodeExpression instance = null;
                CCodeExpression creation_expr = null;
 
-               var st = expr.type_reference.data_type as Struct;
+               unowned Struct? st = expr.type_reference.type_symbol as Struct;
                if ((st != null && (!st.is_simple_type () || get_ccode_name (st) == "va_list")) || 
expr.get_object_initializer ().size > 0) {
                        // value-type initialization or object creation expression with object initializer
 
@@ -4619,7 +4621,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (expr.symbol_reference == null) {
                        // no creation method
-                       if (expr.type_reference.data_type is Struct) {
+                       if (expr.type_reference.type_symbol is Struct) {
                                // memset needs string.h
                                cfile.add_include ("string.h");
                                var creation_call = new CCodeFunctionCall (new CCodeIdentifier ("memset"));
@@ -4629,8 +4631,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                creation_expr = creation_call;
                        }
-               } else if (expr.type_reference.data_type == glist_type ||
-                          expr.type_reference.data_type == gslist_type) {
+               } else if (expr.type_reference.type_symbol == glist_type ||
+                          expr.type_reference.type_symbol == gslist_type) {
                        // NULL is an empty list
                        set_cvalue (expr, new CCodeConstant ("NULL"));
                } else if (expr.symbol_reference is Method) {
@@ -4644,7 +4646,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        generate_method_declaration (m, cfile);
 
-                       var cl = expr.type_reference.data_type as Class;
+                       unowned Class? cl = expr.type_reference.type_symbol as Class;
 
                        if (!get_ccode_has_new_function (m)) {
                                // use construct function directly
@@ -4910,7 +4912,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        ccode.add_expression (creation_expr);
                        set_cvalue (expr, instance);
                } else if (instance != null) {
-                       if (expr.type_reference.data_type is Struct) {
+                       if (expr.type_reference.type_symbol is Struct) {
                                ccode.add_expression (creation_expr);
                        } else {
                                ccode.add_assignment (instance, creation_expr);
@@ -4947,7 +4949,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        ccode.add_assignment (get_cvalue_ (temp_value), creation_expr);
                        expr.target_value = temp_value;
 
-                       var cl = expr.type_reference.data_type as Class;
+                       unowned Class? cl = expr.type_reference.type_symbol as Class;
                        if (context.gobject_tracing) {
                                // GObject creation tracing enabled
 
@@ -4984,7 +4986,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        clear_func.add_argument (get_cvalue_ (expr.target_value));
                                        string destroy_func;
                                        if (type_arg.is_non_null_simple_type () || 
type_arg.is_real_non_null_struct_type ()) {
-                                               destroy_func = get_ccode_destroy_function 
(type_arg.data_type);
+                                               destroy_func = get_ccode_destroy_function 
(type_arg.type_symbol);
                                        } else {
                                                destroy_func = generate_destroy_function_content_of_wrapper 
(type_arg);
                                        }
@@ -5095,7 +5097,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public CCodeExpression? try_cast_value_to_type (CCodeExpression ccodeexpr, DataType from, DataType 
to, Expression? expr = null) {
-               if (from == null || gvalue_type == null || from.data_type != gvalue_type || to.data_type == 
gvalue_type || get_ccode_type_id (to) == "") {
+               if (from == null || gvalue_type == null || from.type_symbol != gvalue_type || to.type_symbol 
== gvalue_type || get_ccode_type_id (to) == "") {
                        return null;
                }
 
@@ -5156,8 +5158,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
                }
 
-               var cl = expr.type_reference.data_type as Class;
-               var iface = expr.type_reference.data_type as Interface;
+               unowned Class? cl = expr.type_reference.type_symbol as Class;
+               unowned Interface? iface = expr.type_reference.type_symbol as Interface;
                if (context.profile == Profile.GOBJECT && (iface != null || (cl != null && !cl.is_compact))) {
                        // checked cast for strict subtypes of GTypeInstance
                        if (expr.is_silent_cast) {
@@ -5181,7 +5183,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        expr.target_value = cast_value;
                                }
                        } else {
-                               set_cvalue (expr, generate_instance_cast (get_cvalue (expr.inner), 
expr.type_reference.data_type));
+                               set_cvalue (expr, generate_instance_cast (get_cvalue (expr.inner), 
expr.type_reference.type_symbol));
                        }
                } else {
                        if (expr.is_silent_cast) {
@@ -5219,12 +5221,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                var value_type = expr.inner.value_type;
                                if (value_type is ValueType) {
-                                       var data_type = ((ValueType) value_type).data_type;
-                                       sizeof_from.add_argument (new CCodeConstant (get_ccode_name 
(data_type)));
+                                       sizeof_from.add_argument (new CCodeConstant (get_ccode_name 
(value_type.type_symbol)));
                                        array_length_expr = new CCodeBinaryExpression 
(CCodeBinaryOperator.DIV, sizeof_from, sizeof_to);
                                } else if (value_type is PointerType && ((PointerType) value_type).base_type 
is ValueType) {
-                                       var data_type = ((ValueType) (((PointerType) 
value_type).base_type)).data_type;
-                                       sizeof_from.add_argument (new CCodeConstant (get_ccode_name 
(data_type)));
+                                       sizeof_from.add_argument (new CCodeConstant (get_ccode_name 
(((PointerType) value_type).base_type.type_symbol)));
                                        array_length_expr = new CCodeBinaryExpression 
(CCodeBinaryOperator.DIV, sizeof_from, sizeof_to);
                                } else {
                                        // cast from unsupported non-array to array, set invalid length
@@ -5435,7 +5435,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        make_comparable_cexpression (ref left_type, ref cleft, ref right_type, ref cright);
 
                        if (left_type is StructValueType && right_type is StructValueType) {
-                               var equalfunc = generate_struct_equal_function ((Struct) left_type.data_type);
+                               var equalfunc = generate_struct_equal_function ((Struct) 
left_type.type_symbol);
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier (equalfunc));
                                ccall.add_argument (cleft);
                                ccall.add_argument (cright);
@@ -5443,7 +5443,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                cright = new CCodeConstant ("TRUE");
                        } else if ((left_type is IntegerType || left_type is FloatingType || left_type is 
BooleanType || left_type is EnumValueType) && left_type.nullable &&
                                   (right_type is IntegerType || right_type is FloatingType || right_type is 
BooleanType || right_type is EnumValueType) && right_type.nullable) {
-                               var equalfunc = generate_numeric_equal_function ((TypeSymbol) 
left_type.data_type);
+                               var equalfunc = generate_numeric_equal_function ((TypeSymbol) 
left_type.type_symbol);
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier (equalfunc));
                                ccall.add_argument (cleft);
                                ccall.add_argument (cright);
@@ -5554,7 +5554,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, instance_domain, 
type_domain);
                } else {
                        CCodeFunctionCall ccheck;
-                       if (type.data_type == null || type.data_type.external_package) {
+                       if (type.type_symbol == null || type.type_symbol.external_package) {
                                var type_id = get_type_id_expression (type);
                                if (type_id == null) {
                                        return new CCodeInvalidExpression ();
@@ -5563,7 +5563,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                ccheck.add_argument ((CCodeExpression) ccodenode);
                                ccheck.add_argument (type_id);
                        } else {
-                               ccheck = new CCodeFunctionCall (new CCodeIdentifier 
(get_ccode_type_check_function (type.data_type)));
+                               ccheck = new CCodeFunctionCall (new CCodeIdentifier 
(get_ccode_type_check_function (type.type_symbol)));
                                ccheck.add_argument ((CCodeExpression) ccodenode);
                        }
 
@@ -5607,7 +5607,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        ccall.add_argument (cneedle);
                        cif_condition = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccall, new 
CCodeConstant ("0"));
                } else if (array_type.element_type is StructValueType) {
-                       var equalfunc = generate_struct_equal_function ((Struct) 
array_type.element_type.data_type);
+                       var equalfunc = generate_struct_equal_function ((Struct) 
array_type.element_type.type_symbol);
                        var ccall = new CCodeFunctionCall (new CCodeIdentifier (equalfunc));
                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
celement));
                        ccall.add_argument (cneedle);
@@ -5688,8 +5688,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (pointer_type != null) {
                        type = pointer_type.base_type;
                }
-               var cl = type.data_type as Class;
-               var iface = type.data_type as Interface;
+               unowned Class? cl = type.type_symbol as Class;
+               unowned Interface? iface = type.type_symbol as Interface;
                if ((cl != null && !cl.is_compact) || iface != null || type is GenericType || type is 
ErrorType) {
                        set_cvalue (expr, create_type_check (get_cvalue (expr.expression), 
expr.type_reference));
                } else {
@@ -5781,7 +5781,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                    && type.floating_reference) {
                        /* floating reference, sink it.
                         */
-                       var cl = type.data_type as ObjectTypeSymbol;
+                       unowned ObjectTypeSymbol? cl = type.type_symbol as ObjectTypeSymbol;
                        var sink_func = (cl != null) ? get_ccode_ref_sink_function (cl) : "";
 
                        if (sink_func != "") {
@@ -5798,7 +5798,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        ccode.close ();
                                }
                        } else {
-                               Report.error (node.source_reference, "type `%s' does not support floating 
references".printf (type.data_type.name));
+                               Report.error (node.source_reference, "type `%s' does not support floating 
references".printf (type.type_symbol.name));
                        }
                }
 
@@ -5809,14 +5809,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                bool gvalue_boxing = (context.profile == Profile.GOBJECT
                                      && target_type != null
-                                     && target_type.data_type == gvalue_type
+                                     && target_type.type_symbol == gvalue_type
                                      && !(type is NullType)
                                      && get_ccode_type_id (type) != "G_TYPE_VALUE");
                bool gvariant_boxing = (context.profile == Profile.GOBJECT
                                        && target_type != null
-                                       && target_type.data_type == gvariant_type
+                                       && target_type.type_symbol == gvariant_type
                                        && !(type is NullType)
-                                       && type.data_type != gvariant_type);
+                                       && type.type_symbol != gvariant_type);
 
                if (type.value_owned
                    && (target_type == null || !target_type.value_owned || boxing || unboxing || 
gvariant_boxing)
@@ -5968,8 +5968,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (!gvalue_boxing && !gvariant_boxing && target_type.value_owned && (!type.value_owned || 
boxing || unboxing || array_needs_copy) && requires_copy (target_type) && !(type is NullType)) {
                        // need to copy value
                        var copy = (GLibValue) copy_value (result, node);
-                       if (target_type.data_type is Interface && copy == null) {
-                               Report.error (node.source_reference, "missing class prerequisite for 
interface `%s', add GLib.Object to interface declaration if unsure".printf 
(target_type.data_type.get_full_name ()));
+                       if (target_type.type_symbol is Interface && copy == null) {
+                               Report.error (node.source_reference, "missing class prerequisite for 
interface `%s', add GLib.Object to interface declaration if unsure".printf 
(target_type.type_symbol.get_full_name ()));
                                return result;
                        }
                        result = copy;
@@ -5988,7 +5988,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public virtual CCodeExpression get_implicit_cast_expression (CCodeExpression source_cexpr, DataType? 
expression_type, DataType? target_type, CodeNode? node) {
                var cexpr = source_cexpr;
 
-               if (expression_type.data_type != null && expression_type.data_type == target_type.data_type) {
+               if (expression_type.type_symbol != null && expression_type.type_symbol == 
target_type.type_symbol) {
                        // same type, no cast required
                        return cexpr;
                }
@@ -6000,14 +6000,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                generate_type_declaration (target_type, cfile);
 
-               var cl = target_type.data_type as Class;
-               var iface = target_type.data_type as Interface;
+               unowned Class? cl = target_type.type_symbol as Class;
+               unowned Interface? iface = target_type.type_symbol as Interface;
                if (context.checking && (iface != null || (cl != null && !cl.is_compact))) {
                        // checked cast for strict subtypes of GTypeInstance
-                       return generate_instance_cast (cexpr, target_type.data_type);
-               } else if (target_type.data_type != null && get_ccode_name (expression_type) != 
get_ccode_name (target_type)) {
-                       var st = target_type.data_type as Struct;
-                       if (target_type.data_type.is_reference_type () || (st != null && st.is_simple_type 
())) {
+                       return generate_instance_cast (cexpr, target_type.type_symbol);
+               } else if (target_type.type_symbol != null && get_ccode_name (expression_type) != 
get_ccode_name (target_type)) {
+                       unowned Struct? st = target_type.type_symbol as Struct;
+                       if (target_type.type_symbol.is_reference_type () || (st != null && st.is_simple_type 
())) {
                                // don't cast non-simple structs
                                return new CCodeCastExpression (cexpr, get_ccode_name (target_type));
                        } else {
@@ -6172,11 +6172,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public CCodeExpression? default_value_for_type (DataType type, bool initializer_expression, bool 
on_error = false) {
-               var st = type.data_type as Struct;
+               unowned Struct? st = type.type_symbol as Struct;
                var array_type = type as ArrayType;
-               if (type.data_type != null && !type.nullable
-                   && (on_error ? get_ccode_default_value_on_error (type.data_type) : 
get_ccode_default_value (type.data_type)) != "") {
-                       return new CCodeConstant (on_error ? get_ccode_default_value_on_error 
(type.data_type) : get_ccode_default_value (type.data_type));
+               if (type.type_symbol != null && !type.nullable
+                   && (on_error ? get_ccode_default_value_on_error (type.type_symbol) : 
get_ccode_default_value (type.type_symbol)) != "") {
+                       return new CCodeConstant (on_error ? get_ccode_default_value_on_error 
(type.type_symbol) : get_ccode_default_value (type.type_symbol));
                } else if (initializer_expression && !type.nullable &&
                                   (st != null || (array_type != null && array_type.fixed_length))) {
                        // 0-initialize struct with struct initializer { 0 }
@@ -6184,7 +6184,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        var clist = new CCodeInitializerList ();
                        clist.append (new CCodeConstant ("0"));
                        return clist;
-               } else if ((type.data_type != null && type.data_type.is_reference_type ())
+               } else if ((type.type_symbol != null && type.type_symbol.is_reference_type ())
                           || type.nullable
                           || type is PointerType || type is DelegateType
                           || (array_type != null && !array_type.fixed_length)) {
@@ -6238,8 +6238,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (array_type != null && array_type.inline_allocated) {
                        return false;
                }
-               if (type.data_type != null) {
-                       return type.data_type.get_attribute_bool ("CCode", "lvalue_access", true);
+               if (type.type_symbol != null) {
+                       return type.type_symbol.get_attribute_bool ("CCode", "lvalue_access", true);
                }
                return true;
        }
@@ -6367,7 +6367,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public void return_default_value (DataType return_type, bool on_error = false) {
-               var st = return_type.data_type as Struct;
+               unowned Struct? st = return_type.type_symbol as Struct;
                if (st != null && st.is_simple_type () && !return_type.nullable) {
                        // 0-initialize struct with struct initializer { 0 }
                        // only allowed as initializer expression in C
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index ef2bd1179..b682081f7 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -222,7 +222,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                foreach (Parameter param in d_params) {
                        if (dynamic_sig != null
                            && param.variable_type is ArrayType
-                           && ((ArrayType) param.variable_type).element_type.data_type == 
string_type.data_type) {
+                           && ((ArrayType) param.variable_type).element_type.type_symbol == 
string_type.type_symbol) {
                                // use null-terminated string arrays for dynamic signals for compatibility 
reasons
                                param.set_attribute_bool ("CCode", "array_length", false);
                                param.set_attribute_bool ("CCode", "array_null_terminated", true);
@@ -427,7 +427,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                        if (m.closure) {
                                int block_id = get_block_id (current_closure_block);
                                destroy_notify = new CCodeIdentifier ("block%d_data_unref".printf (block_id));
-                       } else if (get_this_type () != null && m.binding != MemberBinding.STATIC && 
!m.is_async_callback && is_reference_counting (m.this_parameter.variable_type.data_type)) {
+                       } else if (get_this_type () != null && m.binding != MemberBinding.STATIC && 
!m.is_async_callback && is_reference_counting (m.this_parameter.variable_type.type_symbol)) {
                                destroy_notify = get_destroy_func_expression (m.this_parameter.variable_type);
                        }
 
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 5ef5f4eb9..8e546878e 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -100,7 +100,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                // expr.inner is null in the special case of referencing the method in a 
constant initializer
                                var delegate_target = (CCodeExpression) get_ccodenode (expr.inner);
                                delegate_type = expr.target_type as DelegateType;
-                               if ((expr.value_type.value_owned || (delegate_type != null && 
delegate_type.is_called_once)) && expr.inner.value_type.data_type != null && is_reference_counting 
(expr.inner.value_type.data_type)) {
+                               if ((expr.value_type.value_owned || (delegate_type != null && 
delegate_type.is_called_once)) && expr.inner.value_type.type_symbol != null && is_reference_counting 
(expr.inner.value_type.type_symbol)) {
                                        var ref_call = new CCodeFunctionCall (get_dup_func_expression 
(expr.inner.value_type, expr.source_reference));
                                        ref_call.add_argument (delegate_target);
                                        delegate_target = ref_call;
@@ -452,7 +452,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                // use closure
                                result.cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier 
("_data_"), "self");
                        } else {
-                               var st = result.value_type.data_type as Struct;
+                               unowned Struct? st = result.value_type.type_symbol as Struct;
                                if (st != null && !st.is_simple_type ()) {
                                        result.cvalue = new CCodeIdentifier ("(*self)");
                                } else {
@@ -489,7 +489,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                        }
                                }
                        } else {
-                               var type_as_struct = result.value_type.data_type as Struct;
+                               unowned Struct? type_as_struct = result.value_type.type_symbol as Struct;
 
                                if (param.direction == ParameterDirection.OUT) {
                                        name = "_vala_%s".printf (name);
@@ -576,8 +576,8 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 
                        var instance_target_type = get_data_type_for_symbol ((TypeSymbol) 
field.parent_symbol);
 
-                       var cl = instance_target_type.data_type as Class;
-                       bool is_gtypeinstance = ((instance_target_type.data_type == cl) && (cl == null || 
!cl.is_compact));
+                       unowned Class? cl = instance_target_type.type_symbol as Class;
+                       bool is_gtypeinstance = ((instance_target_type.type_symbol == cl) && (cl == null || 
!cl.is_compact));
 
                        CCodeExpression inst;
                        if (is_gtypeinstance && field.access == SymbolAccessibility.PRIVATE) {
@@ -596,7 +596,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                return result;
                        }
 
-                       if (instance_target_type.data_type.is_reference_type () || (instance != null && 
instance.value_type is PointerType)) {
+                       if (instance_target_type.type_symbol.is_reference_type () || (instance != null && 
instance.value_type is PointerType)) {
                                result.cvalue = new CCodeMemberAccess.pointer (inst, get_ccode_name (field));
                        } else {
                                result.cvalue = new CCodeMemberAccess (inst, get_ccode_name (field));
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 970606cd6..d41e2904d 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -51,9 +51,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 
                        if (ma.inner != null && ma.inner.value_type is EnumValueType && ((EnumValueType) 
ma.inner.value_type).get_to_string_method() == m) {
                                // Enum.VALUE.to_string()
-                               var en = (Enum) ma.inner.value_type.data_type;
+                               unowned Enum en = (Enum) ma.inner.value_type.type_symbol;
                                ccall.call = new CCodeIdentifier (generate_enum_to_string_function (en));
-                       } else if (context.profile == Profile.POSIX && ma.inner != null && 
ma.inner.value_type != null && ma.inner.value_type.data_type == string_type.data_type && ma.member_name == 
"printf") {
+                       } else if (context.profile == Profile.POSIX && ma.inner != null && 
ma.inner.value_type != null && ma.inner.value_type.type_symbol == string_type.type_symbol && ma.member_name 
== "printf") {
                                ccall.call = new CCodeIdentifier (generate_string_printf_function ());
                        } else if (expr.is_constructv_chainup) {
                                ccall.call = new CCodeIdentifier (get_ccode_constructv_name ((CreationMethod) 
m));
@@ -146,11 +146,11 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                if (current_class != m.parent_symbol) {
                                        // chain up to base class
                                        foreach (DataType base_type in current_class.get_base_types ()) {
-                                               if (base_type.data_type is Class) {
+                                               if (base_type.type_symbol is Class) {
                                                        List<TypeParameter> type_parameters = null;
                                                        if (get_ccode_real_name (m) == "g_object_new") {
                                                                // gobject-style chainup
-                                                               type_parameters = ((Class) 
base_type.data_type).get_type_parameters ();
+                                                               type_parameters = ((Class) 
base_type.type_symbol).get_type_parameters ();
                                                        }
                                                        add_generic_type_arguments (in_arg_map, 
base_type.get_type_arguments (), expr, true, type_parameters);
                                                        break;
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 354e1839f..8534f662a 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -279,7 +279,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 
                        // register base types first
                        foreach (var base_type in cl.get_base_types ()) {
-                               register_plugin_type ((ObjectTypeSymbol) base_type.data_type, 
registered_types);
+                               register_plugin_type ((ObjectTypeSymbol) base_type.type_symbol, 
registered_types);
                        }
                }
 
@@ -559,7 +559,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        }
 
                                        if (param.direction != ParameterDirection.OUT) {
-                                               var t = param.variable_type.data_type;
+                                               unowned TypeSymbol? t = param.variable_type.type_symbol;
                                                if (t != null && (t.is_reference_type () || 
param.variable_type.is_real_struct_type ())) {
                                                        var cname = get_ccode_name (param);
                                                        if (param.direction == ParameterDirection.REF && 
!param.variable_type.is_real_struct_type ()) {
@@ -889,8 +889,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        generate_type_declaration (param.variable_type, decl_space);
 
                        // pass non-simple structs always by reference
-                       if (param.variable_type.data_type is Struct) {
-                               var st = (Struct) param.variable_type.data_type;
+                       unowned Struct? st = param.variable_type.type_symbol as Struct;
+                       if (st != null) {
                                if (!st.is_simple_type () && param.direction == ParameterDirection.IN) {
                                        if (st.is_immutable && !param.variable_type.value_owned) {
                                                ctypename = "const " + ctypename;
@@ -1100,7 +1100,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 
                push_function (vfunc);
 
-               if (context.assert && m.return_type.data_type is Struct && ((Struct) 
m.return_type.data_type).is_simple_type () && default_value_for_type (m.return_type, false) == null) {
+               if (context.assert && m.return_type.type_symbol is Struct && ((Struct) 
m.return_type.type_symbol).is_simple_type () && default_value_for_type (m.return_type, false) == null) {
                        // the type check will use the result variable
                        var vardecl = new CCodeVariableDeclarator ("result", default_value_for_type 
(m.return_type, true));
                        vardecl.init0 = true;
diff --git a/codegen/valaclassregisterfunction.vala b/codegen/valaclassregisterfunction.vala
index b4906d5de..c3d0d57e3 100644
--- a/codegen/valaclassregisterfunction.vala
+++ b/codegen/valaclassregisterfunction.vala
@@ -153,11 +153,11 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
                var frag = new CCodeFragment ();
 
                foreach (DataType base_type in class_reference.get_base_types ()) {
-                       if (!(base_type.data_type is Interface)) {
+                       if (!(base_type.type_symbol is Interface)) {
                                continue;
                        }
 
-                       var iface = (Interface) base_type.data_type;
+                       unowned Interface iface = (Interface) base_type.type_symbol;
 
                        var iface_info_name = "%s_info".printf (get_ccode_lower_case_name (iface, null));
 
@@ -172,11 +172,11 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
 
        public override void get_type_interface_init_statements (CodeContext context, CCodeBlock block, bool 
plugin) {
                foreach (DataType base_type in class_reference.get_base_types ()) {
-                       if (!(base_type.data_type is Interface)) {
+                       if (!(base_type.type_symbol is Interface)) {
                                continue;
                        }
 
-                       var iface = (Interface) base_type.data_type;
+                       unowned Interface iface = (Interface) base_type.type_symbol;
 
                        var iface_info_name = "%s_info".printf (get_ccode_lower_case_name (iface, null));
                        if (!plugin) {
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 68a13dd29..cb7c28b63 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -223,7 +223,7 @@ public class Vala.GAsyncModule : GtkModule {
                Parameter cancellable_param = null;
 
                foreach (Parameter param in m.get_parameters ()) {
-                       if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name 
() == "GLib.Cancellable") {
+                       if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                cancellable_param = param;
                                break;
                        }
@@ -558,7 +558,7 @@ public class Vala.GAsyncModule : GtkModule {
                bool has_cancellable = false;
 
                foreach (Parameter param in m.get_parameters ()) {
-                       if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name 
() == "GLib.Cancellable") {
+                       if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                has_cancellable = true;
                                break;
                        }
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 5303975ea..3e79a3f3e 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -54,7 +54,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                push_function (func);
 
-               if (dynamic_method.dynamic_type.data_type == dbus_proxy_type) {
+               if (dynamic_method.dynamic_type.type_symbol == dbus_proxy_type) {
                        generate_marshalling (method, CallType.SYNC, null, method.name, -1);
                } else {
                        Report.error (method.source_reference, "dynamic methods are not supported for 
`%s'".printf (dynamic_method.dynamic_type.to_string ()));
@@ -69,8 +69,8 @@ public class Vala.GDBusClientModule : GDBusModule {
        void generate_proxy_interface_init (Interface main_iface, Interface iface) {
                // also generate proxy for prerequisites
                foreach (var prereq in iface.get_prerequisites ()) {
-                       if (prereq.data_type is Interface) {
-                               generate_proxy_interface_init (main_iface, (Interface) prereq.data_type);
+                       if (prereq.type_symbol is Interface) {
+                               generate_proxy_interface_init (main_iface, (Interface) prereq.type_symbol);
                        }
                }
 
@@ -122,8 +122,8 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                // also implement prerequisites
                foreach (var prereq in iface.get_prerequisites ()) {
-                       if (prereq.data_type is Interface) {
-                               result += implement_interface (define_type, main_iface, (Interface) 
prereq.data_type);
+                       if (prereq.type_symbol is Interface) {
+                               result += implement_interface (define_type, main_iface, (Interface) 
prereq.type_symbol);
                        }
                }
 
@@ -463,7 +463,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                        ccode.add_declaration (get_ccode_name (owned_type), new CCodeVariableDeclarator.zero 
(param_name, default_value_for_type (param.variable_type, true)));
 
-                       var st = param.variable_type.data_type as Struct;
+                       unowned Struct? st = param.variable_type.type_symbol as Struct;
                        if (st != null && !st.is_simple_type ()) {
                                ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier (param_name)));
                        } else {
@@ -639,12 +639,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                                                expr = new CCodeUnaryExpression 
(CCodeUnaryOperator.POINTER_INDIRECTION, expr);
                                        }
 
-                                       if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+                                       if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                                cancellable = expr;
                                                continue;
                                        }
 
-                                       if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                       if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.BusName") {
                                                // ignore BusName sender parameters
                                                continue;
                                        }
diff --git a/codegen/valagdbusmodule.vala b/codegen/valagdbusmodule.vala
index 1ab82b24e..9306f0347 100644
--- a/codegen/valagdbusmodule.vala
+++ b/codegen/valagdbusmodule.vala
@@ -100,7 +100,7 @@ public class Vala.GDBusModule : GVariantModule {
 
                string quark_fun_name = get_ccode_lower_case_prefix (edomain) + "quark";
 
-               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.data_type));
+               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.type_symbol));
                push_function (cquark_fun);
 
                string quark_name = "%squark_volatile".printf (get_ccode_lower_case_prefix (edomain));
@@ -124,10 +124,10 @@ public class Vala.GDBusModule : GVariantModule {
 
        bool is_file_descriptor (DataType type) {
                if (type is ObjectType) {
-                       if (type.data_type.get_full_name () == "GLib.UnixInputStream" ||
-                           type.data_type.get_full_name () == "GLib.UnixOutputStream" ||
-                           type.data_type.get_full_name () == "GLib.Socket" ||
-                           type.data_type.get_full_name () == "GLib.FileDescriptorBased") {
+                       if (type.type_symbol.get_full_name () == "GLib.UnixInputStream" ||
+                           type.type_symbol.get_full_name () == "GLib.UnixOutputStream" ||
+                           type.type_symbol.get_full_name () == "GLib.Socket" ||
+                           type.type_symbol.get_full_name () == "GLib.FileDescriptorBased") {
                                return true;
                        }
                }
@@ -151,19 +151,19 @@ public class Vala.GDBusModule : GVariantModule {
 
        CCodeExpression? get_file_descriptor (DataType type, CCodeExpression expr) {
                if (type is ObjectType) {
-                       if (type.data_type.get_full_name () == "GLib.UnixInputStream") {
+                       if (type.type_symbol.get_full_name () == "GLib.UnixInputStream") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_unix_input_stream_get_fd"));
                                result.add_argument (expr);
                                return result;
-                       } else if (type.data_type.get_full_name () == "GLib.UnixOutputStream") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.UnixOutputStream") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_unix_output_stream_get_fd"));
                                result.add_argument (expr);
                                return result;
-                       } else if (type.data_type.get_full_name () == "GLib.Socket") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.Socket") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier ("g_socket_get_fd"));
                                result.add_argument (expr);
                                return result;
-                       } else if (type.data_type.get_full_name () == "GLib.FileDescriptorBased") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.FileDescriptorBased") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_file_descriptor_based_get_fd"));
                                result.add_argument (expr);
                                return result;
@@ -195,17 +195,17 @@ public class Vala.GDBusModule : GVariantModule {
 
        CCodeExpression? create_from_file_descriptor (DataType type, CCodeExpression expr) {
                if (type is ObjectType) {
-                       if (type.data_type.get_full_name () == "GLib.UnixInputStream") {
+                       if (type.type_symbol.get_full_name () == "GLib.UnixInputStream") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_unix_input_stream_new"));
                                result.add_argument (expr);
                                result.add_argument (new CCodeConstant ("TRUE"));
                                return new CCodeCastExpression (result, "GUnixInputStream *");
-                       } else if (type.data_type.get_full_name () == "GLib.UnixOutputStream") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.UnixOutputStream") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_unix_output_stream_new"));
                                result.add_argument (expr);
                                result.add_argument (new CCodeConstant ("TRUE"));
                                return new CCodeCastExpression (result, "GUnixOutputStream *");
-                       } else if (type.data_type.get_full_name () == "GLib.Socket") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.Socket") {
                                var result = new CCodeFunctionCall (new CCodeIdentifier 
("g_socket_new_from_fd"));
                                result.add_argument (expr);
                                result.add_argument (new CCodeConstant ("NULL"));
@@ -276,10 +276,10 @@ public class Vala.GDBusModule : GVariantModule {
                        var out_args_info = new CCodeInitializerList ();
 
                        foreach (Parameter param in m.get_parameters ()) {
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                        continue;
                                }
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.BusName") {
                                        continue;
                                }
 
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index 01fbef616..6eca1d14a 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -123,11 +123,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        continue;
                                }
 
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                        continue;
                                }
 
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.BusName") {
                                        // ignore BusName sender parameters
                                        continue;
                                }
@@ -208,12 +208,12 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        }
 
                        if (param.direction == ParameterDirection.IN && !ready) {
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                        ccall.add_argument (new CCodeConstant ("NULL"));
                                        continue;
                                }
 
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.BusName") {
                                        // ignore BusName sender parameters
                                        var sender = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_sender"));
                                        sender.add_argument (new CCodeIdentifier ("invocation"));
@@ -221,7 +221,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        continue;
                                }
 
-                               var st = param.variable_type.data_type as Struct;
+                               unowned Struct? st = param.variable_type.type_symbol as Struct;
                                if (st != null && !st.is_simple_type ()) {
                                        ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, param_expr));
                                } else {
@@ -435,11 +435,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                foreach (Parameter param in m.get_parameters ()) {
                        if ((param.direction == ParameterDirection.IN && (ready_data_expr == null || ready)) 
||
                            (param.direction == ParameterDirection.OUT && !no_reply && (!m.coroutine || 
ready))) {
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.Cancellable") {
                                        continue;
                                }
 
-                               if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                               if (param.variable_type is ObjectType && 
param.variable_type.type_symbol.get_full_name () == "GLib.BusName") {
                                        // ignore BusName sender parameters
                                        continue;
                                }
@@ -637,7 +637,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                ccode.add_declaration (get_ccode_name (owned_type), new CCodeVariableDeclarator.zero 
("value", default_value_for_type (prop.property_type, true)));
 
-               var st = prop.property_type.data_type as Struct;
+               unowned Struct? st = prop.property_type.type_symbol as Struct;
                if (st != null && !st.is_simple_type ()) {
                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("value")));
                } else {
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index c64b410d5..d7bbf0c71 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -53,7 +53,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                var error_domain_define = new CCodeMacroReplacement (get_ccode_upper_case_name (edomain), 
quark_fun_name + " ()");
                decl_space.add_type_definition (error_domain_define);
 
-               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.data_type));
+               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.type_symbol));
 
                decl_space.add_function_declaration (cquark_fun);
        }
@@ -76,7 +76,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
                string quark_fun_name = get_ccode_lower_case_prefix (edomain) + "quark";
 
-               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.data_type));
+               var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.type_symbol));
                push_function (cquark_fun);
 
                var cquark_call = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_static_string"));
@@ -227,7 +227,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                                                        /* catch clause specifies a specific error code */
                                                        var error_match = new CCodeFunctionCall (new 
CCodeIdentifier ("g_error_matches"));
                                                        error_match.add_argument (get_inner_error_cexpression 
());
-                                                       error_match.add_argument (new CCodeIdentifier 
(get_ccode_upper_case_name (catch_type.data_type)));
+                                                       error_match.add_argument (new CCodeIdentifier 
(get_ccode_upper_case_name (catch_type.type_symbol)));
                                                        error_match.add_argument (new CCodeIdentifier 
(get_ccode_name (catch_type.error_code)));
 
                                                        ccode.open_if (error_match);
@@ -235,7 +235,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                                                        /* catch clause specifies a full error domain */
                                                        var ccond = new CCodeBinaryExpression 
(CCodeBinaryOperator.EQUALITY,
                                                                        new CCodeMemberAccess.pointer 
(get_inner_error_cexpression (), "domain"), new CCodeIdentifier
-                                                                       (get_ccode_upper_case_name 
(clause.error_type.data_type)));
+                                                                       (get_ccode_upper_case_name 
(clause.error_type.type_symbol)));
 
                                                        ccode.open_if (ccond);
                                                }
@@ -277,7 +277,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
                                // Check the allowed error domains to propagate
                                var domain_check = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, 
new CCodeMemberAccess.pointer
-                                       (get_inner_error_cexpression (), "domain"), new CCodeIdentifier 
(get_ccode_upper_case_name (error_type.data_type)));
+                                       (get_inner_error_cexpression (), "domain"), new CCodeIdentifier 
(get_ccode_upper_case_name (error_type.type_symbol)));
                                if (ccond == null) {
                                        ccond = domain_check;
                                } else {
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 3406f8ee6..e92ab1514 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1448,7 +1448,7 @@ public class Vala.GIRWriter : CodeVisitor {
                unowned DelegateType? delegate_type = type as DelegateType;
                unowned ArrayType? array_type = type as ArrayType;
 
-               if (type != null && ((type.value_owned && delegate_type == null) || (constructor && 
!type.data_type.is_subtype_of (ginitiallyunowned_type)))) {
+               if (type != null && ((type.value_owned && delegate_type == null) || (constructor && 
!type.type_symbol.is_subtype_of (ginitiallyunowned_type)))) {
                        var any_owned = false;
                        foreach (var generic_arg in type.get_type_arguments ()) {
                                any_owned |= generic_arg.value_owned;
@@ -1544,14 +1544,14 @@ public class Vala.GIRWriter : CodeVisitor {
                } else if (type is PointerType) {
                        write_indent ();
                        buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s%s\"/>\n", get_ccode_name 
(type), direction == ParameterDirection.IN ? "" : "*");
-               } else if (type.data_type != null) {
+               } else if (type.type_symbol != null) {
                        write_indent ();
-                       string type_name = gi_type_name (type.data_type);
+                       string type_name = gi_type_name (type.type_symbol);
                        bool is_array = false;
                        if ((type_name == "GLib.Array") || (type_name == "GLib.PtrArray")) {
                                is_array = true;
                        }
-                       buffer.append_printf ("<%s name=\"%s\" c:type=\"%s%s\"", is_array ? "array" : "type", 
gi_type_name (type.data_type), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
+                       buffer.append_printf ("<%s name=\"%s\" c:type=\"%s%s\"", is_array ? "array" : "type", 
gi_type_name (type.type_symbol), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
 
                        List<DataType> type_arguments = type.get_type_arguments ();
                        if (type_arguments.size == 0) {
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index 8c31c924f..a54242882 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -263,7 +263,7 @@ public class Vala.GObjectModule : GTypeModule {
                                ccall = new CCodeFunctionCall (cfunc);
                                ccall.add_argument (cself);
                                var array_type = prop.property_type as ArrayType;
-                               if (array_type != null && array_type.element_type.data_type == 
string_type.data_type) {
+                               if (array_type != null && array_type.element_type.type_symbol == 
string_type.type_symbol) {
                                        // G_TYPE_STRV
                                        ccode.open_block ();
                                        ccode.add_declaration ("int", new CCodeVariableDeclarator ("length"));
@@ -278,7 +278,7 @@ public class Vala.GObjectModule : GTypeModule {
                                csetcall.add_argument (new CCodeIdentifier ("value"));
                                csetcall.add_argument (ccall);
                                add_guarded_expression (prop, csetcall);
-                               if (array_type != null && array_type.element_type.data_type == 
string_type.data_type) {
+                               if (array_type != null && array_type.element_type.type_symbol == 
string_type.type_symbol) {
                                        ccode.close ();
                                }
                        }
@@ -346,7 +346,7 @@ public class Vala.GObjectModule : GTypeModule {
                        ccode.add_case (new CCodeIdentifier ("%s_PROPERTY".printf (get_ccode_upper_case_name 
(prop))));
                        ccall = new CCodeFunctionCall (cfunc);
                        ccall.add_argument (cself);
-                       if (prop.property_type is ArrayType && 
((ArrayType)prop.property_type).element_type.data_type == string_type.data_type) {
+                       if (prop.property_type is ArrayType && 
((ArrayType)prop.property_type).element_type.type_symbol == string_type.type_symbol) {
                                ccode.open_block ();
                                ccode.add_declaration ("gpointer", new CCodeVariableDeclarator ("boxed"));
 
@@ -365,8 +365,8 @@ public class Vala.GObjectModule : GTypeModule {
                                ccode.close ();
                        } else {
                                var cgetcall = new CCodeFunctionCall ();
-                               if (prop.property_type.data_type != null) {
-                                       cgetcall.call = new CCodeIdentifier (get_ccode_get_value_function 
(prop.property_type.data_type));
+                               if (prop.property_type.type_symbol != null) {
+                                       cgetcall.call = new CCodeIdentifier (get_ccode_get_value_function 
(prop.property_type.type_symbol));
                                } else {
                                        cgetcall.call = new CCodeIdentifier ("g_value_get_pointer");
                                }
@@ -614,8 +614,8 @@ public class Vala.GObjectModule : GTypeModule {
        }
 
        public override string get_dynamic_property_getter_cname (DynamicProperty prop) {
-               if (prop.dynamic_type.data_type == null
-                   || !prop.dynamic_type.data_type.is_subtype_of (gobject_type)) {
+               if (prop.dynamic_type.type_symbol == null
+                   || !prop.dynamic_type.type_symbol.is_subtype_of (gobject_type)) {
                        return base.get_dynamic_property_getter_cname (prop);
                }
 
@@ -650,8 +650,8 @@ public class Vala.GObjectModule : GTypeModule {
        }
 
        public override string get_dynamic_property_setter_cname (DynamicProperty prop) {
-               if (prop.dynamic_type.data_type == null
-                   || !prop.dynamic_type.data_type.is_subtype_of (gobject_type)) {
+               if (prop.dynamic_type.type_symbol == null
+                   || !prop.dynamic_type.type_symbol.is_subtype_of (gobject_type)) {
                        return base.get_dynamic_property_setter_cname (prop);
                }
 
@@ -686,8 +686,8 @@ public class Vala.GObjectModule : GTypeModule {
        }
 
        public override string get_dynamic_signal_connect_wrapper_name (DynamicSignal sig) {
-               if (sig.dynamic_type.data_type == null
-                   || !sig.dynamic_type.data_type.is_subtype_of (gobject_type)) {
+               if (sig.dynamic_type.type_symbol == null
+                   || !sig.dynamic_type.type_symbol.is_subtype_of (gobject_type)) {
                        return base.get_dynamic_signal_connect_wrapper_name (sig);
                }
 
@@ -709,8 +709,8 @@ public class Vala.GObjectModule : GTypeModule {
        }
 
        public override string get_dynamic_signal_connect_after_wrapper_name (DynamicSignal sig) {
-               if (sig.dynamic_type.data_type == null
-                   || !sig.dynamic_type.data_type.is_subtype_of (gobject_type)) {
+               if (sig.dynamic_type.type_symbol == null
+                   || !sig.dynamic_type.type_symbol.is_subtype_of (gobject_type)) {
                        return base.get_dynamic_signal_connect_wrapper_name (sig);
                }
 
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index f87a4e0dc..eda9f4bb5 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -56,19 +56,19 @@ public class Vala.GSignalModule : GObjectModule {
                        return "void";
                } else if (get_ccode_type_id (t) == get_ccode_type_id (string_type)) {
                        return "const char*";
-               } else if (t.data_type is Class || t.data_type is Interface) {
+               } else if (t.type_symbol is Class || t.type_symbol is Interface) {
                        return "gpointer";
                } else if (t is ValueType && t.nullable) {
                        return "gpointer";
-               } else if (t.data_type is Struct) {
-                       var st = (Struct) t.data_type;
+               } else if (t.type_symbol is Struct) {
+                       unowned Struct st = (Struct) t.type_symbol;
                        if (st.is_simple_type ()) {
-                               return get_ccode_name (t.data_type);
+                               return get_ccode_name (t.type_symbol);
                        } else {
                                return "gpointer";
                        }
-               } else if (t.data_type is Enum) {
-                       var en = (Enum) t.data_type;
+               } else if (t.type_symbol is Enum) {
+                       unowned Enum en = (Enum) t.type_symbol;
                        if (en.is_flags) {
                                return "guint";
                        } else {
@@ -230,7 +230,7 @@ public class Vala.GSignalModule : GObjectModule {
 
                CCodeFunctionCall fc;
 
-               if (return_type.data_type != null || return_type is ArrayType) {
+               if (return_type.type_symbol != null || return_type is ArrayType) {
                        ccode.add_declaration (get_value_type_name_from_type_reference (return_type), new 
CCodeVariableDeclarator ("v_return"));
 
                        fc = new CCodeFunctionCall (new CCodeIdentifier ("g_return_if_fail"));
@@ -265,7 +265,7 @@ public class Vala.GSignalModule : GObjectModule {
                        if (p.direction != ParameterDirection.IN) {
                                get_value_function = "g_value_get_pointer";
                        } else if (p.variable_type is ArrayType) {
-                               if (((ArrayType) p.variable_type).element_type.data_type == 
string_type.data_type) {
+                               if (((ArrayType) p.variable_type).element_type.type_symbol == 
string_type.type_symbol) {
                                        get_value_function = "g_value_get_boxed";
                                } else {
                                        get_value_function = "g_value_get_pointer";
@@ -279,7 +279,7 @@ public class Vala.GSignalModule : GObjectModule {
                        } else if (p.variable_type is ValueType && p.variable_type.nullable) {
                                get_value_function = "g_value_get_pointer";
                        } else {
-                               get_value_function = get_ccode_get_value_function (p.variable_type.data_type);
+                               get_value_function = get_ccode_get_value_function 
(p.variable_type.type_symbol);
                        }
                        var inner_fc = new CCodeFunctionCall (new CCodeIdentifier (get_value_function));
                        inner_fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new 
CCodeIdentifier ("param_values"), new CCodeIdentifier (i.to_string ())));
@@ -287,7 +287,7 @@ public class Vala.GSignalModule : GObjectModule {
                        i++;
                        if (p.variable_type is ArrayType) {
                                var array_type = (ArrayType) p.variable_type;
-                               var length_value_function = get_ccode_get_value_function 
(array_type.length_type.data_type);
+                               var length_value_function = get_ccode_get_value_function 
(array_type.length_type.type_symbol);
                                assert (length_value_function != null && length_value_function != "");
                                for (var j = 0; j < array_type.rank; j++) {
                                        inner_fc = new CCodeFunctionCall (new CCodeIdentifier 
(length_value_function));
@@ -313,12 +313,12 @@ public class Vala.GSignalModule : GObjectModule {
                }
                fc.add_argument (new CCodeIdentifier ("data2"));
 
-               if (return_type.data_type != null || return_type is ArrayType) {
+               if (return_type.type_symbol != null || return_type is ArrayType) {
                        ccode.add_assignment (new CCodeIdentifier ("v_return"), fc);
 
                        CCodeFunctionCall set_fc;
                        if (return_type is ArrayType) {
-                               if (((ArrayType) return_type).element_type.data_type == 
string_type.data_type) {
+                               if (((ArrayType) return_type).element_type.type_symbol == 
string_type.type_symbol) {
                                        set_fc = new CCodeFunctionCall (new CCodeIdentifier 
("g_value_take_boxed"));
                                } else {
                                        set_fc = new CCodeFunctionCall (new CCodeIdentifier 
("g_value_set_pointer"));
@@ -327,14 +327,14 @@ public class Vala.GSignalModule : GObjectModule {
                                set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
                        } else if (return_type is ErrorType) {
                                set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
-                       } else if (return_type.data_type == string_type.data_type) {
+                       } else if (return_type.type_symbol == string_type.type_symbol) {
                                set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_string"));
-                       } else if (return_type.data_type is Class || return_type.data_type is Interface) {
+                       } else if (return_type.type_symbol is Class || return_type.type_symbol is Interface) {
                                set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_object"));
                        } else if (return_type is ValueType && return_type.nullable) {
                                set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
                        } else {
-                               set_fc = new CCodeFunctionCall (new CCodeIdentifier 
(get_ccode_set_value_function (return_type.data_type)));
+                               set_fc = new CCodeFunctionCall (new CCodeIdentifier 
(get_ccode_set_value_function (return_type.type_symbol)));
                        }
                        set_fc.add_argument (new CCodeIdentifier ("return_value"));
                        set_fc.add_argument (new CCodeIdentifier ("v_return"));
@@ -414,10 +414,10 @@ public class Vala.GSignalModule : GObjectModule {
                        csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
                } else if (sig.return_type is ValueType && sig.return_type.nullable) {
                        csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-               } else if (sig.return_type.data_type == null) {
+               } else if (sig.return_type.type_symbol == null) {
                        csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
                } else {
-                       csignew.add_argument (new CCodeConstant (get_ccode_type_id 
(sig.return_type.data_type)));
+                       csignew.add_argument (new CCodeConstant (get_ccode_type_id 
(sig.return_type.type_symbol)));
                }
 
                int params_len = 0;
@@ -440,13 +440,13 @@ public class Vala.GSignalModule : GObjectModule {
                foreach (Parameter param in params) {
                        if (param.variable_type is ArrayType) {
                                var array_type = (ArrayType) param.variable_type;
-                               if (array_type.element_type.data_type == string_type.data_type) {
+                               if (array_type.element_type.type_symbol == string_type.type_symbol) {
                                        csignew.add_argument (new CCodeConstant ("G_TYPE_STRV"));
                                } else {
                                        csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
                                }
-                               assert (get_ccode_has_type_id (array_type.length_type.data_type));
-                               var length_type_id = get_ccode_type_id (array_type.length_type.data_type);
+                               assert (get_ccode_has_type_id (array_type.length_type.type_symbol));
+                               var length_type_id = get_ccode_type_id (array_type.length_type.type_symbol);
                                for (var i = 0; i < array_type.rank; i++) {
                                        csignew.add_argument (new CCodeConstant (length_type_id));
                                }
@@ -466,7 +466,7 @@ public class Vala.GSignalModule : GObjectModule {
                        } else if (param.variable_type is ValueType && param.variable_type.nullable) {
                                csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
                        } else {
-                               csignew.add_argument (new CCodeConstant (get_ccode_type_id 
(param.variable_type.data_type)));
+                               csignew.add_argument (new CCodeConstant (get_ccode_type_id 
(param.variable_type.type_symbol)));
                        }
                }
 
@@ -512,7 +512,7 @@ public class Vala.GSignalModule : GObjectModule {
        bool in_gobject_instance (Method m) {
                bool result = false;
                if (m.binding == MemberBinding.INSTANCE) {
-                       result = m.this_parameter.variable_type.data_type.is_subtype_of (gobject_type);
+                       result = m.this_parameter.variable_type.type_symbol.is_subtype_of (gobject_type);
                }
                return result;
        }
diff --git a/codegen/valagtkmodule.vala b/codegen/valagtkmodule.vala
index da0fe9905..2f3431653 100644
--- a/codegen/valagtkmodule.vala
+++ b/codegen/valagtkmodule.vala
@@ -286,7 +286,7 @@ public class Vala.GtkModule : GSignalModule {
                }
 
                /* We allow Gtk child to have stricter type than class field */
-               var field_class = f.variable_type.data_type as Class;
+               unowned Class? field_class = f.variable_type.type_symbol as Class;
                if (field_class == null || !child_class.is_subtype_of (field_class)) {
                        Report.error (f.source_reference, "cannot convert from Gtk child type `%s' to 
`%s'".printf (child_class.get_full_name(), field_class.get_full_name()));
                        return;
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index d3351aae1..56bf3188d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -218,7 +218,7 @@ public class Vala.GTypeModule : GErrorModule {
                        generate_class_struct_declaration (cl.base_class, decl_space);
                }
                foreach (DataType base_type in cl.get_base_types ()) {
-                       var iface = base_type.data_type as Interface;
+                       unowned Interface? iface = base_type.type_symbol as Interface;
                        if (iface != null) {
                                generate_interface_declaration (iface, decl_space);
                        }
@@ -735,8 +735,8 @@ public class Vala.GTypeModule : GErrorModule {
                        }
 
                        foreach (DataType base_type in cl.get_base_types ()) {
-                               if (base_type.data_type is Interface) {
-                                       add_interface_init_function (cl, (Interface) base_type.data_type);
+                               if (base_type.type_symbol is Interface) {
+                                       add_interface_init_function (cl, (Interface) base_type.type_symbol);
                                }
                        }
 
@@ -1870,19 +1870,19 @@ public class Vala.GTypeModule : GErrorModule {
                cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.blurb)));
 
 
-               if (prop.property_type.data_type is Class || prop.property_type.data_type is Interface) {
-                       string param_spec_name = get_ccode_param_spec_function (prop.property_type.data_type);
+               if (prop.property_type.type_symbol is Class || prop.property_type.type_symbol is Interface) {
+                       string param_spec_name = get_ccode_param_spec_function 
(prop.property_type.type_symbol);
                        cspec.call = new CCodeIdentifier (param_spec_name);
                        if (param_spec_name == "g_param_spec_string") {
                                cspec.add_argument (new CCodeConstant ("NULL"));
                        } else if (param_spec_name == "g_param_spec_variant") {
                                cspec.add_argument (new CCodeConstant ("G_VARIANT_TYPE_ANY"));
                                cspec.add_argument (new CCodeConstant ("NULL"));
-                       } else if (get_ccode_type_id (prop.property_type.data_type) != "G_TYPE_POINTER") {
-                               cspec.add_argument (new CCodeIdentifier (get_ccode_type_id 
(prop.property_type.data_type)));
+                       } else if (get_ccode_type_id (prop.property_type.type_symbol) != "G_TYPE_POINTER") {
+                               cspec.add_argument (new CCodeIdentifier (get_ccode_type_id 
(prop.property_type.type_symbol)));
                        }
-               } else if (prop.property_type.data_type is Enum) {
-                       var e = prop.property_type.data_type as Enum;
+               } else if (prop.property_type.type_symbol is Enum) {
+                       unowned Enum e = (Enum) prop.property_type.type_symbol;
                        if (get_ccode_has_type_id (e)) {
                                if (e.is_flags) {
                                        cspec.call = new CCodeIdentifier ("g_param_spec_flags");
@@ -1905,10 +1905,10 @@ public class Vala.GTypeModule : GErrorModule {
                        if (prop.initializer != null) {
                                cspec.add_argument ((CCodeExpression) get_ccodenode (prop.initializer));
                        } else {
-                               cspec.add_argument (new CCodeConstant (get_ccode_default_value 
(prop.property_type.data_type)));
+                               cspec.add_argument (new CCodeConstant (get_ccode_default_value 
(prop.property_type.type_symbol)));
                        }
-               } else if (prop.property_type.data_type is Struct) {
-                       var st = (Struct) prop.property_type.data_type;
+               } else if (prop.property_type.type_symbol is Struct) {
+                       unowned Struct st = (Struct) prop.property_type.type_symbol;
                        var type_id = get_ccode_type_id (st);
                        if (type_id == "G_TYPE_INT") {
                                cspec.call = new CCodeIdentifier ("g_param_spec_int");
@@ -2018,7 +2018,7 @@ public class Vala.GTypeModule : GErrorModule {
                                cspec.call = new CCodeIdentifier ("g_param_spec_boxed");
                                cspec.add_argument (new CCodeIdentifier (type_id));
                        }
-               } else if (prop.property_type is ArrayType && 
((ArrayType)prop.property_type).element_type.data_type == string_type.data_type) {
+               } else if (prop.property_type is ArrayType && 
((ArrayType)prop.property_type).element_type.type_symbol == string_type.type_symbol) {
                        cspec.call = new CCodeIdentifier ("g_param_spec_boxed");
                        cspec.add_argument (new CCodeIdentifier ("G_TYPE_STRV"));
                } else {
@@ -2081,8 +2081,8 @@ public class Vala.GTypeModule : GErrorModule {
                decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf 
(type_struct.name), new CCodeVariableDeclarator (get_ccode_type_name (iface))));
 
                foreach (DataType prerequisite in iface.get_prerequisites ()) {
-                       var prereq_cl = prerequisite.data_type as Class;
-                       var prereq_iface = prerequisite.data_type as Interface;
+                       unowned Class? prereq_cl = prerequisite.type_symbol as Class;
+                       unowned Interface? prereq_iface = prerequisite.type_symbol as Interface;
                        if (prereq_cl != null) {
                                generate_class_declaration (prereq_cl, decl_space);
                        } else if (prereq_iface != null) {
@@ -2362,7 +2362,7 @@ public class Vala.GTypeModule : GErrorModule {
                var ma = expr.call as MemberAccess;
                var mtype = expr.call.value_type as MethodType;
                if (mtype == null || ma == null || ma.inner == null ||
-                       !(ma.inner.value_type is EnumValueType) || !get_ccode_has_type_id 
(ma.inner.value_type.data_type) ||
+                       !(ma.inner.value_type is EnumValueType) || !get_ccode_has_type_id 
(ma.inner.value_type.type_symbol) ||
                        mtype.method_symbol != ((EnumValueType) ma.inner.value_type).get_to_string_method ()) 
{
                        base.visit_method_call (expr);
                        return;
@@ -2469,7 +2469,7 @@ public class Vala.GTypeModule : GErrorModule {
                        var cdefault = default_value_for_type (ret_type, false);
                        if (cdefault != null) {
                                ccheck.add_argument (cdefault);
-                       } else if (ret_type.data_type is Struct && !((Struct) 
ret_type.data_type).is_simple_type ()) {
+                       } else if (ret_type.type_symbol is Struct && !((Struct) 
ret_type.type_symbol).is_simple_type ()) {
                                ccheck.add_argument (new CCodeIdentifier ("result"));
                        } else {
                                return;
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index ddbab1b88..7e679f860 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -106,7 +106,7 @@ public class Vala.GVariantModule : GAsyncModule {
                var value = expr.inner.target_value;
                var target_type = expr.type_reference;
 
-               if (expr.is_non_null_cast || value.value_type == null || gvariant_type == null || 
value.value_type.data_type != gvariant_type) {
+               if (expr.is_non_null_cast || value.value_type == null || gvariant_type == null || 
value.value_type.type_symbol != gvariant_type) {
                        base.visit_cast_expression (expr);
                        return;
                }
@@ -478,10 +478,10 @@ public class Vala.GVariantModule : GAsyncModule {
                ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator (value_name));
 
                var hash_table_new = new CCodeFunctionCall (new CCodeIdentifier ("g_hash_table_new_full"));
-               if (key_type.data_type.is_subtype_of (string_type.data_type)) {
+               if (key_type.type_symbol.is_subtype_of (string_type.type_symbol)) {
                        hash_table_new.add_argument (new CCodeIdentifier ("g_str_hash"));
                        hash_table_new.add_argument (new CCodeIdentifier ("g_str_equal"));
-               } else if (key_type.data_type == gvariant_type) {
+               } else if (key_type.type_symbol == gvariant_type) {
                        hash_table_new.add_argument (new CCodeIdentifier ("g_variant_hash"));
                        hash_table_new.add_argument (new CCodeIdentifier ("g_variant_equal"));
                } else {
@@ -489,21 +489,21 @@ public class Vala.GVariantModule : GAsyncModule {
                        hash_table_new.add_argument (new CCodeIdentifier ("g_direct_equal"));
                }
 
-               if (key_type.data_type.is_subtype_of (string_type.data_type)) {
+               if (key_type.type_symbol.is_subtype_of (string_type.type_symbol)) {
                        hash_table_new.add_argument (new CCodeIdentifier ("g_free"));
-               } else if (key_type.data_type == gvariant_type) {
+               } else if (key_type.type_symbol == gvariant_type) {
                        hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier 
("g_variant_unref"), "GDestroyNotify"));
-               } else if (key_type.data_type.get_full_name () == "GLib.HashTable") {
+               } else if (key_type.type_symbol.get_full_name () == "GLib.HashTable") {
                        hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier 
("g_hash_table_unref"), "GDestroyNotify"));
                } else {
                        hash_table_new.add_argument (new CCodeIdentifier ("NULL"));
                }
 
-               if (value_type.data_type.is_subtype_of (string_type.data_type)) {
+               if (value_type.type_symbol.is_subtype_of (string_type.type_symbol)) {
                        hash_table_new.add_argument (new CCodeIdentifier ("g_free"));
-               } else if (value_type.data_type == gvariant_type) {
+               } else if (value_type.type_symbol == gvariant_type) {
                        hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier 
("g_variant_unref"), "GDestroyNotify"));
-               } else if (value_type.data_type.get_full_name () == "GLib.HashTable") {
+               } else if (value_type.type_symbol.get_full_name () == "GLib.HashTable") {
                        hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier 
("g_hash_table_unref"), "GDestroyNotify"));
                } else {
                        hash_table_new.add_argument (new CCodeIdentifier ("NULL"));
@@ -544,7 +544,7 @@ public class Vala.GVariantModule : GAsyncModule {
                BasicTypeInfo basic_type;
                CCodeExpression result = null;
                may_fail = false;
-               if (is_string_marshalled_enum (type.data_type)) {
+               if (is_string_marshalled_enum (type.type_symbol)) {
                        get_basic_type_info ("s", out basic_type);
                        result = deserialize_basic (basic_type, variant_expr, true);
                        result = generate_enum_value_from_string (type as EnumValueType, result, error_expr);
@@ -553,8 +553,8 @@ public class Vala.GVariantModule : GAsyncModule {
                        result = deserialize_basic (basic_type, variant_expr);
                } else if (type is ArrayType) {
                        result = deserialize_array ((ArrayType) type, variant_expr, expr);
-               } else if (type.data_type is Struct) {
-                       var st = (Struct) type.data_type;
+               } else if (type.type_symbol is Struct) {
+                       unowned Struct st = (Struct) type.type_symbol;
                        result = deserialize_struct (st, variant_expr);
                        if (result != null && type.nullable) {
                                var csizeof = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
@@ -565,11 +565,11 @@ public class Vala.GVariantModule : GAsyncModule {
                                result = cdup;
                        }
                } else if (type is ObjectType) {
-                       if (type.data_type.get_full_name () == "GLib.Variant") {
+                       if (type.type_symbol.get_full_name () == "GLib.Variant") {
                                var variant_get = new CCodeFunctionCall (new CCodeIdentifier 
("g_variant_get_variant"));
                                variant_get.add_argument (variant_expr);
                                result = variant_get;
-                       } else if (type.data_type.get_full_name () == "GLib.HashTable") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.HashTable") {
                                result = deserialize_hash_table ((ObjectType) type, variant_expr);
                        }
                }
@@ -842,7 +842,7 @@ public class Vala.GVariantModule : GAsyncModule {
        public override CCodeExpression? serialize_expression (DataType type, CCodeExpression expr) {
                BasicTypeInfo basic_type;
                CCodeExpression result = null;
-               if (is_string_marshalled_enum (type.data_type)) {
+               if (is_string_marshalled_enum (type.type_symbol)) {
                        get_basic_type_info ("s", out basic_type);
                        result = generate_enum_value_to_string (type as EnumValueType, expr);
                        result = serialize_basic (basic_type, result);
@@ -850,18 +850,18 @@ public class Vala.GVariantModule : GAsyncModule {
                        result = serialize_basic (basic_type, expr);
                } else if (type is ArrayType) {
                        result = serialize_array ((ArrayType) type, expr);
-               } else if (type.data_type is Struct) {
+               } else if (type.type_symbol is Struct) {
                        var st_expr = expr;
                        if (type.nullable) {
                                st_expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, 
st_expr);
                        }
-                       result = serialize_struct ((Struct) type.data_type, st_expr);
+                       result = serialize_struct ((Struct) type.type_symbol, st_expr);
                } else if (type is ObjectType) {
-                       if (type.data_type.get_full_name () == "GLib.Variant") {
+                       if (type.type_symbol.get_full_name () == "GLib.Variant") {
                                var variant_new = new CCodeFunctionCall (new CCodeIdentifier 
("g_variant_new_variant"));
                                variant_new.add_argument (expr);
                                result = variant_new;
-                       } else if (type.data_type.get_full_name () == "GLib.HashTable") {
+                       } else if (type.type_symbol.get_full_name () == "GLib.HashTable") {
                                result = serialize_hash_table ((ObjectType) type, expr);
                        }
                }
diff --git a/codegen/valainterfaceregisterfunction.vala b/codegen/valainterfaceregisterfunction.vala
index 9990175e9..3a35f995c 100644
--- a/codegen/valainterfaceregisterfunction.vala
+++ b/codegen/valainterfaceregisterfunction.vala
@@ -80,7 +80,7 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
        public override void get_type_interface_init_statements (CodeContext context, CCodeBlock block, bool 
plugin) {
                /* register all prerequisites */
                foreach (DataType prereq_ref in interface_reference.get_prerequisites ()) {
-                       var prereq = prereq_ref.data_type;
+                       unowned TypeSymbol prereq = prereq_ref.type_symbol;
 
                        var func = new CCodeFunctionCall (new CCodeIdentifier 
("g_type_interface_add_prerequisite"));
                        func.add_argument (new CCodeIdentifier ("%s_type_id".printf 
(get_ccode_lower_case_name (interface_reference))));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]