vala r1447 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1447 - in trunk: . gobject vala
- Date: Mon, 26 May 2008 09:03:59 +0000 (UTC)
Author: juergbi
Date: Mon May 26 09:03:59 2008
New Revision: 1447
URL: http://svn.gnome.org/viewvc/vala?rev=1447&view=rev
Log:
2008-05-26 Juerg Billeter <j bitron ch>
* vala/Makefile.am:
* vala/valaclass.vala:
* vala/valainterface.vala:
* vala/valaobjecttype.vala:
* vala/valasemanticanalyzer.vala:
* vala/valasignal.vala:
* vala/valasymbolresolver.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodememberaccessbinding.vala:
* gobject/valaccodemethodbinding.vala:
* gobject/valagidlwriter.vala:
Replace ClassInstanceType and InterfaceInstanceType by ObjectType
Added:
trunk/vala/valaobjecttype.vala
- copied, changed from r1446, /trunk/vala/valaclassinstancetype.vala
Removed:
trunk/vala/valaclassinstancetype.vala
trunk/vala/valainterfaceinstancetype.vala
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/gobject/valaccodememberaccessbinding.vala
trunk/gobject/valaccodemethodbinding.vala
trunk/gobject/valagidlwriter.vala
trunk/vala/Makefile.am
trunk/vala/valaclass.vala
trunk/vala/valainterface.vala
trunk/vala/valasemanticanalyzer.vala
trunk/vala/valasignal.vala
trunk/vala/valasymbolresolver.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Mon May 26 09:03:59 2008
@@ -221,7 +221,7 @@
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 ClassInstanceType ((Class) root_symbol.scope.lookup ("string"));
+ 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");
@@ -771,9 +771,9 @@
ReferenceType this_type;
if (t is Class) {
- this_type = new ClassInstanceType ((Class) t);
+ this_type = new ObjectType ((Class) t);
} else {
- this_type = new InterfaceInstanceType ((Interface) t);
+ this_type = new ObjectType ((Interface) t);
}
var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ());
var value_type = prop.property_type.copy ();
@@ -1987,7 +1987,7 @@
cfor.add_iterator (new CCodeAssignment (new CCodeIdentifier (it_name), new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier (it_name), new CCodeConstant ("1"))));
cblock.add_statement (cfor);
}
- } else if (stmt.collection.value_type.compatible (new ClassInstanceType (glist_type)) || stmt.collection.value_type.compatible (new ClassInstanceType (gslist_type))) {
+ } else if (stmt.collection.value_type.compatible (new ObjectType (glist_type)) || stmt.collection.value_type.compatible (new ObjectType (gslist_type))) {
var it_name = "%s_it".printf (stmt.variable_name);
var citdecl = new CCodeDeclaration (collection_type.get_cname ());
@@ -2039,7 +2039,7 @@
cfor.add_iterator (new CCodeAssignment (new CCodeIdentifier (it_name), new CCodeMemberAccess.pointer (new CCodeIdentifier (it_name), "next")));
cblock.add_statement (cfor);
- } else if (iterable_type != null && stmt.collection.value_type.compatible (new InterfaceInstanceType (iterable_type))) {
+ } else if (iterable_type != null && stmt.collection.value_type.compatible (new ObjectType (iterable_type))) {
var it_name = "%s_it".printf (stmt.variable_name);
var citdecl = new CCodeDeclaration (iterator_type.get_cname () + "*");
@@ -3715,9 +3715,9 @@
DataType type = null;
if (sym is Class) {
- type = new ClassInstanceType ((Class) sym);
+ type = new ObjectType ((Class) sym);
} else if (sym is Interface) {
- type = new InterfaceInstanceType ((Interface) sym);
+ type = new ObjectType ((Interface) sym);
} else if (sym is Struct) {
type = new ValueType ((Struct) sym);
} else if (sym is Enum) {
Modified: trunk/gobject/valaccodememberaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessbinding.vala (original)
+++ trunk/gobject/valaccodememberaccessbinding.vala Mon May 26 09:03:59 2008
@@ -254,9 +254,9 @@
if (codegen.current_type_symbol != null) {
/* base type is available if this is a type method */
if (codegen.current_type_symbol is Class) {
- base_type = new ClassInstanceType ((Class) codegen.current_type_symbol);
+ base_type = new ObjectType ((Class) codegen.current_type_symbol);
} else if (codegen.current_type_symbol is Interface) {
- base_type = new InterfaceInstanceType ((Interface) codegen.current_type_symbol);
+ base_type = new ObjectType ((Interface) codegen.current_type_symbol);
} else {
base_type = new ValueType (codegen.current_type_symbol);
pub_inst = new CCodeIdentifier ("(*self)");
Modified: trunk/gobject/valaccodemethodbinding.vala
==============================================================================
--- trunk/gobject/valaccodemethodbinding.vala (original)
+++ trunk/gobject/valaccodemethodbinding.vala Mon May 26 09:03:59 2008
@@ -70,7 +70,7 @@
}
if (cl != null) {
- creturn_type = new ClassInstanceType (cl);
+ creturn_type = new ObjectType (cl);
}
}
@@ -142,19 +142,19 @@
Typesymbol parent_type = find_parent_type (m);
DataType this_type;
if (parent_type is Class) {
- this_type = new ClassInstanceType ((Class) parent_type);
+ this_type = new ObjectType ((Class) parent_type);
} else if (parent_type is Interface) {
- this_type = new InterfaceInstanceType ((Interface) parent_type);
+ this_type = new ObjectType ((Interface) parent_type);
} else {
this_type = new ValueType (parent_type);
}
CCodeFormalParameter instance_param = null;
if (m.base_interface_method != null && !m.is_abstract && !m.is_virtual) {
- var base_type = new InterfaceInstanceType ((Interface) m.base_interface_method.parent_symbol);
+ var base_type = new ObjectType ((Interface) m.base_interface_method.parent_symbol);
instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
} else if (m.overrides) {
- var base_type = new ClassInstanceType ((Class) m.base_method.parent_symbol);
+ var base_type = new ObjectType ((Class) m.base_method.parent_symbol);
instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
} else {
if (m.parent_symbol is Struct && !((Struct) m.parent_symbol).is_simple_type ()) {
@@ -228,12 +228,12 @@
ReferenceType base_expression_type;
if (m.overrides) {
base_method = m.base_method;
- base_expression_type = new ClassInstanceType ((Class) base_method.parent_symbol);
+ base_expression_type = new ObjectType ((Class) base_method.parent_symbol);
} else {
base_method = m.base_interface_method;
- base_expression_type = new InterfaceInstanceType ((Interface) base_method.parent_symbol);
+ base_expression_type = new ObjectType ((Interface) base_method.parent_symbol);
}
- var self_target_type = new ClassInstanceType (cl);
+ var self_target_type = new ObjectType (cl);
CCodeExpression cself = codegen.get_implicit_cast_expression (new CCodeIdentifier ("base"), base_expression_type, self_target_type);
var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
@@ -369,9 +369,9 @@
ReferenceType this_type;
if (m.parent_symbol is Class) {
- this_type = new ClassInstanceType ((Class) m.parent_symbol);
+ this_type = new ObjectType ((Class) m.parent_symbol);
} else {
- this_type = new InterfaceInstanceType ((Interface) m.parent_symbol);
+ this_type = new ObjectType ((Interface) m.parent_symbol);
}
cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
Modified: trunk/gobject/valagidlwriter.vala
==============================================================================
--- trunk/gobject/valagidlwriter.vala (original)
+++ trunk/gobject/valagidlwriter.vala Mon May 26 09:03:59 2008
@@ -105,8 +105,8 @@
// write implemented interfaces
bool first = true;
foreach (DataType base_type in cl.get_base_types ()) {
- var iface_type = base_type as InterfaceInstanceType;
- if (iface_type != null) {
+ var object_type = (ObjectType) base_type;
+ if (object_type.type_symbol is Interface) {
if (first) {
write_indent ();
stream.printf ("<implements>\n");
@@ -114,7 +114,7 @@
first = false;
}
write_indent ();
- stream.printf ("<interface name=\"%s\"/>\n", iface_type.interface_symbol.get_full_name ());
+ stream.printf ("<interface name=\"%s\"/>\n", object_type.type_symbol.get_full_name ());
}
}
if (!first) {
@@ -185,14 +185,13 @@
indent++;
foreach (DataType base_type in iface.get_prerequisites ()) {
- var class_type = base_type as ClassInstanceType;
- var iface_type = base_type as InterfaceInstanceType;
- if (class_type != null) {
+ var object_type = (ObjectType) base_type;
+ if (object_type.type_symbol is Class) {
write_indent ();
- stream.printf ("<object name=\"%s\"/>\n", class_type.class_symbol.get_full_name ());
- } else if (iface_type != null) {
+ stream.printf ("<object name=\"%s\"/>\n", object_type.type_symbol.get_full_name ());
+ } else if (object_type.type_symbol is Interface) {
write_indent ();
- stream.printf ("<interface name=\"%s\"/>\n", iface_type.interface_symbol.get_full_name ());
+ stream.printf ("<interface name=\"%s\"/>\n", object_type.type_symbol.get_full_name ());
} else {
assert_not_reached ();
}
Modified: trunk/vala/Makefile.am
==============================================================================
--- trunk/vala/Makefile.am (original)
+++ trunk/vala/Makefile.am Mon May 26 09:03:59 2008
@@ -34,7 +34,6 @@
valacfgbuilder.vala \
valacharacterliteral.vala \
valaclass.vala \
- valaclassinstancetype.vala \
valaclasstype.vala \
valacodebinding.vala \
valacodecontext.vala \
@@ -79,7 +78,6 @@
valaintegerliteral.vala \
valaintegertype.vala \
valainterface.vala \
- valainterfaceinstancetype.vala \
valainterfacetype.vala \
valainterfacewriter.vala \
valainvalidtype.vala \
@@ -102,6 +100,7 @@
valanullliteral.vala \
valanulltype.vala \
valaobjectcreationexpression.vala \
+ valaobjecttype.vala \
valaobjecttypesymbol.vala \
valaparenthesizedexpression.vala \
valaparser.vala \
Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala (original)
+++ trunk/vala/valaclass.vala Mon May 26 09:03:59 2008
@@ -144,7 +144,7 @@
if (_destructor.this_parameter != null) {
_destructor.scope.remove (_destructor.this_parameter.name);
}
- _destructor.this_parameter = new FormalParameter ("this", new ClassInstanceType (this));
+ _destructor.this_parameter = new FormalParameter ("this", new ObjectType (this));
_destructor.scope.add (_destructor.this_parameter.name, _destructor.this_parameter);
}
}
@@ -251,7 +251,7 @@
if (m.this_parameter != null) {
m.scope.remove (m.this_parameter.name);
}
- m.this_parameter = new FormalParameter ("this", new ClassInstanceType (this));
+ m.this_parameter = new FormalParameter ("this", new ObjectType (this));
m.scope.add (m.this_parameter.name, m.this_parameter);
}
if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
@@ -300,7 +300,7 @@
properties.add (prop);
scope.add (prop.name, prop);
- prop.this_parameter = new FormalParameter ("this", new ClassInstanceType (this));
+ prop.this_parameter = new FormalParameter ("this", new ObjectType (this));
prop.scope.add (prop.this_parameter.name, prop.this_parameter);
if (prop.field != null) {
Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala (original)
+++ trunk/vala/valainterface.vala Mon May 26 09:03:59 2008
@@ -128,7 +128,7 @@
return;
}
if (m.binding == MemberBinding.INSTANCE) {
- m.this_parameter = new FormalParameter ("this", new InterfaceInstanceType (this));
+ m.this_parameter = new FormalParameter ("this", new ObjectType (this));
m.scope.add (m.this_parameter.name, m.this_parameter);
}
if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
Copied: trunk/vala/valaobjecttype.vala (from r1446, /trunk/vala/valaclassinstancetype.vala)
==============================================================================
--- /trunk/vala/valaclassinstancetype.vala (original)
+++ trunk/vala/valaobjecttype.vala Mon May 26 09:03:59 2008
@@ -1,4 +1,4 @@
-/* valaclassinstancetype.vala
+/* valaobjecttype.vala
*
* Copyright (C) 2007-2008 JÃrg Billeter
*
@@ -25,19 +25,19 @@
/**
* A class type.
*/
-public class Vala.ClassInstanceType : ReferenceType {
+public class Vala.ObjectType : ReferenceType {
/**
- * The referred class.
+ * The referred class or interface.
*/
- public weak Class class_symbol { get; set; }
+ public weak ObjectTypesymbol type_symbol { get; set; }
- public ClassInstanceType (Class class_symbol) {
- this.class_symbol = class_symbol;
- data_type = class_symbol;
+ public ObjectType (ObjectTypesymbol type_symbol) {
+ this.type_symbol = type_symbol;
+ data_type = type_symbol;
}
public override DataType copy () {
- var result = new ClassInstanceType (class_symbol);
+ var result = new ObjectType (type_symbol);
result.source_reference = source_reference;
result.value_owned = value_owned;
result.nullable = nullable;
@@ -52,6 +52,6 @@
}
public override string? get_cname () {
- return "%s*".printf (class_symbol.get_cname (!value_owned));
+ return "%s*".printf (type_symbol.get_cname (!value_owned));
}
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Mon May 26 09:03:59 2008
@@ -73,7 +73,7 @@
root_symbol = context.root;
bool_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("bool"));
- string_type = new ClassInstanceType ((Class) root_symbol.scope.lookup ("string"));
+ 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"));
@@ -89,15 +89,15 @@
type_type = new ValueType ((Typesymbol) glib_ns.scope.lookup ("Type"));
- glist_type = new ClassInstanceType ((Class) glib_ns.scope.lookup ("List"));
- gslist_type = new ClassInstanceType ((Class) glib_ns.scope.lookup ("SList"));
+ glist_type = new ObjectType ((Class) glib_ns.scope.lookup ("List"));
+ gslist_type = new ObjectType ((Class) glib_ns.scope.lookup ("SList"));
gerror_type = (Class) glib_ns.scope.lookup ("Error");
}
var gee_ns = root_symbol.scope.lookup ("Gee");
if (gee_ns != null) {
- iterable_type = new InterfaceInstanceType ((Interface) gee_ns.scope.lookup ("Iterable"));
+ iterable_type = new ObjectType ((Interface) gee_ns.scope.lookup ("Iterable"));
iterator_type = (Interface) gee_ns.scope.lookup ("Iterator");
list_type = (Interface) gee_ns.scope.lookup ("List");
map_type = (Interface) gee_ns.scope.lookup ("Map");
@@ -778,7 +778,7 @@
}
public override void visit_constructor (Constructor c) {
- c.this_parameter = new FormalParameter ("this", new ClassInstanceType (current_class));
+ c.this_parameter = new FormalParameter ("this", new ObjectType (current_class));
c.scope.add (c.this_parameter.name, c.this_parameter);
c.owner = current_symbol.scope;
@@ -1150,7 +1150,7 @@
need_type_check = true;
}
} else if (iterable_type != null && collection_type.compatible (iterable_type)) {
- var foreach_iterator_type = new InterfaceInstanceType (iterator_type);
+ var foreach_iterator_type = new ObjectType (iterator_type);
foreach_iterator_type.value_owned = true;
foreach_iterator_type.add_type_argument (stmt.type_reference);
stmt.iterator_variable = new LocalVariable (foreach_iterator_type, "%s_it".printf (stmt.variable_name));
@@ -2077,9 +2077,9 @@
// construct a new type reference for the base type with correctly linked type arguments
ReferenceType instance_base_type;
if (base_type.data_type is Class) {
- instance_base_type = new ClassInstanceType ((Class) base_type.data_type);
+ instance_base_type = new ObjectType ((Class) base_type.data_type);
} else {
- instance_base_type = new InterfaceInstanceType ((Interface) base_type.data_type);
+ instance_base_type = new ObjectType ((Interface) base_type.data_type);
}
foreach (DataType type_arg in base_type.get_type_arguments ()) {
if (type_arg.type_parameter != null) {
@@ -2347,7 +2347,7 @@
Report.error (expr.source_reference, "Base access invalid without base class");
return;
} else {
- expr.value_type = new ClassInstanceType (current_class.base_class);
+ expr.value_type = new ObjectType (current_class.base_class);
}
expr.symbol_reference = expr.value_type.data_type;
@@ -2402,7 +2402,7 @@
if (type_sym is Class) {
type = (Typesymbol) type_sym;
- expr.type_reference = new ClassInstanceType ((Class) type);
+ expr.type_reference = new ObjectType ((Class) type);
} else if (type_sym is Struct) {
type = (Typesymbol) type_sym;
expr.type_reference = new ValueType (type);
@@ -2743,8 +2743,7 @@
return;
}
if (!(expr.inner.value_type is ValueType
- || expr.inner.value_type is ClassInstanceType
- || expr.inner.value_type is InterfaceInstanceType
+ || expr.inner.value_type is ObjectType
|| expr.inner.value_type is PointerType)) {
expr.error = true;
Report.error (expr.source_reference, "Address-of operator not supported for this expression");
Modified: trunk/vala/valasignal.vala
==============================================================================
--- trunk/vala/valasignal.vala (original)
+++ trunk/vala/valasignal.vala Mon May 26 09:03:59 2008
@@ -98,9 +98,9 @@
ReferenceType sender_type;
if (parent_symbol is Class) {
- sender_type = new ClassInstanceType ((Class) parent_symbol);
+ sender_type = new ObjectType ((Class) parent_symbol);
} else {
- sender_type = new InterfaceInstanceType ((Interface) parent_symbol);
+ sender_type = new ObjectType ((Interface) parent_symbol);
}
var sender_param = new FormalParameter ("sender", sender_type);
generated_delegate.add_parameter (sender_param);
Modified: trunk/vala/valasymbolresolver.vala
==============================================================================
--- trunk/vala/valasymbolresolver.vala (original)
+++ trunk/vala/valasymbolresolver.vala Mon May 26 09:03:59 2008
@@ -256,10 +256,10 @@
if (cl.is_error_base) {
type = new ErrorType (null, unresolved_type.source_reference);
} else {
- type = new ClassInstanceType (cl);
+ type = new ObjectType (cl);
}
} else if (sym is Interface) {
- type = new InterfaceInstanceType ((Interface) sym);
+ type = new ObjectType ((Interface) sym);
} else if (sym is Struct) {
type = new ValueType ((Struct) sym);
} else if (sym is Enum) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]