diff options
author | Juerg Billeter <j@bitron.ch> | 2007-12-02 10:34:33 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2007-12-02 10:34:33 +0000 |
commit | 0de3b4a6c1d02a864fc9cbc8ed11b2eb7a4326db (patch) | |
tree | 7d403120023f19c8e2f49cbec3d38a7488e4ae38 | |
parent | 160d75b8e40911b86fa2383116454f4efaa5096c (diff) | |
download | vala-0de3b4a6c1d02a864fc9cbc8ed11b2eb7a4326db.tar.gz |
rename TypeReference to DataType
2007-12-02 Juerg Billeter <j@bitron.ch>
* vala/valadatatype.vala, vala/Makefile.am: rename TypeReference to
DataType
* vala/parser.y, vala/vala.h, vala/*.vala, gobject/*.vala,
vapigen/valagidlparser.vala: adapt after renaming
svn path=/trunk/; revision=746
49 files changed, 371 insertions, 362 deletions
@@ -1,5 +1,13 @@ 2007-12-02 Jürg Billeter <j@bitron.ch> + * vala/valadatatype.vala, vala/Makefile.am: rename TypeReference to + DataType + + * vala/parser.y, vala/vala.h, vala/*.vala, gobject/*.vala, + vapigen/valagidlparser.vala: adapt after renaming + +2007-12-02 Jürg Billeter <j@bitron.ch> + * vala/valatypesymbol.vala, vala/Makefile.am: rename DataType to Typesymbol diff --git a/gobject/valaccodegenerator.vala b/gobject/valaccodegenerator.vala index 674318e8a..ef29c5e33 100644 --- a/gobject/valaccodegenerator.vala +++ b/gobject/valaccodegenerator.vala @@ -40,7 +40,7 @@ public class Vala.CCodeGenerator : CodeGenerator { public Symbol current_type_symbol; Class current_class; Method current_method; - TypeReference current_return_type; + DataType current_return_type; TryStatement current_try; CCodeFragment header_begin; @@ -83,20 +83,20 @@ public class Vala.CCodeGenerator : CodeGenerator { public bool in_creation_method = false; private bool current_method_inner_error = false; - public TypeReference bool_type; - public TypeReference char_type; - public TypeReference unichar_type; - public TypeReference short_type; - public TypeReference ushort_type; - public TypeReference int_type; - public TypeReference uint_type; - public TypeReference long_type; - public TypeReference ulong_type; - public TypeReference int64_type; - public TypeReference uint64_type; - public TypeReference string_type; - public TypeReference float_type; - public TypeReference double_type; + public DataType bool_type; + public DataType char_type; + public DataType unichar_type; + public DataType short_type; + public DataType ushort_type; + public DataType int_type; + public DataType uint_type; + public DataType long_type; + public DataType ulong_type; + public DataType int64_type; + public DataType uint64_type; + public DataType string_type; + public DataType float_type; + public DataType double_type; public Typesymbol gtypeinstance_type; public Typesymbol gobject_type; public Typesymbol gerror_type; @@ -104,8 +104,8 @@ public class Vala.CCodeGenerator : CodeGenerator { public Typesymbol gslist_type; public Typesymbol gstring_type; public Typesymbol garray_type; - public TypeReference gquark_type; - public TypeReference mutex_type; + public DataType gquark_type; + public DataType mutex_type; public Typesymbol type_module_type; public Typesymbol iterable_type; public Typesymbol iterator_type; @@ -200,46 +200,46 @@ public class Vala.CCodeGenerator : CodeGenerator { root_symbol = context.root; - bool_type = new TypeReference (); + bool_type = new DataType (); bool_type.data_type = (Typesymbol) root_symbol.scope.lookup ("bool"); - char_type = new TypeReference (); + char_type = new DataType (); char_type.data_type = (Typesymbol) root_symbol.scope.lookup ("char"); - unichar_type = new TypeReference (); + unichar_type = new DataType (); unichar_type.data_type = (Typesymbol) root_symbol.scope.lookup ("unichar"); - short_type = new TypeReference (); + short_type = new DataType (); short_type.data_type = (Typesymbol) root_symbol.scope.lookup ("short"); - ushort_type = new TypeReference (); + ushort_type = new DataType (); ushort_type.data_type = (Typesymbol) root_symbol.scope.lookup ("ushort"); - int_type = new TypeReference (); + int_type = new DataType (); int_type.data_type = (Typesymbol) root_symbol.scope.lookup ("int"); - uint_type = new TypeReference (); + uint_type = new DataType (); uint_type.data_type = (Typesymbol) root_symbol.scope.lookup ("uint"); - long_type = new TypeReference (); + long_type = new DataType (); long_type.data_type = (Typesymbol) root_symbol.scope.lookup ("long"); - ulong_type = new TypeReference (); + ulong_type = new DataType (); ulong_type.data_type = (Typesymbol) root_symbol.scope.lookup ("ulong"); - int64_type = new TypeReference (); + int64_type = new DataType (); int64_type.data_type = (Typesymbol) root_symbol.scope.lookup ("int64"); - uint64_type = new TypeReference (); + uint64_type = new DataType (); uint64_type.data_type = (Typesymbol) root_symbol.scope.lookup ("uint64"); - float_type = new TypeReference (); + float_type = new DataType (); float_type.data_type = (Typesymbol) root_symbol.scope.lookup ("float"); - double_type = new TypeReference (); + double_type = new DataType (); double_type.data_type = (Typesymbol) root_symbol.scope.lookup ("double"); - string_type = new TypeReference (); + string_type = new DataType (); string_type.data_type = (Typesymbol) root_symbol.scope.lookup ("string"); substring_method = (Method) string_type.data_type.scope.lookup ("substring"); @@ -253,10 +253,10 @@ public class Vala.CCodeGenerator : CodeGenerator { gstring_type = (Typesymbol) glib_ns.scope.lookup ("String"); garray_type = (Typesymbol) glib_ns.scope.lookup ("Array"); - gquark_type = new TypeReference (); + gquark_type = new DataType (); gquark_type.data_type = (Typesymbol) glib_ns.scope.lookup ("Quark"); - mutex_type = new TypeReference (); + mutex_type = new DataType (); mutex_type.data_type = (Typesymbol) glib_ns.scope.lookup ("Mutex"); type_module_type = (Typesymbol) glib_ns.scope.lookup ("TypeModule"); @@ -466,7 +466,7 @@ public class Vala.CCodeGenerator : CodeGenerator { var arr = (Array) f.type_reference.data_type; for (int dim = 1; dim <= arr.rank; dim++) { - var len_type = new TypeReference (); + var len_type = new DataType (); len_type.data_type = int_type.data_type; st.add_field (len_type.get_cname (), get_array_length_cname (f.name, dim)); @@ -563,7 +563,7 @@ public class Vala.CCodeGenerator : CodeGenerator { current_return_type = prop.type_reference; } else { // void - current_return_type = new TypeReference (); + current_return_type = new DataType (); } acc.accept_children (this); @@ -572,7 +572,7 @@ public class Vala.CCodeGenerator : CodeGenerator { var t = (Typesymbol) prop.parent_symbol; - var this_type = new TypeReference (); + var this_type = new DataType (); this_type.data_type = t; var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ()); var cvalueparam = new CCodeFormalParameter ("value", prop.type_reference.get_cname (false, true)); @@ -893,7 +893,7 @@ public class Vala.CCodeGenerator : CodeGenerator { for (int dim = 1; dim <= arr.rank; dim++) { var len_decl = new VariableDeclarator (get_array_length_cname (decl.name, dim)); - len_decl.type_reference = new TypeReference (); + len_decl.type_reference = new DataType (); len_decl.type_reference.data_type = int_type.data_type; temp_vars.insert (0, len_decl); @@ -947,7 +947,7 @@ public class Vala.CCodeGenerator : CodeGenerator { } } - public VariableDeclarator get_temp_variable_declarator (TypeReference! type, bool takes_ownership = true, CodeNode node_reference = null) { + public VariableDeclarator get_temp_variable_declarator (DataType! type, bool takes_ownership = true, CodeNode node_reference = null) { var decl = new VariableDeclarator ("_tmp%d".printf (next_temp_var_id)); decl.type_reference = type.copy (); decl.type_reference.is_ref = false; @@ -963,7 +963,7 @@ public class Vala.CCodeGenerator : CodeGenerator { return decl; } - private CCodeExpression get_type_id_expression (TypeReference! type) { + private CCodeExpression get_type_id_expression (DataType! type) { if (type.data_type != null) { return new CCodeIdentifier (type.data_type.get_type_id ()); } else if (type.type_parameter != null) { @@ -974,7 +974,7 @@ public class Vala.CCodeGenerator : CodeGenerator { } } - private CCodeExpression get_dup_func_expression (TypeReference! type) { + private CCodeExpression get_dup_func_expression (DataType! type) { if (type.data_type != null) { string dup_function; if (type.data_type.is_reference_counting ()) { @@ -1002,7 +1002,7 @@ public class Vala.CCodeGenerator : CodeGenerator { } } - private CCodeExpression get_destroy_func_expression (TypeReference! type) { + private CCodeExpression get_destroy_func_expression (DataType! type) { if (type.data_type != null) { string unref_function; if (type.data_type.is_reference_counting ()) { @@ -1023,7 +1023,7 @@ public class Vala.CCodeGenerator : CodeGenerator { } } - public CCodeExpression get_unref_expression (CCodeExpression! cvar, TypeReference! type, Expression expr) { + public CCodeExpression get_unref_expression (CCodeExpression! cvar, DataType! type, Expression expr) { /* (foo == NULL ? NULL : foo = (unref (foo), NULL)) */ /* can be simplified to @@ -1056,7 +1056,7 @@ public class Vala.CCodeGenerator : CodeGenerator { bool takes_ownership = false; CCodeExpression destroy_func_expression = null; - foreach (TypeReference type_arg in type.get_type_arguments ()) { + foreach (DataType type_arg in type.get_type_arguments ()) { takes_ownership = type_arg.takes_ownership; if (takes_ownership) { destroy_func_expression = get_destroy_func_expression (type_arg); @@ -1095,7 +1095,7 @@ public class Vala.CCodeGenerator : CodeGenerator { ccall.call = new CCodeIdentifier ("_vala_array_free"); ccall.add_argument (csizeexpr); - var element_type = new TypeReference (); + var element_type = new DataType (); element_type.data_type = arr.element_type; element_type.type_parameter = arr.element_type_parameter; ccall.add_argument (new CCodeCastExpression (get_destroy_func_expression (element_type), "GDestroyNotify")); @@ -1702,7 +1702,7 @@ public class Vala.CCodeGenerator : CodeGenerator { element_expr = convert_from_generic_pointer (element_expr, stmt.type_reference); - Iterator<TypeReference> type_arg_it = it_method.return_type.get_type_arguments ().iterator (); + Iterator<DataType> type_arg_it = it_method.return_type.get_type_arguments ().iterator (); type_arg_it.next (); var it_type = SemanticAnalyzer.get_actual_type (stmt.collection.static_type, it_method, type_arg_it.get (), stmt); @@ -2155,9 +2155,9 @@ public class Vala.CCodeGenerator : CodeGenerator { } if (field.instance) { - var instance_expression_type = new TypeReference (); + var instance_expression_type = new DataType (); instance_expression_type.data_type = base_type; - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = (Typesymbol) field.parent_symbol; CCodeExpression typed_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type); @@ -2309,7 +2309,7 @@ public class Vala.CCodeGenerator : CodeGenerator { bool is_class = false; bool is_interface = false; - foreach (TypeReference type_arg in expr.static_type.get_type_arguments ()) { + foreach (DataType type_arg in expr.static_type.get_type_arguments ()) { is_ref |= type_arg.takes_ownership; is_class |= type_arg.data_type is Class; is_interface |= type_arg.data_type is Interface; @@ -2419,7 +2419,7 @@ public class Vala.CCodeGenerator : CodeGenerator { } if (expr.type_reference.data_type is Class && expr.type_reference.data_type.is_subtype_of (gobject_type)) { - foreach (TypeReference type_arg in expr.type_reference.get_type_arguments ()) { + foreach (DataType type_arg in expr.type_reference.get_type_arguments ()) { creation_call.add_argument (get_type_id_expression (type_arg)); if (type_arg.takes_ownership) { creation_call.add_argument (new CCodeCastExpression (get_dup_func_expression (type_arg), "GBoxedCopyFunc")); @@ -2509,7 +2509,7 @@ public class Vala.CCodeGenerator : CodeGenerator { foreach (MemberInitializer init in expr.get_object_initializer ()) { if (init.symbol_reference is Field) { var f = (Field) init.symbol_reference; - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = (Typesymbol) f.parent_symbol; var typed_inst = get_implicit_cast_expression (instance, expr.type_reference, instance_target_type); CCodeExpression lhs; @@ -2720,7 +2720,7 @@ public class Vala.CCodeGenerator : CodeGenerator { l.ccodenode = new CCodeIdentifier (l.method.get_cname ()); } - public CCodeExpression! convert_from_generic_pointer (CCodeExpression! cexpr, TypeReference! actual_type) { + public CCodeExpression! convert_from_generic_pointer (CCodeExpression! cexpr, DataType! actual_type) { var result = cexpr; if (actual_type.data_type is Struct) { var st = (Struct) actual_type.data_type; @@ -2737,7 +2737,7 @@ public class Vala.CCodeGenerator : CodeGenerator { return result; } - public CCodeExpression! convert_to_generic_pointer (CCodeExpression! cexpr, TypeReference! actual_type) { + public CCodeExpression! convert_to_generic_pointer (CCodeExpression! cexpr, DataType! actual_type) { var result = cexpr; if (actual_type.data_type is Struct) { var st = (Struct) actual_type.data_type; @@ -2754,7 +2754,7 @@ public class Vala.CCodeGenerator : CodeGenerator { return result; } - public CCodeExpression! get_implicit_cast_expression (CCodeExpression! cexpr, TypeReference expression_type, TypeReference! target_type) { + public CCodeExpression! get_implicit_cast_expression (CCodeExpression! cexpr, DataType expression_type, DataType! target_type) { if (null == expression_type) { return cexpr; } @@ -2808,17 +2808,17 @@ public class Vala.CCodeGenerator : CodeGenerator { /* target instance is first argument */ CCodeExpression instance; - TypeReference instance_expression_type; + DataType instance_expression_type; if (ma.inner == null) { instance = new CCodeIdentifier ("self"); - instance_expression_type = new TypeReference (); + instance_expression_type = new DataType (); instance_expression_type.data_type = current_type_symbol; } else { instance = (CCodeExpression) ma.inner.ccodenode; instance_expression_type = ma.inner.static_type; } - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = (Typesymbol) base_property.parent_symbol; instance = get_implicit_cast_expression (instance, instance_expression_type, instance_target_type); diff --git a/gobject/valaccodegeneratorclass.vala b/gobject/valaccodegeneratorclass.vala index 569e7ef53..7d8b48335 100644 --- a/gobject/valaccodegeneratorclass.vala +++ b/gobject/valaccodegeneratorclass.vala @@ -153,7 +153,7 @@ public class Vala.CCodeGenerator { } add_class_init_function (cl); - foreach (TypeReference base_type in cl.get_base_types ()) { + 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); } @@ -549,7 +549,7 @@ public class Vala.CCodeGenerator { source_type_member_definition.append (function); } - public CCodeIdentifier! get_value_setter_function (TypeReference! type_reference) { + public CCodeIdentifier! get_value_setter_function (DataType! type_reference) { if (type_reference.data_type != null) { return new CCodeIdentifier (type_reference.data_type.get_set_value_function ()); } else { diff --git a/gobject/valaccodegeneratorinvocationexpression.vala b/gobject/valaccodegeneratorinvocationexpression.vala index 643d00c7b..4ba704810 100644 --- a/gobject/valaccodegeneratorinvocationexpression.vala +++ b/gobject/valaccodegeneratorinvocationexpression.vala @@ -68,10 +68,10 @@ public class Vala.CCodeGenerator { base_method = m.base_method; } - TypeReference instance_expression_type; + DataType instance_expression_type; if (ma.inner == null) { instance = new CCodeIdentifier ("self"); - instance_expression_type = new TypeReference (); + instance_expression_type = new DataType (); instance_expression_type.data_type = current_type_symbol; } else { instance = (CCodeExpression) ma.inner.ccodenode; @@ -84,7 +84,7 @@ public class Vala.CCodeGenerator { // parent_symbol may be null for late bound methods if (base_method.parent_symbol != null) { - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = (Typesymbol) base_method.parent_symbol; instance = get_implicit_cast_expression (instance, instance_expression_type, instance_target_type); } @@ -401,7 +401,7 @@ public class Vala.CCodeGenerator { ccall.add_argument (get_dbus_array_type (array)); - var garray_type_reference = new TypeReference (); + var garray_type_reference = new DataType (); garray_type_reference.data_type = garray_type; var temp_decl = get_temp_variable_declarator (garray_type_reference); temp_vars.insert (0, temp_decl); diff --git a/gobject/valaccodegeneratormemberaccess.vala b/gobject/valaccodegeneratormemberaccess.vala index cde103518..8ed304f99 100644 --- a/gobject/valaccodegeneratormemberaccess.vala +++ b/gobject/valaccodegeneratormemberaccess.vala @@ -75,9 +75,9 @@ public class Vala.CCodeGenerator { } else if (expr.symbol_reference is Field) { var f = (Field) expr.symbol_reference; if (f.instance) { - var instance_expression_type = new TypeReference (); + var instance_expression_type = new DataType (); instance_expression_type.data_type = base_type; - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = (Typesymbol) f.parent_symbol; CCodeExpression typed_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type); @@ -113,9 +113,9 @@ public class Vala.CCodeGenerator { var base_property_type = (Typesymbol) base_property.parent_symbol; var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name))); - var instance_expression_type = new TypeReference (); + var instance_expression_type = new DataType (); instance_expression_type.data_type = base_type; - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = base_property_type; CCodeExpression typed_pub_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type); @@ -170,9 +170,9 @@ public class Vala.CCodeGenerator { if (sig.has_emitter) { var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_%s".printf (cl.get_lower_case_cname (null), sig.name))); - var instance_expression_type = new TypeReference (); + var instance_expression_type = new DataType (); instance_expression_type.data_type = base_type; - var instance_target_type = new TypeReference (); + var instance_target_type = new DataType (); instance_target_type.data_type = cl; CCodeExpression typed_pub_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type); diff --git a/gobject/valaccodegeneratormethod.vala b/gobject/valaccodegeneratormethod.vala index c92fddc40..307d3c899 100644 --- a/gobject/valaccodegeneratormethod.vala +++ b/gobject/valaccodegeneratormethod.vala @@ -27,7 +27,7 @@ using Gee; public class Vala.CCodeGenerator { public override void visit_method (Method! m) { Method old_method = current_method; - TypeReference old_return_type = current_return_type; + DataType old_return_type = current_return_type; bool old_method_inner_error = current_method_inner_error; int old_next_temp_var_id = next_temp_var_id; current_symbol = m; @@ -118,14 +118,14 @@ public class Vala.CCodeGenerator { CCodeFormalParameter instance_param = null; if (m.instance || (m.parent_symbol is Struct && m is CreationMethod)) { - var this_type = new TypeReference (); + var this_type = new DataType (); this_type.data_type = find_parent_type (m); if (m.base_interface_method != null && !m.is_abstract && !m.is_virtual) { - var base_type = new TypeReference (); + var base_type = new DataType (); base_type.data_type = (Typesymbol) m.base_interface_method.parent_symbol; instance_param = new CCodeFormalParameter ("base", base_type.get_cname ()); } else if (m.overrides) { - var base_type = new TypeReference (); + var base_type = new DataType (); base_type.data_type = (Typesymbol) m.base_method.parent_symbol; instance_param = new CCodeFormalParameter ("base", base_type.get_cname ()); } else { @@ -246,9 +246,9 @@ public class Vala.CCodeGenerator { } else { base_method = m.base_interface_method; } - var base_expression_type = new TypeReference (); + var base_expression_type = new DataType (); base_expression_type.data_type = base_method.parent_symbol; - var self_target_type = new TypeReference (); + var self_target_type = new DataType (); self_target_type.data_type = cl; CCodeExpression cself = get_implicit_cast_expression (new CCodeIdentifier ("base"), base_expression_type, self_target_type); @@ -380,7 +380,7 @@ public class Vala.CCodeGenerator { var vfunc = new CCodeFunction (m.get_cname (), m.return_type.get_cname ()); vfunc.line = function.line; - var this_type = new TypeReference (); + var this_type = new DataType (); this_type.data_type = (Typesymbol) m.parent_symbol; var cparam = new CCodeFormalParameter ("self", this_type.get_cname ()); diff --git a/gobject/valaccodegeneratorsignal.vala b/gobject/valaccodegeneratorsignal.vala index a7d21410d..ac0d67f6f 100644 --- a/gobject/valaccodegeneratorsignal.vala +++ b/gobject/valaccodegeneratorsignal.vala @@ -24,7 +24,7 @@ using GLib; public class Vala.CCodeGenerator { - private string get_marshaller_type_name (TypeReference t) { + private string get_marshaller_type_name (DataType t) { if (t.type_parameter != null) { return ("POINTER"); } else if (t.data_type == null) { @@ -60,7 +60,7 @@ public class Vala.CCodeGenerator { return ret; } - private string get_value_type_name_from_type_reference (TypeReference! t) { + private string get_value_type_name_from_type_reference (DataType! t) { if (t.type_parameter != null) { return "gpointer"; } else if (t.data_type == null) { diff --git a/gobject/valaclassregisterfunction.vala b/gobject/valaclassregisterfunction.vala index 98b9a0459..402641e94 100644 --- a/gobject/valaclassregisterfunction.vala +++ b/gobject/valaclassregisterfunction.vala @@ -84,7 +84,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction { public override CCodeFragment! get_type_interface_init_declaration () { var frag = new CCodeFragment (); - foreach (TypeReference base_type in class_reference.get_base_types ()) { + foreach (DataType base_type in class_reference.get_base_types ()) { if (!(base_type.data_type is Interface)) { continue; } @@ -105,7 +105,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction { public override CCodeFragment! get_type_interface_init_statements () { var frag = new CCodeFragment (); - foreach (TypeReference base_type in class_reference.get_base_types ()) { + foreach (DataType base_type in class_reference.get_base_types ()) { if (!(base_type.data_type is Interface)) { continue; } diff --git a/gobject/valadbusbindingprovider.vala b/gobject/valadbusbindingprovider.vala index 7f992bf23..9ca61c39f 100644 --- a/gobject/valadbusbindingprovider.vala +++ b/gobject/valadbusbindingprovider.vala @@ -57,9 +57,9 @@ public class Vala.DBusBindingProvider : Object, BindingProvider { if (type_args.size != 1) { return null; } - Iterator<TypeReference> type_args_it = type_args.iterator (); + Iterator<DataType> type_args_it = type_args.iterator (); type_args_it.next (); - var ret_type = new TypeReference (); + var ret_type = new DataType (); ret_type.data_type = type_args_it.get ().data_type; if (!is_dbus_interface (ret_type.data_type)) { return null; @@ -68,7 +68,7 @@ public class Vala.DBusBindingProvider : Object, BindingProvider { m.set_cname ("dbus_g_proxy_new_for_name"); m.add_cheader_filename ("dbus/dbus-glib.h"); m.access = SymbolAccessibility.PUBLIC; - var string_type_ref = new TypeReference (); + var string_type_ref = new DataType (); string_type_ref.data_type = string_type; m.add_parameter (_context.create_formal_parameter ("name", string_type_ref)); m.add_parameter (_context.create_formal_parameter ("path", string_type_ref)); @@ -77,14 +77,14 @@ public class Vala.DBusBindingProvider : Object, BindingProvider { } else if (ma.inner != null && ma.inner.static_type != null && is_dbus_interface (ma.inner.static_type.data_type)) { if (ma.parent_node is InvocationExpression) { var expr = (InvocationExpression) ma.parent_node; - var ret_type = new TypeReference (); + var ret_type = new DataType (); if (expr.expected_type != null) { ret_type.data_type = expr.expected_type.data_type; ret_type.transfers_ownership = ret_type.data_type.is_reference_type (); } var m = new DBusMethod (ma.member_name, ret_type, ma.source_reference); if (expr.expected_type != null) { - var error_type = new TypeReference (); + var error_type = new DataType (); error_type.data_type = dbus_error_type; m.add_error_domain (error_type); } @@ -97,7 +97,7 @@ public class Vala.DBusBindingProvider : Object, BindingProvider { if (a.left != ma) { return null; } - var s = new DBusSignal (ma.member_name, new TypeReference (), ma.source_reference); + var s = new DBusSignal (ma.member_name, new DataType (), ma.source_reference); s.access = SymbolAccessibility.PUBLIC; symbols.add (s); return s; diff --git a/gobject/valadbusmethod.vala b/gobject/valadbusmethod.vala index 9596c47a8..975fb8494 100644 --- a/gobject/valadbusmethod.vala +++ b/gobject/valadbusmethod.vala @@ -27,7 +27,7 @@ using Gee; * Represents a dynamic bound DBus method. */ public class Vala.DBusMethod : Method { - public DBusMethod (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { + public DBusMethod (construct string name, construct DataType return_type, construct SourceReference source_reference = null) { } public override Collection<string> get_cheader_filenames () { diff --git a/gobject/valadbussignal.vala b/gobject/valadbussignal.vala index 22e09712e..44d627c5c 100644 --- a/gobject/valadbussignal.vala +++ b/gobject/valadbussignal.vala @@ -26,6 +26,6 @@ using GLib; * Represents a dynamic bound DBus signal. */ public class Vala.DBusSignal : Signal { - public DBusSignal (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { + public DBusSignal (construct string name, construct DataType return_type, construct SourceReference source_reference = null) { } } diff --git a/gobject/valainterfaceregisterfunction.vala b/gobject/valainterfaceregisterfunction.vala index 559952128..b12c89f14 100644 --- a/gobject/valainterfaceregisterfunction.vala +++ b/gobject/valainterfaceregisterfunction.vala @@ -72,7 +72,7 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction { var frag = new CCodeFragment (); /* register all prerequisites */ - foreach (TypeReference prereq_ref in interface_reference.get_prerequisites ()) { + foreach (DataType prereq_ref in interface_reference.get_prerequisites ()) { var prereq = prereq_ref.data_type; var func = new CCodeFunctionCall (new CCodeIdentifier ("g_type_interface_add_prerequisite")); diff --git a/vala/Makefile.am b/vala/Makefile.am index 099e0ce8a..3b92f609d 100644 --- a/vala/Makefile.am +++ b/vala/Makefile.am @@ -43,6 +43,7 @@ libvalacore_la_VALASOURCES = \ valaconstructor.vala \ valacontinuestatement.vala \ valacreationmethod.vala \ + valadatatype.vala \ valadeclarationstatement.vala \ valadestructor.vala \ valadostatement.vala \ @@ -111,7 +112,6 @@ libvalacore_la_VALASOURCES = \ valatypecheck.vala \ valatypeofexpression.vala \ valatypeparameter.vala \ - valatypereference.vala \ valatypesymbol.vala \ valaunaryexpression.vala \ valavariabledeclarator.vala \ diff --git a/vala/parser.y b/vala/parser.y index c45fef347..e2458f7c4 100644 --- a/vala/parser.y +++ b/vala/parser.y @@ -72,7 +72,7 @@ static gboolean check_is_struct (ValaSymbol *symbol, ValaSourceReference *src); char *str; GList *list; ValaLiteral *literal; - ValaTypeReference *type_reference; + ValaDataType *type_reference; ValaExpression *expression; ValaStatement *statement; ValaBlock *block; @@ -461,11 +461,11 @@ type_name { GList *l; ValaSourceReference *src = src(@1); - $$ = vala_type_reference_new_from_name (NULL, $1, src); + $$ = vala_data_type_new_from_name (NULL, $1, src); g_free ($1); g_object_unref (src); for (l = $2; l != NULL; l = l->next) { - vala_type_reference_add_type_argument ($$, l->data); + vala_data_type_add_type_argument ($$, l->data); g_object_unref (l->data); } g_list_free ($2); @@ -474,12 +474,12 @@ type_name { GList *l; ValaSourceReference *src = src(@1); - $$ = vala_type_reference_new_from_name ($1, $3, src); + $$ = vala_data_type_new_from_name ($1, $3, src); g_free ($1); g_free ($3); g_object_unref (src); for (l = $4; l != NULL; l = l->next) { - vala_type_reference_add_type_argument ($$, l->data); + vala_data_type_add_type_argument ($$, l->data); g_object_unref (l->data); } g_list_free ($4); @@ -501,64 +501,64 @@ type : type_name opt_rank_specifier opt_op_neg { $$ = $1; - vala_type_reference_set_array_rank ($$, $2); + vala_data_type_set_array_rank ($$, $2); if ($3) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | WEAK type_name opt_rank_specifier opt_op_neg { $$ = $2; - vala_type_reference_set_is_weak ($$, TRUE); - vala_type_reference_set_array_rank ($$, $3); + vala_data_type_set_is_weak ($$, TRUE); + vala_data_type_set_array_rank ($$, $3); if ($4) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | type_name opt_rank_specifier opt_op_neg HASH { $$ = $1; - vala_type_reference_set_takes_ownership ($$, TRUE); - vala_type_reference_set_array_rank ($$, $2); + vala_data_type_set_takes_ownership ($$, TRUE); + vala_data_type_set_array_rank ($$, $2); if ($3) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | REF type_name opt_rank_specifier opt_op_neg { $$ = $2; - vala_type_reference_set_is_ref ($$, TRUE); - vala_type_reference_set_array_rank ($$, $3); + vala_data_type_set_is_ref ($$, TRUE); + vala_data_type_set_array_rank ($$, $3); if ($4) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | OUT type_name opt_rank_specifier opt_op_neg { $$ = $2; - vala_type_reference_set_is_out ($$, TRUE); - vala_type_reference_set_array_rank ($$, $3); + vala_data_type_set_is_out ($$, TRUE); + vala_data_type_set_array_rank ($$, $3); if ($4) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | OUT WEAK type_name opt_rank_specifier opt_op_neg { $$ = $3; - vala_type_reference_set_is_weak ($$, TRUE); - vala_type_reference_set_is_out ($$, TRUE); - vala_type_reference_set_array_rank ($$, $4); + vala_data_type_set_is_weak ($$, TRUE); + vala_data_type_set_is_out ($$, TRUE); + vala_data_type_set_array_rank ($$, $4); if ($5) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | type_name stars opt_rank_specifier opt_op_neg { $$ = $1; - vala_type_reference_set_pointer_level ($$, $2); - vala_type_reference_set_array_rank ($$, $3); + vala_data_type_set_pointer_level ($$, $2); + vala_data_type_set_array_rank ($$, $3); if ($4) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } ; @@ -596,7 +596,7 @@ array_creation_expression { GList *l; ValaSourceReference *src = src(@2); - ValaTypeReference *t = vala_type_reference_new_from_expression (VALA_EXPRESSION ($2)); + ValaDataType *t = vala_data_type_new_from_expression (VALA_EXPRESSION ($2)); $$ = VALA_EXPRESSION (vala_code_context_create_array_creation_expression (context, t, g_list_length ($3), VALA_INITIALIZER_LIST ($4), src)); g_object_unref (t); for (l = $3; l != NULL; l = l->next) { @@ -613,7 +613,7 @@ array_creation_expression | NEW member_name rank_specifier initializer { ValaSourceReference *src = src(@2); - ValaTypeReference *t = vala_type_reference_new_from_expression (VALA_EXPRESSION ($2)); + ValaDataType *t = vala_data_type_new_from_expression (VALA_EXPRESSION ($2)); $$ = VALA_EXPRESSION (vala_code_context_create_array_creation_expression (context, t, $3, VALA_INITIALIZER_LIST ($4), src)); g_object_unref (t); g_object_unref (src); @@ -1793,7 +1793,7 @@ local_variable_declaration g_object_unref (src); for (l = $2; l != NULL; l = l->next) { ValaVariableDeclarator *decl = l->data; - ValaTypeReference *type = vala_type_reference_copy ($1); + ValaDataType *type = vala_data_type_copy ($1); vala_variable_declarator_set_type_reference (decl, type); g_object_unref (type); vala_local_variable_declaration_add_declarator ($$, decl); @@ -1821,32 +1821,32 @@ local_variable_type : primary_expression opt_bracket_pair opt_op_neg { ValaSourceReference *src = src(@1); - $$ = vala_type_reference_new_from_expression ($1); + $$ = vala_data_type_new_from_expression ($1); g_object_unref ($1); g_object_unref (src); - vala_type_reference_set_takes_ownership ($$, TRUE); - vala_type_reference_set_array_rank ($$, $2); + vala_data_type_set_takes_ownership ($$, TRUE); + vala_data_type_set_array_rank ($$, $2); if ($3) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } | primary_expression stars { ValaSourceReference *src = src(@1); - $$ = vala_type_reference_new_from_expression ($1); + $$ = vala_data_type_new_from_expression ($1); g_object_unref ($1); g_object_unref (src); - vala_type_reference_set_pointer_level ($$, $2); + vala_data_type_set_pointer_level ($$, $2); } | WEAK primary_expression opt_bracket_pair opt_op_neg { ValaSourceReference *src = src(@2); - $$ = vala_type_reference_new_from_expression ($2); + $$ = vala_data_type_new_from_expression ($2); g_object_unref ($2); g_object_unref (src); - vala_type_reference_set_array_rank ($$, $3); + vala_data_type_set_array_rank ($$, $3); if ($4) { - vala_type_reference_set_non_null ($$, TRUE); + vala_data_type_set_non_null ($$, TRUE); } } ; @@ -2152,8 +2152,8 @@ foreach_statement : FOREACH OPEN_PARENS type identifier IN expression CLOSE_PARENS embedded_statement { ValaSourceReference *src = src(@3); - if (!vala_type_reference_get_is_weak ($3)) { - vala_type_reference_set_takes_ownership ($3, TRUE); + if (!vala_data_type_get_is_weak ($3)) { + vala_data_type_set_takes_ownership ($3, TRUE); } $$ = VALA_STATEMENT (vala_code_context_create_foreach_statement (context, $3, $4, $6, $8, src)); g_object_unref ($3); @@ -2772,11 +2772,11 @@ field_declaration src = src_com(@5, $1); - if (vala_type_reference_get_is_ref ($5) || vala_type_reference_get_is_out ($5)) { + if (vala_data_type_get_is_ref ($5) || vala_data_type_get_is_out ($5)) { vala_report_error (src, "`ref' and `out' may only be used for parameters."); } - if (!vala_type_reference_get_is_weak ($5)) { - vala_type_reference_set_takes_ownership ($5, TRUE); + if (!vala_data_type_get_is_weak ($5)) { + vala_data_type_set_takes_ownership ($5, TRUE); } $$ = vala_code_context_create_field (context, vala_symbol_get_name (VALA_SYMBOL ($6)), $5, vala_variable_declarator_get_initializer ($6), src); @@ -2920,11 +2920,11 @@ method_header src = src_com(@6, $1); - if (vala_type_reference_get_is_ref ($5) || vala_type_reference_get_is_out ($5)) { + if (vala_data_type_get_is_ref ($5) || vala_data_type_get_is_out ($5)) { vala_report_error (src, "`ref' and `out' may only be used for parameters."); } - if (!vala_type_reference_get_is_weak ($5)) { - vala_type_reference_set_transfers_ownership ($5, TRUE); + if (!vala_data_type_get_is_weak ($5)) { + vala_data_type_set_transfers_ownership ($5, TRUE); } $$ = vala_code_context_create_method (context, $6, $5, src); @@ -3107,13 +3107,13 @@ property_declaration /* HASH in property type context has the meaning of transferring * ownership instead of taking it */ - if (vala_type_reference_get_takes_ownership ($5)) { - vala_type_reference_set_transfers_ownership ($5, TRUE); - vala_type_reference_set_takes_ownership ($5, FALSE); + if (vala_data_type_get_takes_ownership ($5)) { + vala_data_type_set_transfers_ownership ($5, TRUE); + vala_data_type_set_takes_ownership ($5, FALSE); } - if (!vala_type_reference_get_is_weak ($5)) { - vala_type_reference_set_takes_ownership ($5, TRUE); + if (!vala_data_type_get_is_weak ($5)) { + vala_data_type_set_takes_ownership ($5, TRUE); } src = src_com(@5, $1); @@ -3147,13 +3147,13 @@ property_declaration /* HASH in property type context has the meaning of transferring * ownership instead of taking it */ - if (vala_type_reference_get_takes_ownership ($5)) { - vala_type_reference_set_transfers_ownership ($5, TRUE); - vala_type_reference_set_takes_ownership ($5, FALSE); + if (vala_data_type_get_takes_ownership ($5)) { + vala_data_type_set_transfers_ownership ($5, TRUE); + vala_data_type_set_takes_ownership ($5, FALSE); } - if (!vala_type_reference_get_is_weak ($5)) { - vala_type_reference_set_takes_ownership ($5, TRUE); + if (!vala_data_type_get_is_weak ($5)) { + vala_data_type_set_takes_ownership ($5, TRUE); } src = src_com(@5, $1); @@ -3883,8 +3883,8 @@ type_argument : type { $$ = $1; - if (!vala_type_reference_get_is_weak ($$)) { - vala_type_reference_set_takes_ownership ($$, TRUE); + if (!vala_data_type_get_is_weak ($$)) { + vala_data_type_set_takes_ownership ($$, TRUE); } } ; diff --git a/vala/vala.h b/vala/vala.h index 7a0326a7d..5fd2b8467 100644 --- a/vala/vala.h +++ b/vala/vala.h @@ -18,6 +18,7 @@ #include <vala/valaconstructor.h> #include <vala/valacontinuestatement.h> #include <vala/valacreationmethod.h> +#include <vala/valadatatype.h> #include <vala/valadeclarationstatement.h> #include <vala/valadestructor.h> #include <vala/valadostatement.h> @@ -74,7 +75,7 @@ #include <vala/valatypecheck.h> #include <vala/valatypeofexpression.h> #include <vala/valatypeparameter.h> -#include <vala/valatypereference.h> +#include <vala/valatypesymbol.h> #include <vala/valaunaryexpression.h> #include <vala/valavariabledeclarator.h> #include <vala/valawhilestatement.h> diff --git a/vala/valaarray.vala b/vala/valaarray.vala index cf800fa4a..c941f75d5 100644 --- a/vala/valaarray.vala +++ b/vala/valaarray.vala @@ -158,7 +158,7 @@ public class Vala.Array : Typesymbol { length_field.access = SymbolAccessibility.PUBLIC; var root_symbol = source_reference.file.context.root; - length_field.type_reference = new TypeReference (); + length_field.type_reference = new DataType (); length_field.type_reference.data_type = (Typesymbol) root_symbol.scope.lookup ("int"); } @@ -169,13 +169,13 @@ public class Vala.Array : Typesymbol { if (resize_method == null) { resize_method = new ArrayResizeMethod (source_reference); - resize_method.return_type = new TypeReference (); + resize_method.return_type = new DataType (); resize_method.access = SymbolAccessibility.PUBLIC; resize_method.set_cname ("g_renew"); var root_symbol = source_reference.file.context.root; - var int_type = new TypeReference (); + var int_type = new DataType (); int_type.data_type = (Typesymbol) root_symbol.scope.lookup ("int"); resize_method.add_parameter (new FormalParameter ("length", int_type)); @@ -189,13 +189,13 @@ public class Vala.Array : Typesymbol { if (move_method == null) { move_method = new ArrayMoveMethod (source_reference); - move_method.return_type = new TypeReference (); + move_method.return_type = new DataType (); move_method.access = SymbolAccessibility.PUBLIC; move_method.set_cname ("_vala_array_move"); var root_symbol = source_reference.file.context.root; - var int_type = new TypeReference (); + var int_type = new DataType (); int_type.data_type = (Typesymbol) root_symbol.scope.lookup ("int"); move_method.add_parameter (new FormalParameter ("src", int_type)); diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala index b8b72c569..6cfd2aaf2 100644 --- a/vala/valaarraycreationexpression.vala +++ b/vala/valaarraycreationexpression.vala @@ -31,7 +31,7 @@ public class Vala.ArrayCreationExpression : Expression { /** * The type of the elements of the array. */ - public TypeReference element_type { get; set construct; } + public DataType element_type { get; set construct; } /** * The rank of the array. @@ -62,7 +62,7 @@ public class Vala.ArrayCreationExpression : Expression { return new ReadOnlyList<Expression> (sizes); } - public ArrayCreationExpression (construct TypeReference element_type, construct int rank, construct InitializerList initializer_list, construct SourceReference source_reference) { + public ArrayCreationExpression (construct DataType element_type, construct int rank, construct InitializerList initializer_list, construct SourceReference source_reference) { } public override void accept_children (CodeVisitor! visitor) { diff --git a/vala/valacallback.vala b/vala/valacallback.vala index 521a63b86..ce358f214 100644 --- a/vala/valacallback.vala +++ b/vala/valacallback.vala @@ -30,7 +30,7 @@ public class Vala.Callback : Typesymbol { /** * The return type of this callback. */ - public TypeReference return_type { get; set; } + public DataType return_type { get; set; } /** * Specifies whether callback supports calling instance methods. @@ -52,7 +52,7 @@ public class Vala.Callback : Typesymbol { * @param source reference to source code * @return newly created callback */ - public Callback (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { + public Callback (construct string name, construct DataType return_type, construct SourceReference source_reference = null) { } /** diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala index 4f0366ef0..161658649 100644 --- a/vala/valacastexpression.vala +++ b/vala/valacastexpression.vala @@ -42,7 +42,7 @@ public class Vala.CastExpression : Expression { /** * The target type. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * Checked casts return NULL instead of raising an error. @@ -58,7 +58,7 @@ public class Vala.CastExpression : Expression { * @param type target type * @return newly created cast expression */ - public CastExpression (construct Expression! inner, construct TypeReference! type_reference, construct SourceReference source_reference, construct bool is_silent_cast) { + public CastExpression (construct Expression! inner, construct DataType! type_reference, construct SourceReference source_reference, construct bool is_silent_cast) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala index dd130cf74..db6375d53 100644 --- a/vala/valacatchclause.vala +++ b/vala/valacatchclause.vala @@ -29,7 +29,7 @@ public class Vala.CatchClause : CodeNode { /** * Specifies the error type. */ - public TypeReference type_reference { get; set; } + public DataType type_reference { get; set; } /** * Specifies the error variable name. @@ -55,7 +55,7 @@ public class Vala.CatchClause : CodeNode { * @param source_reference reference to source code * @return newly created catch clause */ - public CatchClause (construct TypeReference type_reference, construct string variable_name, construct Block body, construct SourceReference source_reference = null) { + public CatchClause (construct DataType type_reference, construct string variable_name, construct Block body, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valaclass.vala b/vala/valaclass.vala index eff636ede..4da15e6e2 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -71,7 +71,7 @@ public class Vala.Class : Typesymbol { private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> (); - private Gee.List<TypeReference> base_types = new ArrayList<TypeReference> (); + private Gee.List<DataType> base_types = new ArrayList<DataType> (); private Gee.List<Constant> constants = new ArrayList<Constant> (); private Gee.List<Field> fields = new ArrayList<Field> (); @@ -114,7 +114,7 @@ public class Vala.Class : Typesymbol { * * @param type a class or interface reference */ - public void add_base_type (TypeReference! type) { + public void add_base_type (DataType! type) { base_types.add (type); } @@ -123,8 +123,8 @@ public class Vala.Class : Typesymbol { * * @return list of base types */ - public Collection<TypeReference> get_base_types () { - return new ReadOnlyCollection<TypeReference> (base_types); + public Collection<DataType> get_base_types () { + return new ReadOnlyCollection<DataType> (base_types); } /** @@ -188,7 +188,7 @@ public class Vala.Class : Typesymbol { */ public void add_method (Method! m) { if (m.instance || m is CreationMethod) { - m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter = new FormalParameter ("this", new DataType ()); m.this_parameter.type_reference.data_type = this; m.scope.add (m.this_parameter.name, m.this_parameter); } @@ -223,7 +223,7 @@ public class Vala.Class : Typesymbol { properties.add (prop); scope.add (prop.name, prop); - prop.this_parameter = new FormalParameter ("this", new TypeReference ()); + prop.this_parameter = new FormalParameter ("this", new DataType ()); prop.this_parameter.type_reference.data_type = this; prop.scope.add (prop.this_parameter.name, prop.this_parameter); @@ -292,7 +292,7 @@ public class Vala.Class : Typesymbol { } public override void accept_children (CodeVisitor! visitor) { - foreach (TypeReference type in base_types) { + foreach (DataType type in base_types) { type.accept (visitor); } @@ -571,7 +571,7 @@ public class Vala.Class : Typesymbol { return true; } - foreach (TypeReference base_type in base_types) { + foreach (DataType base_type in base_types) { if (base_type.data_type != null && base_type.data_type.is_subtype_of (t)) { return true; } diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index b015d1287..75b228137 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -393,25 +393,25 @@ public class Vala.CodeContext : Object { return node; } - public Callback! create_callback (string name, TypeReference return_type, SourceReference source_reference = null) { + public Callback! create_callback (string name, DataType return_type, SourceReference source_reference = null) { var node = new Callback (name, return_type, source_reference); node.code_binding = codegen.create_callback_binding (node); return node; } - public Constant! create_constant (string! name, TypeReference! type_reference, Expression initializer, SourceReference source_reference) { + public Constant! create_constant (string! name, DataType! type_reference, Expression initializer, SourceReference source_reference) { var node = new Constant (name, type_reference, initializer, source_reference); node.code_binding = codegen.create_constant_binding (node); return node; } - public Field! create_field (string! name, TypeReference! type_reference, Expression initializer, SourceReference source_reference = null) { + public Field! create_field (string! name, DataType! type_reference, Expression initializer, SourceReference source_reference = null) { var node = new Field (name, type_reference, initializer, source_reference); node.code_binding = codegen.create_field_binding (node); return node; } - public Method! create_method (string name, TypeReference return_type, SourceReference source_reference = null) { + public Method! create_method (string name, DataType return_type, SourceReference source_reference = null) { var node = new Method (name, return_type, source_reference); node.code_binding = codegen.create_method_binding (node); return node; @@ -423,7 +423,7 @@ public class Vala.CodeContext : Object { return node; } - public FormalParameter! create_formal_parameter (string! name, TypeReference type_reference, SourceReference source_reference = null) { + public FormalParameter! create_formal_parameter (string! name, DataType type_reference, SourceReference source_reference = null) { var node = new FormalParameter (name, type_reference, source_reference); node.code_binding = codegen.create_formal_parameter_binding (node); return node; @@ -435,7 +435,7 @@ public class Vala.CodeContext : Object { return node; } - public Property! create_property (string! name, TypeReference! type_reference, PropertyAccessor get_accessor, PropertyAccessor set_accessor, SourceReference source_reference) { + public Property! create_property (string! name, DataType! type_reference, PropertyAccessor get_accessor, PropertyAccessor set_accessor, SourceReference source_reference) { var node = new Property (name, type_reference, get_accessor, set_accessor, source_reference); node.code_binding = codegen.create_property_binding (node); return node; @@ -447,7 +447,7 @@ public class Vala.CodeContext : Object { return node; } - public Signal! create_signal (string! name, TypeReference! return_type, SourceReference source_reference = null) { + public Signal! create_signal (string! name, DataType! return_type, SourceReference source_reference = null) { var node = new Signal (name, return_type, source_reference); node.code_binding = codegen.create_signal_binding (node); return node; @@ -489,7 +489,7 @@ public class Vala.CodeContext : Object { return node; } - public LocalVariableDeclaration! create_local_variable_declaration (TypeReference type_reference, SourceReference source_reference) { + public LocalVariableDeclaration! create_local_variable_declaration (DataType type_reference, SourceReference source_reference) { var node = new LocalVariableDeclaration (type_reference, source_reference); node.code_binding = codegen.create_local_variable_declaration_binding (node); return node; @@ -567,7 +567,7 @@ public class Vala.CodeContext : Object { return node; } - public ForeachStatement! create_foreach_statement (TypeReference! type_reference, string! variable_name, Expression! collection, Block body, SourceReference source_reference) { + public ForeachStatement! create_foreach_statement (DataType! type_reference, string! variable_name, Expression! collection, Block body, SourceReference source_reference) { var node = new ForeachStatement (type_reference, variable_name, collection, body, source_reference); node.code_binding = codegen.create_foreach_statement_binding (node); return node; @@ -603,7 +603,7 @@ public class Vala.CodeContext : Object { return node; } - public CatchClause! create_catch_clause (TypeReference type_reference, string variable_name, Block body, SourceReference source_reference = null) { + public CatchClause! create_catch_clause (DataType type_reference, string variable_name, Block body, SourceReference source_reference = null) { var node = new CatchClause (type_reference, variable_name, body, source_reference); node.code_binding = codegen.create_catch_clause_binding (node); return node; @@ -615,7 +615,7 @@ public class Vala.CodeContext : Object { return node; } - public ArrayCreationExpression! create_array_creation_expression (TypeReference element_type, int rank, InitializerList initializer_list, SourceReference source_reference) { + public ArrayCreationExpression! create_array_creation_expression (DataType element_type, int rank, InitializerList initializer_list, SourceReference source_reference) { var node = new ArrayCreationExpression (element_type, rank, initializer_list, source_reference); node.code_binding = codegen.create_array_creation_expression_binding (node); return node; @@ -711,13 +711,13 @@ public class Vala.CodeContext : Object { return node; } - public SizeofExpression! create_sizeof_expression (TypeReference! type_reference, SourceReference source_reference) { + public SizeofExpression! create_sizeof_expression (DataType! type_reference, SourceReference source_reference) { var node = new SizeofExpression (type_reference, source_reference); node.code_binding = codegen.create_sizeof_expression_binding (node); return node; } - public TypeofExpression! create_typeof_expression (TypeReference! type_reference, SourceReference source_reference) { + public TypeofExpression! create_typeof_expression (DataType! type_reference, SourceReference source_reference) { var node = new TypeofExpression (type_reference, source_reference); node.code_binding = codegen.create_typeof_expression_binding (node); return node; @@ -729,7 +729,7 @@ public class Vala.CodeContext : Object { return node; } - public CastExpression! create_cast_expression (Expression! inner, TypeReference! type_reference, SourceReference source_reference, bool is_silent_cast) { + public CastExpression! create_cast_expression (Expression! inner, DataType! type_reference, SourceReference source_reference, bool is_silent_cast) { var node = new CastExpression (inner, type_reference, source_reference, is_silent_cast); node.code_binding = codegen.create_cast_expression_binding (node); return node; @@ -759,7 +759,7 @@ public class Vala.CodeContext : Object { return node; } - public TypeCheck! create_type_check (Expression! expression, TypeReference! type_reference, SourceReference source_reference) { + public TypeCheck! create_type_check (Expression! expression, DataType! type_reference, SourceReference source_reference) { var node = new TypeCheck (expression, type_reference, source_reference); node.code_binding = codegen.create_type_check_binding (node); return node; diff --git a/vala/valacodevisitor.vala b/vala/valacodevisitor.vala index 57ed45d41..6f268c95b 100644 --- a/vala/valacodevisitor.vala +++ b/vala/valacodevisitor.vala @@ -208,7 +208,7 @@ public abstract class Vala.CodeVisitor : Object { * * @param type a type reference */ - public virtual void visit_type_reference (TypeReference! type) { + public virtual void visit_type_reference (DataType! type) { } /** diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala index 6524c38b2..ec1d5f318 100644 --- a/vala/valaconstant.vala +++ b/vala/valaconstant.vala @@ -29,7 +29,7 @@ public class Vala.Constant : Member, Lockable { /** * The data type of this constant. */ - public TypeReference! type_reference { get; set; } + public DataType! type_reference { get; set; } /** * The value of this constant. @@ -49,7 +49,7 @@ public class Vala.Constant : Member, Lockable { * @param source_reference reference to source code * @return newly created constant */ - public Constant (construct string! name, construct TypeReference! type_reference, construct Expression initializer, construct SourceReference source_reference) { + public Constant (construct string! name, construct DataType! type_reference, construct Expression initializer, construct SourceReference source_reference) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala index ca99f1e17..adc4311ab 100644 --- a/vala/valacreationmethod.vala +++ b/vala/valacreationmethod.vala @@ -56,7 +56,7 @@ public class Vala.CreationMethod : Method { param.accept (visitor); } - foreach (TypeReference error_domain in get_error_domains ()) { + foreach (DataType error_domain in get_error_domains ()) { error_domain.accept (visitor); } diff --git a/vala/valatypereference.vala b/vala/valadatatype.vala index 307962ca8..46227da56 100644 --- a/vala/valatypereference.vala +++ b/vala/valadatatype.vala @@ -28,7 +28,7 @@ using Gee; * A reference to a data type. This is used to specify static types of * expressions. */ -public class Vala.TypeReference : CodeNode { +public class Vala.DataType : CodeNode { /** * Specifies that the expression transfers ownership of its value. */ @@ -105,9 +105,9 @@ public class Vala.TypeReference : CodeNode { */ public bool is_weak { get; set; } - private ArrayList<TypeReference> type_argument_list = new ArrayList<TypeReference> (); + private ArrayList<DataType> type_argument_list = new ArrayList<DataType> (); - public TypeReference () { + public DataType () { } /** @@ -118,7 +118,7 @@ public class Vala.TypeReference : CodeNode { * @param source reference to source code * @return newly created type reference */ - public TypeReference.from_name (string ns, string! type, SourceReference source = null) { + public DataType.from_name (string ns, string! type, SourceReference source = null) { namespace_name = ns; type_name = type; source_reference = source; @@ -131,25 +131,25 @@ public class Vala.TypeReference : CodeNode { * @param source reference to source code * @return newly created type reference */ - public static TypeReference new_from_expression (Expression! expr) { + public static DataType new_from_expression (Expression! expr) { string ns = null; string type_name = null; if (expr is MemberAccess) { - TypeReference type_ref = null; + DataType type_ref = null; MemberAccess ma = (MemberAccess) expr; if (ma.inner != null) { if (ma.inner is MemberAccess) { var simple = (MemberAccess) ma.inner; - type_ref = new TypeReference.from_name (simple.member_name, ma.member_name, ma.source_reference); + type_ref = new DataType.from_name (simple.member_name, ma.member_name, ma.source_reference); } } else { - type_ref = new TypeReference.from_name (null, ma.member_name, ma.source_reference); + type_ref = new DataType.from_name (null, ma.member_name, ma.source_reference); } if (type_ref != null) { var type_args = ma.get_type_arguments (); - foreach (TypeReference arg in type_args) { + foreach (DataType arg in type_args) { type_ref.add_type_argument (arg); } @@ -166,7 +166,7 @@ public class Vala.TypeReference : CodeNode { * * @param arg a type reference */ - public void add_type_argument (TypeReference! arg) { + public void add_type_argument (DataType! arg) { type_argument_list.add (arg); } @@ -175,8 +175,8 @@ public class Vala.TypeReference : CodeNode { * * @return type argument list */ - public Gee.List<TypeReference> get_type_arguments () { - return new ReadOnlyList<TypeReference> (type_argument_list); + public Gee.List<DataType> get_type_arguments () { + return new ReadOnlyList<DataType> (type_argument_list); } /** @@ -187,8 +187,8 @@ public class Vala.TypeReference : CodeNode { } public override void accept (CodeVisitor! visitor) { - if (((Gee.List<TypeReference>) type_argument_list).size > 0) { - foreach (TypeReference type_arg in type_argument_list) { + if (((Gee.List<DataType>) type_argument_list).size > 0) { + foreach (DataType type_arg in type_argument_list) { type_arg.accept (visitor); } } @@ -278,8 +278,8 @@ public class Vala.TypeReference : CodeNode { * * @return copy of this type reference */ - public TypeReference! copy () { - var result = new TypeReference (); + public DataType! copy () { + var result = new DataType (); result.source_reference = source_reference; result.transfers_ownership = transfers_ownership; result.takes_ownership = takes_ownership; @@ -295,7 +295,7 @@ public class Vala.TypeReference : CodeNode { result.is_ref = is_ref; result.is_weak = is_weak; - foreach (TypeReference arg in type_argument_list) { + foreach (DataType arg in type_argument_list) { result.type_argument_list.add (arg.copy ()); } @@ -310,7 +310,7 @@ public class Vala.TypeReference : CodeNode { * @return true if this type reference is equal to type2, false * otherwise */ - public bool equals (TypeReference! type2) { + public bool equals (DataType! type2) { if (type2.transfers_ownership != transfers_ownership) { return false; } @@ -351,7 +351,7 @@ public class Vala.TypeReference : CodeNode { * @param type2 a type reference * @return true if this type reference is stricter or equal */ - public bool stricter (TypeReference! type2) { + public bool stricter (DataType! type2) { if (type2.transfers_ownership != transfers_ownership) { return false; } diff --git a/vala/valaenum.vala b/vala/valaenum.vala index 76a29e144..71bb89cf7 100644 --- a/vala/valaenum.vala +++ b/vala/valaenum.vala @@ -77,7 +77,7 @@ public class Vala.Enum : Typesymbol { return; } if (m.instance) { - m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter = new FormalParameter ("this", new DataType ()); m.this_parameter.type_reference.data_type = this; m.scope.add (m.this_parameter.name, m.this_parameter); } diff --git a/vala/valaexpression.vala b/vala/valaexpression.vala index f9ddb173d..01e7dface 100644 --- a/vala/valaexpression.vala +++ b/vala/valaexpression.vala @@ -32,14 +32,14 @@ public abstract class Vala.Expression : CodeNode { * * The semantic analyzer computes this value. */ - public TypeReference static_type { get; set; } + public DataType static_type { get; set; } /* * The static type this expression is expected to have. * * The semantic analyzer computes this value, lambda expressions use it. */ - public TypeReference expected_type { get; set; } + public DataType expected_type { get; set; } /** * The symbol this expression refers to. diff --git a/vala/valafield.vala b/vala/valafield.vala index a89c2ba28..d7df13805 100644 --- a/vala/valafield.vala +++ b/vala/valafield.vala @@ -30,7 +30,7 @@ public class Vala.Field : Member, Invokable, Lockable { /** * The data type of this field. */ - public TypeReference! type_reference { get; set; } + public DataType! type_reference { get; set; } /** * Specifies the expression to be used to initialize this field. @@ -72,7 +72,7 @@ public class Vala.Field : Member, Invokable, Lockable { * @param source reference to source code * @return newly created field */ - public Field (construct string! name, construct TypeReference! type_reference, construct Expression initializer, construct SourceReference source_reference = null) { + public Field (construct string! name, construct DataType! type_reference, construct Expression initializer, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { @@ -152,7 +152,7 @@ public class Vala.Field : Member, Invokable, Lockable { return cb.get_parameters (); } - public TypeReference get_return_type () { + public DataType get_return_type () { if (!is_invokable ()) { return null; } diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala index 5e2ba1192..e834a7845 100644 --- a/vala/valaforeachstatement.vala +++ b/vala/valaforeachstatement.vala @@ -30,7 +30,7 @@ public class Vala.ForeachStatement : Block { /** * Specifies the element type. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * Specifies the element variable name. @@ -90,7 +90,7 @@ public class Vala.ForeachStatement : Block { * @param source reference to source code * @return newly created foreach statement */ - public ForeachStatement (construct TypeReference! type_reference, construct string! variable_name, construct Expression! collection, construct Block body, construct SourceReference source_reference) { + public ForeachStatement (construct DataType! type_reference, construct string! variable_name, construct Expression! collection, construct Block body, construct SourceReference source_reference) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala index 375ba21a4..d055961f2 100644 --- a/vala/valaformalparameter.vala +++ b/vala/valaformalparameter.vala @@ -31,7 +31,7 @@ public class Vala.FormalParameter : Symbol, Invokable { /** * The parameter type. */ - public TypeReference type_reference { get; set; } + public DataType type_reference { get; set; } /** * Specifies whether the methods accepts an indefinite number of @@ -65,7 +65,7 @@ public class Vala.FormalParameter : Symbol, Invokable { * @param source reference to source code * @return newly created formal parameter */ - public FormalParameter (string! _name, TypeReference type, SourceReference source = null) { + public FormalParameter (string! _name, DataType type, SourceReference source = null) { name = _name; type_reference = type; source_reference = source; @@ -107,7 +107,7 @@ public class Vala.FormalParameter : Symbol, Invokable { return cb.get_parameters (); } - public TypeReference get_return_type () { + public DataType get_return_type () { if (!is_invokable ()) { return null; } diff --git a/vala/valainterface.vala b/vala/valainterface.vala index ea3b23e44..2287c08ab 100644 --- a/vala/valainterface.vala +++ b/vala/valainterface.vala @@ -37,7 +37,7 @@ public class Vala.Interface : Typesymbol { private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> (); - private Gee.List<TypeReference> prerequisites = new ArrayList<TypeReference> (); + private Gee.List<DataType> prerequisites = new ArrayList<DataType> (); private Gee.List<Method> methods = new ArrayList<Method> (); private Gee.List<Field> fields = new ArrayList<Field> (); @@ -85,7 +85,7 @@ public class Vala.Interface : Typesymbol { * * @param type an interface or class reference */ - public void add_prerequisite (TypeReference! type) { + public void add_prerequisite (DataType! type) { prerequisites.add (type); } @@ -95,7 +95,7 @@ public class Vala.Interface : Typesymbol { * * @param type an interface or class reference */ - public void prepend_prerequisite (TypeReference! type) { + public void prepend_prerequisite (DataType! type) { prerequisites.insert (0, type); } @@ -104,8 +104,8 @@ public class Vala.Interface : Typesymbol { * * @return list of base types */ - public Collection<TypeReference> get_prerequisites () { - return new ReadOnlyCollection<TypeReference> (prerequisites); + public Collection<DataType> get_prerequisites () { + return new ReadOnlyCollection<DataType> (prerequisites); } /** @@ -121,7 +121,7 @@ public class Vala.Interface : Typesymbol { return; } if (m.instance) { - m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter = new FormalParameter ("this", new DataType ()); m.this_parameter.type_reference.data_type = this; m.scope.add (m.this_parameter.name, m.this_parameter); } @@ -249,7 +249,7 @@ public class Vala.Interface : Typesymbol { } public override void accept_children (CodeVisitor! visitor) { - foreach (TypeReference type in prerequisites) { + foreach (DataType type in prerequisites) { type.accept (visitor); } @@ -295,7 +295,7 @@ public class Vala.Interface : Typesymbol { return true; } - foreach (TypeReference prerequisite in prerequisites) { + foreach (DataType prerequisite in prerequisites) { if (prerequisite.data_type != null && prerequisite.data_type.is_subtype_of (t)) { return true; } diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala index 60e436284..eadad2882 100644 --- a/vala/valainterfacewriter.vala +++ b/vala/valainterfacewriter.vala @@ -160,7 +160,7 @@ public class Vala.InterfaceWriter : CodeVisitor { write_string (" : "); bool first = true; - foreach (TypeReference base_type in base_types) { + foreach (DataType base_type in base_types) { if (!first) { write_string (", "); } else { @@ -261,7 +261,7 @@ public class Vala.InterfaceWriter : CodeVisitor { write_string (" : "); bool first = true; - foreach (TypeReference prerequisite in prerequisites) { + foreach (DataType prerequisite in prerequisites) { if (!first) { write_string (", "); } else { @@ -374,12 +374,12 @@ public class Vala.InterfaceWriter : CodeVisitor { write_newline (); } - private void write_error_domains (Collection<TypeReference> error_domains) { + private void write_error_domains (Collection<DataType> error_domains) { if (error_domains.size > 0) { write_string (" throws "); bool first = true; - foreach (TypeReference type in error_domains) { + foreach (DataType type in error_domains) { if (!first) { write_string (", "); } else { @@ -654,7 +654,7 @@ public class Vala.InterfaceWriter : CodeVisitor { write_string (s); } - private void write_type (TypeReference! type) { + private void write_type (DataType! type) { if (type.data_type != null) { write_string (type.data_type.get_full_name ()); } else { @@ -665,7 +665,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (!(type.data_type is Array) && type_args.size > 0) { write_string ("<"); bool first = true; - foreach (TypeReference type_arg in type_args) { + foreach (DataType type_arg in type_args) { if (!first) { write_string (","); } else { diff --git a/vala/valainvokable.vala b/vala/valainvokable.vala index 22676cefc..eef37f08b 100644 --- a/vala/valainvokable.vala +++ b/vala/valainvokable.vala @@ -39,7 +39,7 @@ public interface Vala.Invokable : Symbol { * * @return return type */ - public abstract TypeReference get_return_type (); + public abstract DataType get_return_type (); /** * Returns copy of the list of invocation parameters. diff --git a/vala/valaliteral.vala b/vala/valaliteral.vala index bc5df2edf..2a766b28f 100644 --- a/vala/valaliteral.vala +++ b/vala/valaliteral.vala @@ -29,5 +29,5 @@ public abstract class Vala.Literal : CodeNode { /** * Specifies the type of this literal. */ - public TypeReference static_type { get; set; } + public DataType static_type { get; set; } } diff --git a/vala/valalocalvariabledeclaration.vala b/vala/valalocalvariabledeclaration.vala index 6853aa089..55a6525b3 100644 --- a/vala/valalocalvariabledeclaration.vala +++ b/vala/valalocalvariabledeclaration.vala @@ -30,7 +30,7 @@ public class Vala.LocalVariableDeclaration : CodeNode { /** * The type of the local variable. */ - public TypeReference type_reference { get; set; } + public DataType type_reference { get; set; } private Gee.List<VariableDeclarator> variable_declarators = new ArrayList<VariableDeclarator> (); @@ -41,7 +41,7 @@ public class Vala.LocalVariableDeclaration : CodeNode { * @param source_reference reference to source code * @return newly created local variable declaration */ - public LocalVariableDeclaration (construct TypeReference type_reference, construct SourceReference source_reference) { + public LocalVariableDeclaration (construct DataType type_reference, construct SourceReference source_reference) { } /** diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala index f1adead40..4e3c59889 100644 --- a/vala/valamemberaccess.vala +++ b/vala/valamemberaccess.vala @@ -59,7 +59,7 @@ public class Vala.MemberAccess : Expression { public bool creation_member { get; set; } private Expression _inner; - private Gee.List<TypeReference> type_argument_list = new ArrayList<TypeReference> (); + private Gee.List<DataType> type_argument_list = new ArrayList<DataType> (); /** * Creates a new member access expression. @@ -80,7 +80,7 @@ public class Vala.MemberAccess : Expression { * * @param arg a type reference */ - public void add_type_argument (TypeReference! arg) { + public void add_type_argument (DataType! arg) { type_argument_list.add (arg); } @@ -89,8 +89,8 @@ public class Vala.MemberAccess : Expression { * * @return type argument list */ - public Collection<TypeReference> get_type_arguments () { - return new ReadOnlyCollection<TypeReference> (type_argument_list); + public Collection<DataType> get_type_arguments () { + return new ReadOnlyCollection<DataType> (type_argument_list); } public override void accept (CodeVisitor! visitor) { @@ -98,7 +98,7 @@ public class Vala.MemberAccess : Expression { inner.accept (visitor); } - foreach (TypeReference type_arg in type_argument_list) { + foreach (DataType type_arg in type_argument_list) { type_arg.accept (visitor); } diff --git a/vala/valamethod.vala b/vala/valamethod.vala index c0eb4b4f5..b1704943a 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -33,7 +33,7 @@ public class Vala.Method : Member, Invokable { /** * The return type of this method. */ - public TypeReference return_type { get; set; } + public DataType return_type { get; set; } public Block body { get; set; } @@ -163,7 +163,7 @@ public class Vala.Method : Member, Invokable { private string _vfunc_name; private string _sentinel; private bool _no_array_length; - private Gee.List<TypeReference> error_domains = new ArrayList<TypeReference> (); + private Gee.List<DataType> error_domains = new ArrayList<DataType> (); /** * Creates a new method. @@ -173,7 +173,7 @@ public class Vala.Method : Member, Invokable { * @param source reference to source code * @return newly created method */ - public Method (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { + public Method (construct string name, construct DataType return_type, construct SourceReference source_reference = null) { } /** @@ -196,7 +196,7 @@ public class Vala.Method : Member, Invokable { return new ReadOnlyCollection<FormalParameter> (parameters); } - public TypeReference get_return_type () { + public DataType get_return_type () { return return_type; } @@ -217,7 +217,7 @@ public class Vala.Method : Member, Invokable { param.accept (visitor); } - foreach (TypeReference error_domain in error_domains) { + foreach (DataType error_domain in error_domains) { error_domain.accept (visitor); } @@ -345,8 +345,8 @@ public class Vala.Method : Member, Invokable { return false; } - Iterator<TypeReference> method_error_domains_it = m2.get_error_domains ().iterator (); - foreach (TypeReference error_domain in error_domains) { + Iterator<DataType> method_error_domains_it = m2.get_error_domains ().iterator (); + foreach (DataType error_domain in error_domains) { /* method may not have less error domains */ if (!method_error_domains_it.next ()) { return false; @@ -365,7 +365,7 @@ public class Vala.Method : Member, Invokable { * * @param error_domain an error domain */ - public void add_error_domain (TypeReference! error_domain) { + public void add_error_domain (DataType! error_domain) { error_domains.add (error_domain); } @@ -374,7 +374,7 @@ public class Vala.Method : Member, Invokable { * * @return list of error domains */ - public Collection<TypeReference> get_error_domains () { - return new ReadOnlyCollection<TypeReference> (error_domains); + public Collection<DataType> get_error_domains () { + return new ReadOnlyCollection<DataType> (error_domains); } } diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala index f821c20d5..1dc3af5e1 100644 --- a/vala/valaobjectcreationexpression.vala +++ b/vala/valaobjectcreationexpression.vala @@ -30,7 +30,7 @@ public class Vala.ObjectCreationExpression : Expression { /** * The object type to create. */ - public TypeReference type_reference { get; set; } + public DataType type_reference { get; set; } /** * The construction method to use. May be null to indicate that diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index 444c9c6a4..69aeef3bd 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -29,7 +29,7 @@ public class Vala.Property : Member, Lockable { /** * The property type. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * The get accessor of this property if available. @@ -107,7 +107,7 @@ public class Vala.Property : Member, Lockable { * @param source reference to source code * @return newly created property */ - public Property (string! _name, TypeReference! type, PropertyAccessor _get_accessor, PropertyAccessor _set_accessor, SourceReference source) { + public Property (string! _name, DataType! type, PropertyAccessor _get_accessor, PropertyAccessor _set_accessor, SourceReference source) { name = _name; type_reference = type; get_accessor = _get_accessor; diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index e4bd3de41..64eaefb3d 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -38,19 +38,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Symbol root_symbol; Symbol current_symbol; SourceFile current_source_file; - TypeReference current_return_type; + DataType current_return_type; Class current_class; Struct current_struct; Collection<NamespaceReference> current_using_directives; - TypeReference bool_type; - TypeReference string_type; - TypeReference int_type; - TypeReference uint_type; - TypeReference ulong_type; - TypeReference unichar_type; - TypeReference type_type; + DataType bool_type; + DataType string_type; + DataType int_type; + DataType uint_type; + DataType ulong_type; + DataType unichar_type; + DataType type_type; Typesymbol pointer_type; Typesymbol object_type; Typesymbol initially_unowned_type; @@ -84,24 +84,24 @@ public class Vala.SemanticAnalyzer : CodeVisitor { root_symbol = context.root; - bool_type = new TypeReference (); + bool_type = new DataType (); bool_type.data_type = (Typesymbol) root_symbol.scope.lookup ("bool"); - string_type = new TypeReference (); + string_type = new DataType (); string_type.data_type = (Typesymbol) root_symbol.scope.lookup ("string"); pointer_type = (Typesymbol) root_symbol.scope.lookup ("pointer"); - int_type = new TypeReference (); + int_type = new DataType (); int_type.data_type = (Typesymbol) root_symbol.scope.lookup ("int"); - uint_type = new TypeReference (); + uint_type = new DataType (); uint_type.data_type = (Typesymbol) root_symbol.scope.lookup ("uint"); - ulong_type = new TypeReference (); + ulong_type = new DataType (); ulong_type.data_type = (Typesymbol) root_symbol.scope.lookup ("ulong"); - unichar_type = new TypeReference (); + unichar_type = new DataType (); unichar_type.data_type = (Typesymbol) root_symbol.scope.lookup ("unichar"); // TODO: don't require GLib namespace in semantic analyzer @@ -110,7 +110,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { object_type = (Typesymbol) glib_ns.scope.lookup ("Object"); initially_unowned_type = (Typesymbol) glib_ns.scope.lookup ("InitiallyUnowned"); - type_type = new TypeReference (); + type_type = new DataType (); type_type.data_type = (Typesymbol) glib_ns.scope.lookup ("Type"); glist_type = (Typesymbol) glib_ns.scope.lookup ("List"); @@ -150,7 +150,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_source_file.add_symbol_dependency (cl.base_class, SourceFileDependencyType.HEADER_FULL); } - foreach (TypeReference base_type_reference in cl.get_base_types ()) { + foreach (DataType base_type_reference in cl.get_base_types ()) { current_source_file.add_symbol_dependency (base_type_reference.data_type, SourceFileDependencyType.HEADER_FULL); } @@ -158,7 +158,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { /* gather all prerequisites */ Gee.List<Typesymbol> prerequisites = new ArrayList<Typesymbol> (); - foreach (TypeReference base_type in cl.get_base_types ()) { + foreach (DataType base_type in cl.get_base_types ()) { if (base_type.data_type is Interface) { get_all_prerequisites ((Interface) base_type.data_type, prerequisites); } @@ -191,7 +191,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { /* VAPI classes don't have to specify overridden methods */ if (!cl.source_reference.file.pkg) { /* all abstract symbols defined in base types have to be at least defined (or implemented) also in this type */ - foreach (TypeReference base_type in cl.get_base_types ()) { + foreach (DataType base_type in cl.get_base_types ()) { if (base_type.data_type is Interface) { Interface iface = (Interface) base_type.data_type; @@ -235,7 +235,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } private void get_all_prerequisites (Interface! iface, Collection<Typesymbol> list) { - foreach (TypeReference prereq in iface.get_prerequisites ()) { + foreach (DataType prereq in iface.get_prerequisites ()) { Typesymbol type = prereq.data_type; /* skip on previous errors */ if (type == null) { @@ -255,7 +255,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return true; } - foreach (TypeReference base_type in cl.get_base_types ()) { + foreach (DataType base_type in cl.get_base_types ()) { if (base_type.data_type is Class) { if (class_is_a ((Class) base_type.data_type, t)) { return true; @@ -281,13 +281,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_interface (Interface! iface) { current_symbol = iface; - foreach (TypeReference prerequisite_reference in iface.get_prerequisites ()) { + foreach (DataType prerequisite_reference in iface.get_prerequisites ()) { current_source_file.add_symbol_dependency (prerequisite_reference.data_type, SourceFileDependencyType.HEADER_FULL); } /* check prerequisites */ Class prereq_class; - foreach (TypeReference prereq in iface.get_prerequisites ()) { + foreach (DataType prereq in iface.get_prerequisites ()) { Typesymbol class_or_interface = prereq.data_type; /* skip on previous errors */ if (class_or_interface == null) { @@ -417,7 +417,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { private void find_base_interface_method (Method! m, Class! cl) { // FIXME report error if multiple possible base methods are found - foreach (TypeReference type in cl.get_base_types ()) { + foreach (DataType type in cl.get_base_types ()) { if (type.data_type is Interface) { var sym = type.data_type.scope.lookup (m.name); if (sym is Method) { @@ -438,7 +438,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_creation_method (CreationMethod! m) { - m.return_type = new TypeReference (); + m.return_type = new DataType (); if (m.type_name != null && m.type_name != current_symbol.name) { // type_name is null for constructors generated by GIdlParser @@ -535,7 +535,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { private void find_base_interface_property (Property! prop, Class! cl) { // FIXME report error if multiple possible base properties are found - foreach (TypeReference type in cl.get_base_types ()) { + foreach (DataType type in cl.get_base_types ()) { if (type.data_type is Interface) { var sym = type.data_type.scope.lookup (prop.name); if (sym is Property) { @@ -605,7 +605,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_return_type = acc.prop.type_reference; } else { // void - current_return_type = new TypeReference (); + current_return_type = new DataType (); } if (!acc.source_reference.file.pkg) { @@ -636,7 +636,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_constructor (Constructor! c) { - c.this_parameter = new FormalParameter ("this", new TypeReference ()); + c.this_parameter = new FormalParameter ("this", new DataType ()); c.this_parameter.type_reference.data_type = (Typesymbol) current_symbol; c.scope.add (c.this_parameter.name, c.this_parameter); @@ -938,7 +938,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var collection_type = stmt.collection.static_type.data_type; if (iterable_type != null && collection_type.is_subtype_of (iterable_type)) { stmt.iterator_variable_declarator = new VariableDeclarator ("%s_it".printf (stmt.variable_name)); - stmt.iterator_variable_declarator.type_reference = new TypeReference (); + stmt.iterator_variable_declarator.type_reference = new DataType (); stmt.iterator_variable_declarator.type_reference.data_type = iterator_type; stmt.iterator_variable_declarator.type_reference.takes_ownership = true; stmt.iterator_variable_declarator.type_reference.add_type_argument (stmt.type_reference); @@ -1018,7 +1018,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } clause.variable_declarator = new VariableDeclarator (clause.variable_name); - clause.variable_declarator.type_reference = new TypeReference (); + clause.variable_declarator.type_reference = new DataType (); clause.variable_declarator.type_reference.data_type = gerror_type; clause.body.scope.add (clause.variable_name, clause.variable_declarator); @@ -1175,17 +1175,17 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_character_literal (CharacterLiteral! expr) { - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = (Typesymbol) root_symbol.scope.lookup ("char"); } public override void visit_integer_literal (IntegerLiteral! expr) { - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = (Typesymbol) root_symbol.scope.lookup (expr.get_type_name ()); } public override void visit_real_literal (RealLiteral! expr) { - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = (Typesymbol) root_symbol.scope.lookup (expr.get_type_name ()); } @@ -1195,16 +1195,16 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_null_literal (NullLiteral! expr) { - /* empty TypeReference represents null */ + /* empty DataType represents null */ - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); } public override void visit_literal_expression (LiteralExpression! expr) { expr.static_type = expr.literal.static_type; } - private TypeReference get_static_type_for_symbol (Symbol! sym) { + private DataType get_static_type_for_symbol (Symbol! sym) { if (sym is Field) { var f = (Field) sym; return f.type_reference; @@ -1219,13 +1219,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } else if (sym is FormalParameter) { var p = (FormalParameter) sym; return p.type_reference; - } else if (sym is TypeReference) { - return (TypeReference) sym; + } else if (sym is DataType) { + return (DataType) sym; } else if (sym is VariableDeclarator) { var decl = (VariableDeclarator) sym; return decl.type_reference; } else if (sym is EnumValue) { - var type = new TypeReference (); + var type = new DataType (); type.data_type = (Typesymbol) sym.parent_symbol; return type; } @@ -1242,7 +1242,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var cl = (Class) sym; // first check interfaces without prerequisites // (prerequisites can be assumed to be met already) - foreach (TypeReference base_type in cl.get_base_types ()) { + foreach (DataType base_type in cl.get_base_types ()) { if (base_type.data_type is Interface) { result = base_type.data_type.scope.lookup (name); if (result != null) { @@ -1256,7 +1256,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } else if (sym is Struct) { var st = (Struct) sym; - foreach (TypeReference base_type in st.get_base_types ()) { + foreach (DataType base_type in st.get_base_types ()) { result = symbol_lookup_inherited (base_type.data_type, name); if (result != null) { return result; @@ -1265,7 +1265,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } else if (sym is Interface) { var iface = (Interface) sym; // first check interface prerequisites recursively - foreach (TypeReference prerequisite in iface.get_prerequisites ()) { + foreach (DataType prerequisite in iface.get_prerequisites ()) { if (prerequisite.data_type is Interface) { result = symbol_lookup_inherited (prerequisite.data_type, name); if (result != null) { @@ -1274,7 +1274,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } // then check class prerequisite recursively - foreach (TypeReference prerequisite in iface.get_prerequisites ()) { + foreach (DataType prerequisite in iface.get_prerequisites ()) { if (prerequisite.data_type is Class) { result = symbol_lookup_inherited (prerequisite.data_type, name); if (result != null) { @@ -1445,7 +1445,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_source_file.add_symbol_dependency (expr.symbol_reference, SourceFileDependencyType.SOURCE); } - private bool is_type_compatible (TypeReference! expression_type, TypeReference! expected_type) { + private bool is_type_compatible (DataType! expression_type, DataType! expected_type) { /* only null is compatible to null */ if (expected_type.data_type == null && expected_type.type_parameter == null) { return (expression_type.data_type == null && expected_type.type_parameter == null); @@ -1580,7 +1580,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { arg.accept (this); } - TypeReference ret_type; + DataType ret_type; if (msym is Invokable) { var m = (Invokable) msym; @@ -1713,11 +1713,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return true; } - public static TypeReference get_actual_type (TypeReference derived_instance_type, Symbol generic_member, TypeReference generic_type, CodeNode node_reference) { - TypeReference instance_type = derived_instance_type; + public static DataType get_actual_type (DataType derived_instance_type, Symbol generic_member, DataType generic_type, CodeNode node_reference) { + DataType instance_type = derived_instance_type; // trace type arguments back to the datatype where the method has been declared while (instance_type.data_type != generic_member.parent_symbol) { - Collection<TypeReference> base_types = null; + Collection<DataType> base_types = null; if (instance_type.data_type is Class) { var cl = (Class) instance_type.data_type; base_types = cl.get_base_types (); @@ -1729,12 +1729,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { node_reference.error = true; return null; } - foreach (TypeReference base_type in base_types) { + foreach (DataType base_type in base_types) { if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, generic_member.name) != null) { // construct a new type reference for the base type with correctly linked type arguments - var instance_base_type = new TypeReference (); + var instance_base_type = new DataType (); instance_base_type.data_type = base_type.data_type; - foreach (TypeReference type_arg in base_type.get_type_arguments ()) { + foreach (DataType type_arg in base_type.get_type_arguments ()) { if (type_arg.type_parameter != null) { // link to type argument of derived type int param_index = instance_type.data_type.get_type_parameter_index (type_arg.type_parameter.name); @@ -1763,9 +1763,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return null; } - TypeReference actual_type = null; + DataType actual_type = null; if (param_index < instance_type.get_type_arguments ().size) { - actual_type = (TypeReference) instance_type.get_type_arguments ().get (param_index); + actual_type = (DataType) instance_type.get_type_arguments ().get (param_index); } if (actual_type == null) { Report.error (node_reference.source_reference, "internal error: no actual argument found for type parameter %s".printf (generic_type.type_parameter.name)); @@ -1879,11 +1879,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Report.error (expr.source_reference, "Base access invalid without base type %d".printf (current_struct.get_base_types ().size)); return; } - Iterator<TypeReference> base_type_it = current_struct.get_base_types ().iterator (); + Iterator<DataType> base_type_it = current_struct.get_base_types ().iterator (); base_type_it.next (); expr.static_type = base_type_it.get (); } else { - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = current_class.base_class; } @@ -1945,9 +1945,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - expr.type_reference = new TypeReference (); + expr.type_reference = new DataType (); expr.type_reference.data_type = type; - foreach (TypeReference type_arg in type_args) { + foreach (DataType type_arg in type_args) { expr.type_reference.add_type_argument (type_arg); if (type_arg.data_type != null) { @@ -2020,7 +2020,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Report.error (expr.source_reference, "Invalid type for argument 1"); } } - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); } foreach (MemberInitializer init in expr.get_object_initializer ()) { @@ -2035,7 +2035,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Report.error (expr.source_reference, "Access to private member `%s' denied".printf (init.symbol_reference.get_full_name ())); return; } - TypeReference member_type; + DataType member_type; if (init.symbol_reference is Field) { var f = (Field) init.symbol_reference; member_type = f.type_reference; @@ -2064,7 +2064,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.static_type = type_type; } - private bool is_numeric_type (TypeReference! type) { + private bool is_numeric_type (DataType! type) { if (!(type.data_type is Struct)) { return false; } @@ -2073,7 +2073,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return st.is_integer_type () || st.is_floating_type (); } - private bool is_integer_type (TypeReference! type) { + private bool is_integer_type (DataType! type) { if (!(type.data_type is Struct)) { return false; } @@ -2204,7 +2204,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var pointer = (Pointer) expr.inner.static_type.data_type; - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = pointer.referent_type; expr.static_type.takes_ownership = expr.inner.static_type.takes_ownership; } @@ -2224,7 +2224,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - expr.static_type = new TypeReference (); + expr.static_type = new DataType (); expr.static_type.data_type = expr.inner.static_type.data_type.get_pointer (); expr.static_type.takes_ownership = expr.inner.static_type.takes_ownership; } @@ -2253,7 +2253,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.static_type.takes_ownership = false; } - private TypeReference get_arithmetic_result_type (TypeReference! left_type, TypeReference! right_type) { + private DataType get_arithmetic_result_type (DataType! left_type, DataType! right_type) { if (!(left_type.data_type is Struct) || !(right_type.data_type is Struct)) { // at least one operand not struct return null; @@ -2415,7 +2415,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.static_type = bool_type; } - private TypeReference compute_common_base_type (Collection<TypeReference> types, SourceReference source_reference) { + private DataType compute_common_base_type (Collection<DataType> types, SourceReference source_reference) { bool null_found = false; bool class_or_iface_found = false; bool type_param_found = false; @@ -2423,12 +2423,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { bool val_struct_found = false; bool enum_found = false; bool callback_found = false; - TypeReference base_type = null; - TypeReference last_type = null; - foreach (TypeReference type in types) { + DataType base_type = null; + DataType last_type = null; + foreach (DataType type in types) { last_type = type; if (type.error) { - base_type = new TypeReference (); + base_type = new DataType (); base_type.error = true; return base_type; } @@ -2492,13 +2492,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } } else { - base_type = new TypeReference (); + base_type = new DataType (); base_type.error = true; Report.error (type.source_reference, "internal error: unsupported type `%s'".printf (type.to_string ())); return base_type; } if (base_type == null) { - base_type = new TypeReference (); + base_type = new DataType (); base_type.data_type = type.data_type; base_type.type_parameter = type.type_parameter; base_type.non_null = type.non_null; @@ -2535,7 +2535,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } /* FIXME: support memory management */ - Gee.List<TypeReference> types = new ArrayList<TypeReference> (); + Gee.List<DataType> types = new ArrayList<DataType> (); types.add (expr.true_expression.static_type); types.add (expr.false_expression.static_type); expr.static_type = compute_common_base_type (types, expr.source_reference); @@ -2667,7 +2667,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (ma.symbol_reference is Signal) { var sig = (Signal) ma.symbol_reference; - a.right.expected_type = new TypeReference (); + a.right.expected_type = new DataType (); a.right.expected_type.data_type = sig.get_callback (); } else { a.right.expected_type = ma.static_type; diff --git a/vala/valasignal.vala b/vala/valasignal.vala index 4a7152a63..90ce8fcfc 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -30,7 +30,7 @@ public class Vala.Signal : Member, Invokable, Lockable { /** * The return type of handlers of this signal. */ - public TypeReference! return_type { get; set; } + public DataType! return_type { get; set; } /** * Specifies whether this signal has an emitter wrapper function. @@ -52,7 +52,7 @@ public class Vala.Signal : Member, Invokable, Lockable { * @param source reference to source code * @return newly created signal */ - public Signal (construct string! name, construct TypeReference! return_type, construct SourceReference source_reference = null) { + public Signal (construct string! name, construct DataType! return_type, construct SourceReference source_reference = null) { } /** @@ -69,7 +69,7 @@ public class Vala.Signal : Member, Invokable, Lockable { return new ReadOnlyCollection<FormalParameter> (parameters); } - public TypeReference get_return_type () { + public DataType get_return_type () { return return_type; } @@ -87,7 +87,7 @@ public class Vala.Signal : Member, Invokable, Lockable { generated_callback = new Callback (null, return_type); generated_callback.instance = true; - var sender_type = new TypeReference (); + var sender_type = new DataType (); sender_type.data_type = (Typesymbol) parent_symbol; var sender_param = new FormalParameter ("sender", sender_type); generated_callback.add_parameter (sender_param); diff --git a/vala/valasizeofexpression.vala b/vala/valasizeofexpression.vala index 387c604e7..aadbbc215 100644 --- a/vala/valasizeofexpression.vala +++ b/vala/valasizeofexpression.vala @@ -29,7 +29,7 @@ public class Vala.SizeofExpression : Expression { /** * The type whose size to be retrieved. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * Creates a new sizeof expression. @@ -38,7 +38,7 @@ public class Vala.SizeofExpression : Expression { * @param source reference to source code * @return newly created sizeof expression */ - public SizeofExpression (TypeReference! type, SourceReference source) { + public SizeofExpression (DataType! type, SourceReference source) { type_reference = type; source_reference = source; } diff --git a/vala/valastruct.vala b/vala/valastruct.vala index 744ff6fa4..e8ada43f3 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -32,7 +32,7 @@ public class Vala.Struct : Typesymbol { private Gee.List<Field> fields = new ArrayList<Field> (); private Gee.List<Method> methods = new ArrayList<Method> (); - private Gee.List<TypeReference> base_types = new ArrayList<TypeReference> (); + private Gee.List<DataType> base_types = new ArrayList<DataType> (); private string cname; private string const_cname; @@ -114,7 +114,7 @@ public class Vala.Struct : Typesymbol { return_if_fail (m != null); if (m.instance) { - m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter = new FormalParameter ("this", new DataType ()); m.this_parameter.type_reference.data_type = this; m.scope.add (m.this_parameter.name, m.this_parameter); } @@ -145,7 +145,7 @@ public class Vala.Struct : Typesymbol { } public override void accept_children (CodeVisitor! visitor) { - foreach (TypeReference type in base_types) { + foreach (DataType type in base_types) { type.accept (visitor); } @@ -362,7 +362,7 @@ public class Vala.Struct : Typesymbol { * * @param type a class or interface reference */ - public void add_base_type (TypeReference! type) { + public void add_base_type (DataType! type) { base_types.add (type); } @@ -371,8 +371,8 @@ public class Vala.Struct : Typesymbol { * * @return list of base types */ - public Collection<TypeReference> get_base_types () { - return new ReadOnlyCollection<TypeReference> (base_types); + public Collection<DataType> get_base_types () { + return new ReadOnlyCollection<DataType> (base_types); } public override int get_type_parameter_index (string! name) { @@ -393,7 +393,7 @@ public class Vala.Struct : Typesymbol { * instances are passed by value. */ public bool is_simple_type () { - foreach (TypeReference type in base_types) { + foreach (DataType type in base_types) { var st = type.data_type as Struct; if (st != null && st.is_simple_type ()) { return true; diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala index 6b88243ba..e26a5d75e 100644 --- a/vala/valasymbolresolver.vala +++ b/vala/valasymbolresolver.vala @@ -58,7 +58,7 @@ public class Vala.SymbolResolver : CodeVisitor { cl.accept_children (this); - foreach (TypeReference type in cl.get_base_types ()) { + foreach (DataType type in cl.get_base_types ()) { if (type.data_type is Class) { if (cl.base_class != null) { cl.error = true; @@ -90,7 +90,7 @@ public class Vala.SymbolResolver : CodeVisitor { iface.accept_children (this); - foreach (TypeReference type in iface.get_prerequisites ()) { + foreach (DataType type in iface.get_prerequisites ()) { if (type.data_type.is_subtype_of (iface)) { iface.error = true; Report.error (type.source_reference, "Prerequisite cycle (`%s' and `%s')".printf (iface.get_full_name (), type.data_type.get_full_name ())); @@ -180,7 +180,7 @@ public class Vala.SymbolResolver : CodeVisitor { } } - public override void visit_type_reference (TypeReference! type) { + public override void visit_type_reference (DataType! type) { if (type.type_name == null || type.type_name == "void") { // reset transfers_ownership type.transfers_ownership = false; @@ -253,7 +253,7 @@ public class Vala.SymbolResolver : CodeVisitor { Report.error (type.source_reference, "Pointer to `%s' not supported".printf (type.type_name)); return; } - var referent_type = new TypeReference (); + var referent_type = new DataType (); referent_type.data_type = type.data_type; referent_type.pointer_level = type.pointer_level - 1; @@ -268,10 +268,10 @@ public class Vala.SymbolResolver : CodeVisitor { /* check for array */ if (type.array_rank > 0) { - var element_type = new TypeReference (); + var element_type = new DataType (); element_type.data_type = type.data_type; element_type.type_parameter = type.type_parameter; - foreach (TypeReference type_arg in type.get_type_arguments ()) { + foreach (DataType type_arg in type.get_type_arguments ()) { element_type.add_type_argument (type_arg); } type.remove_all_type_arguments (); diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala index 42c646c6d..5f87e1c21 100644 --- a/vala/valatypecheck.vala +++ b/vala/valatypecheck.vala @@ -34,7 +34,7 @@ public class Vala.TypeCheck : Expression { /** * The type to be matched against. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * Creates a new type check expression. @@ -44,7 +44,7 @@ public class Vala.TypeCheck : Expression { * @param source reference to source code * @return newly created type check expression */ - public TypeCheck (Expression! expr, TypeReference! type, SourceReference source) { + public TypeCheck (Expression! expr, DataType! type, SourceReference source) { expression = expr; type_reference = type; source_reference = source; diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala index 1eab644b3..55dcf70ce 100644 --- a/vala/valatypeofexpression.vala +++ b/vala/valatypeofexpression.vala @@ -29,7 +29,7 @@ public class Vala.TypeofExpression : Expression { /** * The type to be retrieved. */ - public TypeReference! type_reference { get; set construct; } + public DataType! type_reference { get; set construct; } /** * Creates a new typeof expression. @@ -38,7 +38,7 @@ public class Vala.TypeofExpression : Expression { * @param source reference to source code * @return newly created typeof expression */ - public TypeofExpression (TypeReference! type, SourceReference source) { + public TypeofExpression (DataType! type, SourceReference source) { type_reference = type; source_reference = source; } diff --git a/vala/valavariabledeclarator.vala b/vala/valavariabledeclarator.vala index 39bafe13a..aa055c51f 100644 --- a/vala/valavariabledeclarator.vala +++ b/vala/valavariabledeclarator.vala @@ -45,7 +45,7 @@ public class Vala.VariableDeclarator : Symbol, Invokable { /** * The variable type. */ - public TypeReference type_reference { get; set; } + public DataType type_reference { get; set; } private Expression _initializer; @@ -85,7 +85,7 @@ public class Vala.VariableDeclarator : Symbol, Invokable { return cb.get_parameters (); } - public TypeReference get_return_type () { + public DataType get_return_type () { if (!is_invokable ()) { return null; } diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index a4c00fe54..817549f3f 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -495,7 +495,7 @@ public class Vala.GIdlParser : CodeVisitor { current_source_file.add_node (cl); } - var parent = new TypeReference (); + var parent = new DataType (); parent.namespace_name = "GLib"; parent.type_name = "Boxed"; cl.add_base_type (parent); @@ -616,22 +616,22 @@ public class Vala.GIdlParser : CodeVisitor { } if (base_class != null) { - var parent = new TypeReference (); + var parent = new DataType (); parse_type_string (parent, base_class); cl.add_base_type (parent); } else if (node.parent != null) { - var parent = new TypeReference (); + var parent = new DataType (); parse_type_string (parent, node.parent); cl.add_base_type (parent); } else { - var parent = new TypeReference (); + var parent = new DataType (); parent.namespace_name = "GLib"; parent.type_name = "Object"; cl.add_base_type (parent); } foreach (string iface_name in node.interfaces) { - var iface = new TypeReference (); + var iface = new DataType (); parse_type_string (iface, iface_name); cl.add_base_type (iface); } @@ -716,7 +716,7 @@ public class Vala.GIdlParser : CodeVisitor { } foreach (string prereq_name in node.prerequisites) { - var prereq = new TypeReference (); + var prereq = new DataType (); parse_type_string (prereq, prereq_name); iface.add_prerequisite (prereq); } @@ -753,8 +753,8 @@ public class Vala.GIdlParser : CodeVisitor { current_data_type = null; } - private TypeReference parse_type (IdlNodeType! type_node) { - var type = new TypeReference (); + private DataType parse_type (IdlNodeType! type_node) { + var type = new DataType (); if (type_node.tag == TypeTag.VOID) { if (type_node.is_pointer) { type.type_name = "pointer"; @@ -911,7 +911,7 @@ public class Vala.GIdlParser : CodeVisitor { return false; } - private void parse_type_string (TypeReference! type, string! n) { + private void parse_type_string (DataType! type, string! n) { var dt = cname_type_map[n]; if (dt != null) { type.namespace_name = dt.parent_symbol.name; @@ -988,7 +988,7 @@ public class Vala.GIdlParser : CodeVisitor { } } - private TypeReference parse_param (IdlNodeParam! param) { + private DataType parse_param (IdlNodeParam! param) { var type = parse_type (param.type); // disable for now as null_ok not yet correctly set @@ -1004,7 +1004,7 @@ public class Vala.GIdlParser : CodeVisitor { return null; } - TypeReference return_type = null; + DataType return_type = null; if (f.result != null) { return_type = parse_param (f.result); } |