2008-05-26 Jürg Billeter <j@bitron.ch>
+ * vala/valaarraytype.vala:
+ * vala/valaclass.vala:
+ * vala/valacreationmethod.vala:
+ * vala/valadatatype.vala:
+ * vala/valadelegate.vala:
+ * vala/valaenum.vala:
+ * vala/valaerrordomain.vala:
+ * vala/valainstancecast.vala:
+ * vala/valaintegertype.vala:
+ * vala/valainterface.vala:
+ * vala/valainterfacewriter.vala:
+ * vala/valaobjecttype.vala:
+ * vala/valaobjecttypesymbol.vala:
+ * vala/valasemanticanalyzer.vala:
+ * vala/valasourcefile.vala:
+ * vala/valastruct.vala:
+ * vala/valasymbolresolver.vala:
+ * vala/valatypeparameter.vala:
+ * vala/valatypesymbol.vala:
+ * vala/valavaluetype.vala:
+ * gobject/valaccodeassignmentbinding.vala:
+ * gobject/valaccodeclassbinding.vala:
+ * gobject/valaccodeelementaccessbinding.vala:
+ * gobject/valaccodegenerator.vala:
+ * gobject/valaccodegeneratorsignal.vala:
+ * gobject/valaccodeinterfacebinding.vala:
+ * gobject/valaccodeinvocationexpressionbinding.vala:
+ * gobject/valaccodememberaccessbinding.vala:
+ * gobject/valaccodemethodbinding.vala:
+ * gobject/valaccodeobjecttypesymbolbinding.vala:
+ * gobject/valaccodetypesymbolbinding.vala:
+ * gobject/valaclassregisterfunction.vala:
+ * gobject/valagidlwriter.vala:
+ * gobject/valainterfaceregisterfunction.vala:
+ * gobject/valatyperegisterfunction.vala:
+ * vapigen/valagidlparser.vala:
+
+ s/Typesymbol/TypeSymbol/
+
+2008-05-26 Jürg Billeter <j@bitron.ch>
+
* vapi/libxml-2.0.vapi: use [Compact] attribute
2008-05-26 Jürg Billeter <j@bitron.ch>
codegen.temp_vars.insert (0, temp_decl);
var parse_call = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_parse_name"));
parse_call.add_argument (sig.get_canonical_cconstant ());
- var decl_type = (Typesymbol) sig.parent_symbol;
+ var decl_type = (TypeSymbol) sig.parent_symbol;
parse_call.add_argument (new CCodeIdentifier (decl_type.get_type_id ()));
parse_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (temp_decl.name)));
parse_call.add_argument (new CCodeConstant ("NULL"));
cparam_map.set (codegen.get_param_pos (param.cparameter_position), (CCodeFormalParameter) param.ccodenode);
}
} else {
- cparam = new CCodeFormalParameter ("sender", ((Typesymbol) sig.parent_symbol).get_cname () + "*");
+ cparam = new CCodeFormalParameter ("sender", ((TypeSymbol) sig.parent_symbol).get_cname () + "*");
cparam_map.set (codegen.get_param_pos (0), cparam);
foreach (FormalParameter param in sig.get_parameters()) {
// ensure that C code node has been generated
if (container_type != null && codegen.list_type != null && codegen.map_type != null &&
(container_type.is_subtype_of (codegen.list_type) || container_type.is_subtype_of (codegen.map_type))) {
// lookup symbol in interface instead of class as implemented interface methods are not in VAPI files
- Typesymbol collection_iface = null;
+ TypeSymbol collection_iface = null;
if (container_type.is_subtype_of (codegen.list_type)) {
collection_iface = codegen.list_type;
} else if (container_type.is_subtype_of (codegen.map_type)) {
using GLib;
-public class Vala.CCodeClassBinding : CCodeObjectTypesymbolBinding {
+public class Vala.CCodeClassBinding : CCodeObjectTypeSymbolBinding {
public Class cl { get; set; }
public CCodeClassBinding (CCodeGenerator codegen, Class cl) {
codenode = ccall;
} else if (container_type != null && codegen.list_type != null && codegen.map_type != null &&
(container_type.is_subtype_of (codegen.list_type) || container_type.is_subtype_of (codegen.map_type))) {
- Typesymbol collection_iface = null;
+ TypeSymbol collection_iface = null;
if (container_type.is_subtype_of (codegen.list_type)) {
collection_iface = codegen.list_type;
} else if (container_type.is_subtype_of (codegen.map_type)) {
public Symbol root_symbol;
public Symbol current_symbol;
- public Typesymbol current_type_symbol;
+ public TypeSymbol current_type_symbol;
public Class current_class;
public Method current_method;
public DataType current_return_type;
public DataType string_type;
public DataType float_type;
public DataType double_type;
- public Typesymbol gtype_type;
- public Typesymbol gobject_type;
+ public TypeSymbol gtype_type;
+ public TypeSymbol gobject_type;
public ErrorType gerror_type;
public Class glist_type;
public Class gslist_type;
- public Typesymbol gstringbuilder_type;
- public Typesymbol garray_type;
+ public TypeSymbol gstringbuilder_type;
+ public TypeSymbol garray_type;
public DataType gquark_type;
public Struct mutex_type;
- public Typesymbol type_module_type;
+ public TypeSymbol type_module_type;
public Interface iterable_type;
public Interface iterator_type;
public Interface list_type;
public Interface map_type;
- public Typesymbol dbus_object_type;
+ public TypeSymbol dbus_object_type;
public Method substring_method;
root_symbol = context.root;
- bool_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("bool"));
- char_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("char"));
- unichar_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("unichar"));
- short_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("short"));
- ushort_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("ushort"));
- int_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
- uint_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint"));
- long_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("long"));
- ulong_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("ulong"));
- int8_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int8"));
- uint8_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint8"));
- int64_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int64"));
- uint64_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint64"));
- float_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("float"));
- double_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("double"));
+ bool_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("bool"));
+ char_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("char"));
+ unichar_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("unichar"));
+ short_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("short"));
+ ushort_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("ushort"));
+ int_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int"));
+ uint_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("uint"));
+ long_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("long"));
+ ulong_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("ulong"));
+ int8_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int8"));
+ uint8_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("uint8"));
+ int64_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int64"));
+ uint64_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("uint64"));
+ float_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("float"));
+ double_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("double"));
string_type = new ObjectType ((Class) root_symbol.scope.lookup ("string"));
substring_method = (Method) string_type.data_type.scope.lookup ("substring");
var glib_ns = root_symbol.scope.lookup ("GLib");
- gtype_type = (Typesymbol) glib_ns.scope.lookup ("Type");
- gobject_type = (Typesymbol) glib_ns.scope.lookup ("Object");
+ gtype_type = (TypeSymbol) glib_ns.scope.lookup ("Type");
+ gobject_type = (TypeSymbol) glib_ns.scope.lookup ("Object");
gerror_type = new ErrorType (null, null);
glist_type = (Class) glib_ns.scope.lookup ("List");
gslist_type = (Class) glib_ns.scope.lookup ("SList");
- gstringbuilder_type = (Typesymbol) glib_ns.scope.lookup ("StringBuilder");
- garray_type = (Typesymbol) glib_ns.scope.lookup ("Array");
+ gstringbuilder_type = (TypeSymbol) glib_ns.scope.lookup ("StringBuilder");
+ garray_type = (TypeSymbol) glib_ns.scope.lookup ("Array");
- gquark_type = new ValueType ((Typesymbol) glib_ns.scope.lookup ("Quark"));
+ gquark_type = new ValueType ((TypeSymbol) glib_ns.scope.lookup ("Quark"));
mutex_type = (Struct) glib_ns.scope.lookup ("StaticRecMutex");
- type_module_type = (Typesymbol) glib_ns.scope.lookup ("TypeModule");
+ type_module_type = (TypeSymbol) glib_ns.scope.lookup ("TypeModule");
if (context.module_init_method != null) {
module_init_fragment = new CCodeFragment ();
var dbus_ns = root_symbol.scope.lookup ("DBus");
if (dbus_ns != null) {
- dbus_object_type = (Typesymbol) dbus_ns.scope.lookup ("Object");
+ dbus_object_type = (TypeSymbol) dbus_ns.scope.lookup ("Object");
}
/* we're only interested in non-pkg source files */
current_return_type = null;
- var t = (Typesymbol) prop.parent_symbol;
+ var t = (TypeSymbol) prop.parent_symbol;
ReferenceType this_type;
if (t is Class) {
if (inner_node == null) {
l = new CCodeIdentifier ("self");
} else if (stmt.resource.symbol_reference.parent_symbol != current_type_symbol) {
- l = new InstanceCast ((CCodeExpression) inner_node.ccodenode, (Typesymbol) stmt.resource.symbol_reference.parent_symbol);
+ l = new InstanceCast ((CCodeExpression) inner_node.ccodenode, (TypeSymbol) stmt.resource.symbol_reference.parent_symbol);
} else {
l = (CCodeExpression) inner_node.ccodenode;
}
var ma = (MemberAccess) array_expr;
CCodeExpression pub_inst = null;
- Typesymbol base_type = null;
+ TypeSymbol base_type = null;
CCodeExpression length_expr = null;
if (ma.inner == null) {
if (current_type_symbol != null) {
/* base type is available if this is a type method */
- base_type = (Typesymbol) current_type_symbol;
+ base_type = (TypeSymbol) current_type_symbol;
}
} else {
pub_inst = (CCodeExpression) ma.inner.ccodenode;
if (field.binding == MemberBinding.INSTANCE) {
var length_cname = get_array_length_cname (field.name, dim);
var instance_expression_type = get_data_type_for_symbol (base_type);
- var instance_target_type = get_data_type_for_symbol ((Typesymbol) field.parent_symbol);
+ var instance_target_type = get_data_type_for_symbol ((TypeSymbol) field.parent_symbol);
CCodeExpression typed_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type);
CCodeExpression inst;
} else {
inst = typed_inst;
}
- if (((Typesymbol) field.parent_symbol).is_reference_type ()) {
+ if (((TypeSymbol) field.parent_symbol).is_reference_type ()) {
length_expr = new CCodeMemberAccess.pointer (inst, length_cname);
} else {
length_expr = new CCodeMemberAccess (inst, length_cname);
var ma = (MemberAccess) delegate_expr;
CCodeExpression pub_inst = null;
- Typesymbol base_type = null;
+ TypeSymbol base_type = null;
CCodeExpression target_expr = null;
if (ma.inner == null) {
if (current_type_symbol != null) {
/* base type is available if this is a type method */
- base_type = (Typesymbol) current_type_symbol;
+ base_type = (TypeSymbol) current_type_symbol;
}
} else {
pub_inst = (CCodeExpression) ma.inner.ccodenode;
if (field.binding == MemberBinding.INSTANCE) {
var instance_expression_type = get_data_type_for_symbol (base_type);
- var instance_target_type = get_data_type_for_symbol ((Typesymbol) field.parent_symbol);
+ var instance_target_type = get_data_type_for_symbol ((TypeSymbol) field.parent_symbol);
CCodeExpression typed_inst = get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type);
CCodeExpression inst;
} else {
inst = typed_inst;
}
- if (((Typesymbol) field.parent_symbol).is_reference_type ()) {
+ if (((TypeSymbol) field.parent_symbol).is_reference_type ()) {
target_expr = new CCodeMemberAccess.pointer (inst, target_cname);
} else {
target_expr = new CCodeMemberAccess (inst, target_cname);
foreach (MemberInitializer init in expr.get_object_initializer ()) {
if (init.symbol_reference is Field) {
var f = (Field) init.symbol_reference;
- var instance_target_type = get_data_type_for_symbol ((Typesymbol) f.parent_symbol);
+ var instance_target_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
var typed_inst = get_implicit_cast_expression (instance, expr.type_reference, instance_target_type);
CCodeExpression lhs;
if (expr.type_reference.data_type is Struct) {
visit_expression (expr);
}
- static CCodeFunctionCall create_type_check (CCodeNode ccodenode, Typesymbol type) {
+ static CCodeFunctionCall create_type_check (CCodeNode ccodenode, TypeSymbol type) {
var ccheck = new CCodeFunctionCall (new CCodeIdentifier (type.get_upper_case_cname ("IS_")));
ccheck.add_argument ((CCodeExpression) ccodenode);
return ccheck;
} else if (prop.base_interface_property != null) {
base_property = prop.base_interface_property;
}
- var base_property_type = (Typesymbol) base_property.parent_symbol;
+ var base_property_type = (TypeSymbol) base_property.parent_symbol;
set_func = "%s_set_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name);
if (prop is DynamicProperty) {
set_func = dynamic_property_binding ((DynamicProperty) prop).get_setter_cname ();
instance_expression_type = ma.inner.value_type;
}
- var instance_target_type = get_data_type_for_symbol ((Typesymbol) base_property.parent_symbol);
+ var instance_target_type = get_data_type_for_symbol ((TypeSymbol) base_property.parent_symbol);
instance = get_implicit_cast_expression (instance, instance_expression_type, instance_target_type);
ccall.add_argument (instance);
return wrappers.add (wrapper_name);
}
- public static DataType get_data_type_for_symbol (Typesymbol sym) {
+ public static DataType get_data_type_for_symbol (TypeSymbol sym) {
DataType type = null;
if (sym is Class) {
return null;
}
- private CCodeStatement create_property_type_check_statement (Property prop, bool check_return_type, Typesymbol t, bool non_null, string var_name) {
+ private CCodeStatement create_property_type_check_statement (Property prop, bool check_return_type, TypeSymbol t, bool non_null, string var_name) {
if (check_return_type) {
return create_type_check_statement (prop, prop.property_type, t, non_null, var_name);
} else {
}
}
- public CCodeStatement? create_type_check_statement (CodeNode method_node, DataType ret_type, Typesymbol t, bool non_null, string var_name) {
+ public CCodeStatement? create_type_check_statement (CodeNode method_node, DataType ret_type, TypeSymbol t, bool non_null, string var_name) {
var ccheck = new CCodeFunctionCall ();
if ((t is Class && ((Class) t).is_subtype_of (gobject_type)) || t is Interface) {
public override void visit_signal (Signal sig) {
// parent_symbol may be null for late bound signals
if (sig.parent_symbol != null) {
- var dt = sig.parent_symbol as Typesymbol;
+ var dt = sig.parent_symbol as TypeSymbol;
if (!dt.is_subtype_of (gobject_type)) {
sig.error = true;
Report.error (sig.source_reference, "Only classes and interfaces deriving from GLib.Object support signals. `%s' does not derive from GLib.Object.".printf (dt.get_full_name ()));
using GLib;
-public class Vala.CCodeInterfaceBinding : CCodeObjectTypesymbolBinding {
+public class Vala.CCodeInterfaceBinding : CCodeObjectTypeSymbolBinding {
public Interface iface { get; set; }
public CCodeInterfaceBinding (CCodeGenerator codegen, Interface iface) {
// parent_symbol may be null for late bound methods
if (base_method.parent_symbol != null) {
- var instance_target_type = codegen.get_data_type_for_symbol ((Typesymbol) base_method.parent_symbol);
+ var instance_target_type = codegen.get_data_type_for_symbol ((TypeSymbol) base_method.parent_symbol);
instance = codegen.get_implicit_cast_expression (instance, instance_expression_type, instance_target_type);
}
var f = (Field) expr.symbol_reference;
if (f.binding == MemberBinding.INSTANCE) {
var instance_expression_type = base_type;
- var instance_target_type = codegen.get_data_type_for_symbol ((Typesymbol) f.parent_symbol);
+ var instance_target_type = codegen.get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
CCodeExpression typed_inst = codegen.get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type);
var cl = instance_target_type.data_type as Class;
} else if (prop.base_interface_property != null) {
base_property = prop.base_interface_property;
}
- var base_property_type = (Typesymbol) base_property.parent_symbol;
+ var base_property_type = (TypeSymbol) base_property.parent_symbol;
string getter_cname;
if (prop is DynamicProperty) {
getter_cname = codegen.dynamic_property_binding ((DynamicProperty) prop).get_getter_cname ();
}
} else if (expr.symbol_reference is Signal) {
var sig = (Signal) expr.symbol_reference;
- var cl = (Typesymbol) sig.parent_symbol;
+ var cl = (TypeSymbol) sig.parent_symbol;
if (sig.has_emitter) {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_%s".printf (cl.get_lower_case_cname (null), sig.name)));
CCodeFunctionDeclarator vdeclarator = null;
if (m.binding == MemberBinding.INSTANCE || (m.parent_symbol is Struct && m is CreationMethod)) {
- Typesymbol parent_type = find_parent_type (m);
+ TypeSymbol parent_type = find_parent_type (m);
DataType this_type;
if (parent_type is Class) {
this_type = new ObjectType ((Class) parent_type);
codegen.type_struct.add_declaration (vdecl);
}
} else if (m.binding == MemberBinding.CLASS) {
- Typesymbol parent_type = find_parent_type (m);
+ TypeSymbol parent_type = find_parent_type (m);
DataType this_type;
this_type = new ClassType ((Class) parent_type);
var class_param = new CCodeFormalParameter ("klass", this_type.get_cname ());
}
}
- private CCodeStatement create_method_type_check_statement (Method m, DataType return_type, Typesymbol t, bool non_null, string var_name) {
+ private CCodeStatement create_method_type_check_statement (Method m, DataType return_type, TypeSymbol t, bool non_null, string var_name) {
return codegen.create_type_check_statement (m, return_type, t, non_null, var_name);
}
return new CCodeExpressionStatement (cassert);
}
- private Typesymbol? find_parent_type (Symbol sym) {
+ private TypeSymbol? find_parent_type (Symbol sym) {
while (sym != null) {
- if (sym is Typesymbol) {
- return (Typesymbol) sym;
+ if (sym is TypeSymbol) {
+ return (TypeSymbol) sym;
}
sym = sym.parent_symbol;
}
using GLib;
-public abstract class Vala.CCodeObjectTypesymbolBinding : Vala.CCodeTypesymbolBinding {
+public abstract class Vala.CCodeObjectTypeSymbolBinding : Vala.CCodeTypeSymbolBinding {
bool is_dbus_visible (CodeNode node) {
var dbus_attribute = node.get_attribute ("DBus");
return true;
}
- public CCodeFragment register_dbus_info (ObjectTypesymbol bindable) {
+ public CCodeFragment register_dbus_info (ObjectTypeSymbol bindable) {
CCodeFragment fragment = new CCodeFragment ();
return fragment;
}
- string generate_dbus_wrapper (Method m, ObjectTypesymbol bindable) {
+ string generate_dbus_wrapper (Method m, ObjectTypeSymbol bindable) {
string wrapper_name = "_dbus_%s".printf (m.get_cname ());
// declaration
using GLib;
-public abstract class Vala.CCodeTypesymbolBinding : CCodeBinding {
+public abstract class Vala.CCodeTypeSymbolBinding : CCodeBinding {
public CCodeFunctionCall get_param_spec (Property prop) {
var cspec = new CCodeFunctionCall ();
cspec.add_argument (prop.get_canonical_cconstant ());
return cspec;
}
- public CCodeFunctionCall get_signal_creation (Signal sig, Typesymbol type) {
+ public CCodeFunctionCall get_signal_creation (Signal sig, TypeSymbol type) {
var csignew = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_new"));
csignew.add_argument (new CCodeConstant ("\"%s\"".printf (sig.name)));
csignew.add_argument (new CCodeIdentifier (type.get_upper_case_cname ("TYPE_")));
class_reference = cl;
}
- public override Typesymbol get_type_declaration () {
+ public override TypeSymbol get_type_declaration () {
return class_reference;
}
int indent;
- private Typesymbol gobject_type;
+ private TypeSymbol gobject_type;
/**
* Writes the public interface of the specified code context into the
var root_symbol = context.root;
var glib_ns = root_symbol.scope.lookup ("GLib");
- gobject_type = (Typesymbol) glib_ns.scope.lookup ("Object");
+ gobject_type = (TypeSymbol) glib_ns.scope.lookup ("Object");
stream = FileStream.open (filename, "w");
DataType instance_type = null;
if (m.binding == MemberBinding.INSTANCE) {
- instance_type = CCodeGenerator.get_data_type_for_symbol ((Typesymbol) m.parent_symbol);
+ instance_type = CCodeGenerator.get_data_type_for_symbol ((TypeSymbol) m.parent_symbol);
}
write_params (m.get_parameters (), instance_type);
write_params (m.get_parameters ());
- write_return_type (CCodeGenerator.get_data_type_for_symbol ((Typesymbol) m.parent_symbol));
+ write_return_type (CCodeGenerator.get_data_type_for_symbol ((TypeSymbol) m.parent_symbol));
indent--;
write_indent ();
interface_reference = iface;
}
- public override Typesymbol get_type_declaration () {
+ public override TypeSymbol get_type_declaration () {
return interface_reference;
}
*
* @return type to be registered
*/
- public abstract Typesymbol get_type_declaration ();
+ public abstract TypeSymbol get_type_declaration ();
/**
* Returns the name of the type struct in C code.
var root_symbol = source_reference.file.context.root;
if (rank > 1) {
// length is an int[] containing the dimensions of the array, starting at 0
- ValueType integer = new ValueType((Typesymbol) root_symbol.scope.lookup("int"));
+ ValueType integer = new ValueType((TypeSymbol) root_symbol.scope.lookup("int"));
length_field.field_type = new ArrayType (integer, 1, source_reference);
} else {
- length_field.field_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
+ length_field.field_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int"));
}
}
resize_method.set_cname ("g_renew");
var root_symbol = source_reference.file.context.root;
- var int_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
+ var int_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int"));
resize_method.add_parameter (new FormalParameter ("length", int_type));
move_method.set_cname ("_vala_array_move");
var root_symbol = source_reference.file.context.root;
- var int_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
+ var int_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int"));
move_method.add_parameter (new FormalParameter ("src", int_type));
move_method.add_parameter (new FormalParameter ("dest", int_type));
/**
* Represents a class declaration in the source code.
*/
-public class Vala.Class : ObjectTypesymbol {
+public class Vala.Class : ObjectTypeSymbol {
/**
* Specifies the base class.
*/
this.free_function = name;
}
- public override bool is_subtype_of (Typesymbol t) {
+ public override bool is_subtype_of (TypeSymbol t) {
if (this == t) {
return true;
}
}
public override string get_default_cname () {
- var parent = parent_symbol as Typesymbol;
+ var parent = parent_symbol as TypeSymbol;
string infix = "new";
if (parent is Struct) {
/**
* The referred data type.
*/
- public weak Typesymbol data_type { get; set; }
+ public weak TypeSymbol data_type { get; set; }
/**
* The referred generic type parameter.
*/
public string get_const_cname () {
string ptr;
- Typesymbol t;
+ TypeSymbol t;
// FIXME: workaround to make constant arrays possible
if (this is ArrayType) {
t = ((ArrayType) this).element_type.data_type;
/**
* Represents a function callback type.
*/
-public class Vala.Delegate : Typesymbol {
+public class Vala.Delegate : TypeSymbol {
/**
* The return type of this callback.
*/
/**
* Represents an enum declaration in the source code.
*/
-public class Vala.Enum : Typesymbol {
+public class Vala.Enum : TypeSymbol {
/**
* Specifies whether this is a flags enum.
*/
/**
* Represents an error domain declaration in the source code.
*/
-public class Vala.ErrorDomain : Typesymbol {
+public class Vala.ErrorDomain : TypeSymbol {
private Gee.List<ErrorCode> codes = new ArrayList<ErrorCode> ();
private Gee.List<Method> methods = new ArrayList<Method> ();
private string cname;
/**
* The target type.
*/
- public weak Typesymbol type_reference { get; set construct; }
+ public weak TypeSymbol type_reference { get; set construct; }
/**
* The expression to be cast.
* @param type the target type
* @return newly created instance cast expression
*/
- public InstanceCast (CCodeExpression expr, Typesymbol type) {
+ public InstanceCast (CCodeExpression expr, TypeSymbol type) {
inner = expr;
type_reference = type;
}
public class Vala.IntegerType : ValueType {
public IntegerLiteral literal { get; set; }
- public IntegerType (Typesymbol type_symbol) {
+ public IntegerType (TypeSymbol type_symbol) {
this.type_symbol = type_symbol;
data_type = type_symbol;
}
/**
* Represents a class declaration in the source code.
*/
-public class Vala.Interface : ObjectTypesymbol {
+public class Vala.Interface : ObjectTypeSymbol {
/**
* Specifies whether this interface is static. Static interfaces are not
* available at run-time. They can be implemented by structs.
return "g_object_unref";
}
- public override bool is_subtype_of (Typesymbol t) {
+ public override bool is_subtype_of (TypeSymbol t) {
if (this == t) {
return true;
}
write_accessibility (m);
if (m is CreationMethod) {
- var datatype = (Typesymbol) m.parent_symbol;
+ var datatype = (TypeSymbol) m.parent_symbol;
write_identifier (datatype.name);
write_identifier (m.name.offset (".new".len ()));
write_string (" ");
/**
* The referred class or interface.
*/
- public weak ObjectTypesymbol type_symbol { get; set; }
+ public weak ObjectTypeSymbol type_symbol { get; set; }
- public ObjectType (ObjectTypesymbol type_symbol) {
+ public ObjectType (ObjectTypeSymbol type_symbol) {
this.type_symbol = type_symbol;
data_type = type_symbol;
}
* be defined in Vala source code or imported from an external library with a
* Vala API file.
*/
-public abstract class Vala.ObjectTypesymbol : Typesymbol {
+public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
public abstract Collection<Method> get_methods ();
public abstract Collection<Signal> get_signals ();
public abstract Collection<Property> get_properties ();
DataType unichar_type;
DataType type_type;
Class object_type;
- Typesymbol initially_unowned_type;
+ TypeSymbol initially_unowned_type;
DataType glist_type;
DataType gslist_type;
Class gerror_type;
root_symbol = context.root;
- bool_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("bool"));
+ bool_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("bool"));
string_type = new ObjectType ((Class) root_symbol.scope.lookup ("string"));
- int_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
- uint_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint"));
- ulong_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("ulong"));
- size_t_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("size_t"));
- unichar_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("unichar"));
+ int_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("int"));
+ uint_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("uint"));
+ ulong_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("ulong"));
+ size_t_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("size_t"));
+ unichar_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("unichar"));
// TODO: don't require GLib namespace in semantic analyzer
var glib_ns = root_symbol.scope.lookup ("GLib");
if (glib_ns != null) {
object_type = (Class) glib_ns.scope.lookup ("Object");
- initially_unowned_type = (Typesymbol) glib_ns.scope.lookup ("InitiallyUnowned");
+ initially_unowned_type = (TypeSymbol) glib_ns.scope.lookup ("InitiallyUnowned");
- type_type = new ValueType ((Typesymbol) glib_ns.scope.lookup ("Type"));
+ type_type = new ValueType ((TypeSymbol) glib_ns.scope.lookup ("Type"));
glist_type = new ObjectType ((Class) glib_ns.scope.lookup ("List"));
gslist_type = new ObjectType ((Class) glib_ns.scope.lookup ("SList"));
cl.accept_children (this);
/* gather all prerequisites */
- Gee.List<Typesymbol> prerequisites = new ArrayList<Typesymbol> ();
+ Gee.List<TypeSymbol> prerequisites = new ArrayList<TypeSymbol> ();
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);
}
/* check whether all prerequisites are met */
Gee.List<string> missing_prereqs = new ArrayList<string> ();
- foreach (Typesymbol prereq in prerequisites) {
+ foreach (TypeSymbol prereq in prerequisites) {
if (!class_is_a (cl, prereq)) {
missing_prereqs.insert (0, prereq.get_full_name ());
}
current_class = null;
}
- private void get_all_prerequisites (Interface iface, Collection<Typesymbol> list) {
+ private void get_all_prerequisites (Interface iface, Collection<TypeSymbol> list) {
foreach (DataType prereq in iface.get_prerequisites ()) {
- Typesymbol type = prereq.data_type;
+ TypeSymbol type = prereq.data_type;
/* skip on previous errors */
if (type == null) {
continue;
}
}
- private bool class_is_a (Class cl, Typesymbol t) {
+ private bool class_is_a (Class cl, TypeSymbol t) {
if (cl == t) {
return true;
}
/* check prerequisites */
Class prereq_class;
foreach (DataType prereq in iface.get_prerequisites ()) {
- Typesymbol class_or_interface = prereq.data_type;
+ TypeSymbol class_or_interface = prereq.data_type;
/* skip on previous errors */
if (class_or_interface == null) {
iface.error = true;
}
public override void visit_character_literal (CharacterLiteral expr) {
- expr.value_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("char"));
+ expr.value_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup ("char"));
}
public override void visit_integer_literal (IntegerLiteral expr) {
- var int_type = new IntegerType ((Typesymbol) root_symbol.scope.lookup (expr.get_type_name ()));
+ var int_type = new IntegerType ((TypeSymbol) root_symbol.scope.lookup (expr.get_type_name ()));
int_type.literal = expr;
expr.value_type = int_type;
}
public override void visit_real_literal (RealLiteral expr) {
- expr.value_type = new ValueType ((Typesymbol) root_symbol.scope.lookup (expr.get_type_name ()));
+ expr.value_type = new ValueType ((TypeSymbol) root_symbol.scope.lookup (expr.get_type_name ()));
}
public override void visit_string_literal (StringLiteral expr) {
}
return type;
} else if (sym is EnumValue) {
- return new ValueType ((Typesymbol) sym.parent_symbol);
+ return new ValueType ((TypeSymbol) sym.parent_symbol);
} else if (sym is Method) {
return new MethodType ((Method) sym);
} else if (sym is Signal) {
if (expr.inner is MemberAccess || expr.inner is BaseAccess) {
base_symbol = expr.inner.symbol_reference;
- if (expr.creation_member && base_symbol is Typesymbol) {
+ if (expr.creation_member && base_symbol is TypeSymbol) {
// check for named creation method
expr.symbol_reference = base_symbol.scope.lookup (".new." + expr.member_name);
}
- if (expr.symbol_reference == null && (base_symbol is Namespace || base_symbol is Typesymbol)) {
+ if (expr.symbol_reference == null && (base_symbol is Namespace || base_symbol is TypeSymbol)) {
expr.symbol_reference = base_symbol.scope.lookup (expr.member_name);
if (expr.inner is BaseAccess) {
// inner expression is base access
expr.member_name.accept (this);
}
- Typesymbol type = null;
+ TypeSymbol type = null;
if (expr.type_reference == null) {
if (expr.member_name == null) {
}
if (type_sym is Class) {
- type = (Typesymbol) type_sym;
+ type = (TypeSymbol) type_sym;
expr.type_reference = new ObjectType ((Class) type);
} else if (type_sym is Struct) {
- type = (Typesymbol) type_sym;
+ type = (TypeSymbol) type_sym;
expr.type_reference = new ValueType (type);
} else if (type_sym is ErrorDomain) {
expr.type_reference = new ErrorType ((ErrorDomain) type_sym, expr.source_reference);
Symbol s;
- if (sym is Typesymbol ||
+ if (sym is TypeSymbol ||
sym is Method ||
sym is Field ||
sym is Property ||
return;
}
- if (dep_type == SourceFileDependencyType.HEADER_FULL || (s is Typesymbol && !((Typesymbol)s).is_reference_type ())) {
+ if (dep_type == SourceFileDependencyType.HEADER_FULL || (s is TypeSymbol && !((TypeSymbol)s).is_reference_type ())) {
foreach (string fn in s.get_cheader_filenames ()) {
header_internal_includes.add (fn);
}
/**
* Represents a struct declaration in the source code.
*/
-public class Vala.Struct : Typesymbol {
+public class Vala.Struct : TypeSymbol {
private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
private Gee.List<Constant> constants = new ArrayList<Constant> ();
private Gee.List<Field> fields = new ArrayList<Field> ();
if (sym is TypeParameter) {
type = new TypeParameterType ((TypeParameter) sym);
- } else if (sym is Typesymbol) {
+ } else if (sym is TypeSymbol) {
if (sym is Delegate) {
type = new DelegateType ((Delegate) sym);
} else if (sym is Class) {
/**
* The generic type declaring this parameter.
*/
- public weak Typesymbol type;
+ public weak TypeSymbol type;
/* holds the array types of this type; each rank is a separate one */
private Map<int,Array> array_types;
-/* valatype.vala
+/* valatypesymbol.vala
*
* Copyright (C) 2006-2008 Jürg Billeter, Raffaele Sandrini
*
* Represents a runtime data type. This data type may be defined in Vala source
* code or imported from an external library with a Vala API file.
*/
-public abstract class Vala.Typesymbol : Symbol {
+public abstract class Vala.TypeSymbol : Symbol {
private Gee.List<string> cheader_filenames = new ArrayList<string> ();
/* holds the array types of this type; each rank is a separate one */
* @param t a data type
* @return true if t is a supertype of this data type, false otherwise
*/
- public virtual bool is_subtype_of (Typesymbol t) {
+ public virtual bool is_subtype_of (TypeSymbol t) {
return (this == t);
}
/**
* The referred struct or enum.
*/
- public weak Typesymbol type_symbol { get; set; }
+ public weak TypeSymbol type_symbol { get; set; }
- public ValueType (Typesymbol type_symbol) {
+ public ValueType (TypeSymbol type_symbol) {
this.type_symbol = type_symbol;
data_type = type_symbol;
}
private SourceReference current_source_reference;
private Namespace current_namespace;
- private Typesymbol current_data_type;
+ private TypeSymbol current_data_type;
private Map<string,string> codenode_attributes_map;
private Map<PatternSpec*,string> codenode_attributes_patterns;
private Gee.Set<string> current_type_symbol_set;
- private Map<string,Typesymbol> cname_type_map;
+ private Map<string,TypeSymbol> cname_type_map;
/**
* Parse all source files in the specified code context and build a
* @param context a code context
*/
public void parse (CodeContext context) {
- cname_type_map = new HashMap<string,Typesymbol> (str_hash, str_equal);
+ cname_type_map = new HashMap<string,TypeSymbol> (str_hash, str_equal);
this.context = context;
context.accept (this);
visit_type (d);
}
- private void visit_type (Typesymbol t) {
+ private void visit_type (TypeSymbol t) {
if (!cname_type_map.contains (t.get_cname ())) {
cname_type_map[t.get_cname ()] = t;
}
}
}
- private Typesymbol? parse_enum (IdlNodeEnum en_node) {
+ private TypeSymbol? parse_enum (IdlNodeEnum en_node) {
weak IdlNode node = (IdlNode) en_node;
var en = new Enum (node.name, current_source_reference);