Commit 475ca45f authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

don't implicitly derive from GLib.Object in preparation for a more

2007-08-30  Juerg Billeter  <j@bitron.ch>

	* vala/valasymbolresolver.vala, vala/valasemanticanalyzer.vala,
	  gobject/valacodegenerator.vala, gobject/valacodegeneratorclass.vala:
	  don't implicitly derive from GLib.Object in preparation for a more
	  consistent type system

	* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
	  gee/iterable.vala, gee/iterator.vala, gee/list.vala, gee/map.vala,
	  gee/readonlycollection.vala, gee/readonlylist.vala,
	  gee/readonlymap.vala, gee/readonlyset.vala,
	  vala/valabindingprovider.vala, vala/valacodecontext.vala,
	  vala/valacodenode.vala, vala/valacodevisitor.vala,
	  vala/valascope.vala, vala/valasourcefile.vala,
	  vala/valasourcefilecycle.vala, vala/valasourcereference.vala,
	  ccode/valaccodenode.vala, ccode/valaccodewriter.vala,
	  gobject/valaccodecompiler.vala, gobject/valadbusbindingprovider.vala,
	  gobject/valatyperegisterfunction.vala, compiler/valacompiler.vala,
	  tests/, vapigen/valavapigen.vala: derive all classes from GLib.Object

svn path=/trunk/; revision=536
parent 791f4912
2007-08-30 Jürg Billeter <j@bitron.ch>
* vala/valasymbolresolver.vala, vala/valasemanticanalyzer.vala,
gobject/valacodegenerator.vala, gobject/valacodegeneratorclass.vala:
don't implicitly derive from GLib.Object in preparation for a more
consistent type system
* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
gee/iterable.vala, gee/iterator.vala, gee/list.vala, gee/map.vala,
gee/readonlycollection.vala, gee/readonlylist.vala,
gee/readonlymap.vala, gee/readonlyset.vala,
vala/valabindingprovider.vala, vala/valacodecontext.vala,
vala/valacodenode.vala, vala/valacodevisitor.vala,
vala/valascope.vala, vala/valasourcefile.vala,
vala/valasourcefilecycle.vala, vala/valasourcereference.vala,
ccode/valaccodenode.vala, ccode/valaccodewriter.vala,
gobject/valaccodecompiler.vala, gobject/valadbusbindingprovider.vala,
gobject/valatyperegisterfunction.vala, compiler/valacompiler.vala,
tests/, vapigen/valavapigen.vala: derive all classes from GLib.Object
2007-08-30 Jürg Billeter <j@bitron.ch> 2007-08-30 Jürg Billeter <j@bitron.ch>
* vapi/libnotify.deps: add missing file * vapi/libnotify.deps: add missing file
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a node in the C code tree. * Represents a node in the C code tree.
*/ */
public abstract class Vala.CCodeNode { public abstract class Vala.CCodeNode : Object {
/** /**
* The source file name and line number to be presumed for this code * The source file name and line number to be presumed for this code
* node. * node.
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a writer to write C source files. * Represents a writer to write C source files.
*/ */
public class Vala.CCodeWriter { public class Vala.CCodeWriter : Object {
/** /**
* Specifies the file to be written. * Specifies the file to be written.
*/ */
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
using GLib; using GLib;
class Vala.Compiler { class Vala.Compiler : Object {
static string directory; static string directory;
static bool version; static bool version;
[NoArrayLength ()] [NoArrayLength ()]
......
...@@ -27,7 +27,7 @@ using GLib; ...@@ -27,7 +27,7 @@ using GLib;
/** /**
* Arrays of arbitrary elements which grow automatically as elements are added. * Arrays of arbitrary elements which grow automatically as elements are added.
*/ */
public class Gee.ArrayList<G> : Iterable<G>, Collection<G>, List<G> { public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public int size { public int size {
get { return _size; } get { return _size; }
} }
...@@ -147,7 +147,7 @@ public class Gee.ArrayList<G> : Iterable<G>, Collection<G>, List<G> { ...@@ -147,7 +147,7 @@ public class Gee.ArrayList<G> : Iterable<G>, Collection<G>, List<G> {
_items.resize (value); _items.resize (value);
} }
private class Iterator<G> : Gee.Iterator<G> { private class Iterator<G> : Object, Gee.Iterator<G> {
public ArrayList<G> list { public ArrayList<G> list {
set { set {
_list = value; _list = value;
......
...@@ -27,7 +27,7 @@ using GLib; ...@@ -27,7 +27,7 @@ using GLib;
/** /**
* Hashtable implementation of the Map interface. * Hashtable implementation of the Map interface.
*/ */
public class Gee.HashMap<K,V> : Map<K,V> { public class Gee.HashMap<K,V> : Object, Map<K,V> {
public int size { public int size {
get { return _nnodes; } get { return _nnodes; }
} }
...@@ -179,7 +179,7 @@ public class Gee.HashMap<K,V> : Map<K,V> { ...@@ -179,7 +179,7 @@ public class Gee.HashMap<K,V> : Map<K,V> {
} }
} }
private class KeySet<K,V> : Iterable<K>, Collection<K>, Set<K> { private class KeySet<K,V> : Object, Iterable<K>, Collection<K>, Set<K> {
public HashMap<K,V> map { public HashMap<K,V> map {
set { _map = value; } set { _map = value; }
} }
...@@ -216,7 +216,7 @@ public class Gee.HashMap<K,V> : Map<K,V> { ...@@ -216,7 +216,7 @@ public class Gee.HashMap<K,V> : Map<K,V> {
} }
} }
private class KeyIterator<K,V> : Iterator<K> { private class KeyIterator<K,V> : Object, Iterator<K> {
public HashMap<K,V> map { public HashMap<K,V> map {
set { set {
_map = value; _map = value;
...@@ -252,7 +252,7 @@ public class Gee.HashMap<K,V> : Map<K,V> { ...@@ -252,7 +252,7 @@ public class Gee.HashMap<K,V> : Map<K,V> {
} }
} }
private class ValueCollection<K,V> : Iterable<V>, Collection<V> { private class ValueCollection<K,V> : Object, Iterable<V>, Collection<V> {
public HashMap<K,V> map { public HashMap<K,V> map {
set { _map = value; } set { _map = value; }
} }
...@@ -293,7 +293,7 @@ public class Gee.HashMap<K,V> : Map<K,V> { ...@@ -293,7 +293,7 @@ public class Gee.HashMap<K,V> : Map<K,V> {
} }
} }
private class ValueIterator<K,V> : Iterator<V> { private class ValueIterator<K,V> : Object, Iterator<V> {
public HashMap<K,V> map { public HashMap<K,V> map {
set { set {
_map = value; _map = value;
......
...@@ -27,7 +27,7 @@ using GLib; ...@@ -27,7 +27,7 @@ using GLib;
/** /**
* Hashtable implementation of the Set interface. * Hashtable implementation of the Set interface.
*/ */
public class Gee.HashSet<G> : Iterable<G>, Collection<G>, Set<G> { public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public int size { public int size {
get { return _nnodes; } get { return _nnodes; }
} }
...@@ -158,7 +158,7 @@ public class Gee.HashSet<G> : Iterable<G>, Collection<G>, Set<G> { ...@@ -158,7 +158,7 @@ public class Gee.HashSet<G> : Iterable<G>, Collection<G>, Set<G> {
} }
} }
private class Iterator<G> : Gee.Iterator<G> { private class Iterator<G> : Object, Gee.Iterator<G> {
public HashSet<G> set { public HashSet<G> set {
set { set {
_set = value; _set = value;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Implemented by classes that support a simple iteration over instances of the * Implemented by classes that support a simple iteration over instances of the
* collection. * collection.
*/ */
public interface Gee.Iterable<G> { public interface Gee.Iterable<G> : GLib.Object {
/** /**
* Returns a Iterator that can be used for simple iteration over a * Returns a Iterator that can be used for simple iteration over a
* collection. * collection.
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Implemented by classes that support a simple iteration over instances of the * Implemented by classes that support a simple iteration over instances of the
* collection. * collection.
*/ */
public interface Gee.Iterator<G> { public interface Gee.Iterator<G> : GLib.Object {
/** /**
* Advances to the next element in the iteration. * Advances to the next element in the iteration.
* *
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/** /**
* Represents a collection of items in a well-defined order. * Represents a collection of items in a well-defined order.
*/ */
public interface Gee.List<G> : GLib.Object, Collection<G> { public interface Gee.List<G> : Collection<G> {
/** /**
* Returns the item at the specified index in this list. * Returns the item at the specified index in this list.
* *
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/** /**
* A map is a generic collection of key/value pairs. * A map is a generic collection of key/value pairs.
*/ */
public interface Gee.Map<K,V> { public interface Gee.Map<K,V> : GLib.Object {
/** /**
* The number of items in this map. * The number of items in this map.
*/ */
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a read-only collection of items. * Represents a read-only collection of items.
*/ */
public class Gee.ReadOnlyCollection<G> : Iterable<G>, Collection<G> { public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
public int size { public int size {
get { return _collection.size; } get { return _collection.size; }
} }
...@@ -69,7 +69,7 @@ public class Gee.ReadOnlyCollection<G> : Iterable<G>, Collection<G> { ...@@ -69,7 +69,7 @@ public class Gee.ReadOnlyCollection<G> : Iterable<G>, Collection<G> {
assert_not_reached (); assert_not_reached ();
} }
private class Iterator<G> : Gee.Iterator<G> { private class Iterator<G> : Object, Gee.Iterator<G> {
public bool next () { public bool next () {
return false; return false;
} }
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a read-only collection of items in a well-defined order. * Represents a read-only collection of items in a well-defined order.
*/ */
public class Gee.ReadOnlyList<G> : Iterable<G>, Collection<G>, List<G> { public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public int size { public int size {
get { return _list.size; } get { return _list.size; }
} }
...@@ -97,7 +97,7 @@ public class Gee.ReadOnlyList<G> : Iterable<G>, Collection<G>, List<G> { ...@@ -97,7 +97,7 @@ public class Gee.ReadOnlyList<G> : Iterable<G>, Collection<G>, List<G> {
assert_not_reached (); assert_not_reached ();
} }
class Iterator<G> : Gee.Iterator<G> { class Iterator<G> : Object, Gee.Iterator<G> {
public bool next () { public bool next () {
return false; return false;
} }
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a read-only collection of key/value pairs. * Represents a read-only collection of key/value pairs.
*/ */
public class Gee.ReadOnlyMap<K,V> : Map<K,V> { public class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
public int size { public int size {
get { return _map.size; } get { return _map.size; }
} }
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Represents a read-only collection of items without duplicates. * Represents a read-only collection of items without duplicates.
*/ */
public class Gee.ReadOnlySet<G> : Iterable<G>, Collection<G>, Set<G> { public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public int size { public int size {
get { return _set.size; } get { return _set.size; }
} }
...@@ -69,7 +69,7 @@ public class Gee.ReadOnlySet<G> : Iterable<G>, Collection<G>, Set<G> { ...@@ -69,7 +69,7 @@ public class Gee.ReadOnlySet<G> : Iterable<G>, Collection<G>, Set<G> {
assert_not_reached (); assert_not_reached ();
} }
private class Iterator<G> : Gee.Iterator<G> { private class Iterator<G> : Object, Gee.Iterator<G> {
public bool next () { public bool next () {
return false; return false;
} }
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* Interface to the C compiler. * Interface to the C compiler.
*/ */
public class Vala.CCodeCompiler { public class Vala.CCodeCompiler : Object {
public CCodeCompiler () { public CCodeCompiler () {
} }
......
...@@ -97,6 +97,7 @@ public class Vala.CodeGenerator : CodeVisitor { ...@@ -97,6 +97,7 @@ public class Vala.CodeGenerator : CodeVisitor {
TypeReference string_type; TypeReference string_type;
TypeReference float_type; TypeReference float_type;
TypeReference double_type; TypeReference double_type;
DataType gobject_type;
DataType gerror_type; DataType gerror_type;
DataType glist_type; DataType glist_type;
DataType gslist_type; DataType gslist_type;
...@@ -247,6 +248,7 @@ public class Vala.CodeGenerator : CodeVisitor { ...@@ -247,6 +248,7 @@ public class Vala.CodeGenerator : CodeVisitor {
var glib_ns = root_symbol.scope.lookup ("GLib"); var glib_ns = root_symbol.scope.lookup ("GLib");
gobject_type = (DataType) glib_ns.scope.lookup ("Object");
gerror_type = (DataType) glib_ns.scope.lookup ("Error"); gerror_type = (DataType) glib_ns.scope.lookup ("Error");
glist_type = (DataType) glib_ns.scope.lookup ("List"); glist_type = (DataType) glib_ns.scope.lookup ("List");
gslist_type = (DataType) glib_ns.scope.lookup ("SList"); gslist_type = (DataType) glib_ns.scope.lookup ("SList");
......
...@@ -94,10 +94,12 @@ public class Vala.CodeGenerator { ...@@ -94,10 +94,12 @@ public class Vala.CodeGenerator {
decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ())))); decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
} }
decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (cl.get_cname ())))); decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (cl.get_cname ()))));
instance_struct.add_field (cl.base_class.get_cname (), "parent"); if (cl.is_subtype_of (gobject_type)) {
instance_struct.add_field ("%sPrivate *".printf (cl.get_cname ()), "priv"); instance_struct.add_field (cl.base_class.get_cname (), "parent");
type_struct.add_field ("%sClass".printf (cl.base_class.get_cname ()), "parent"); instance_struct.add_field ("%sPrivate *".printf (cl.get_cname ()), "priv");
type_struct.add_field ("%sClass".printf (cl.base_class.get_cname ()), "parent");
}
if (cl.source_reference.comment != null) { if (cl.source_reference.comment != null) {
def_frag.append (new CCodeComment (cl.source_reference.comment)); def_frag.append (new CCodeComment (cl.source_reference.comment));
...@@ -114,7 +116,7 @@ public class Vala.CodeGenerator { ...@@ -114,7 +116,7 @@ public class Vala.CodeGenerator {
cl.accept_children (this); cl.accept_children (this);
if (!cl.is_static) { if (cl.is_subtype_of (gobject_type)) {
if (class_has_readable_properties (cl) || cl.get_type_parameters ().size > 0) { if (class_has_readable_properties (cl) || cl.get_type_parameters ().size > 0) {
add_get_property_function (cl); add_get_property_function (cl);
} }
......
...@@ -26,7 +26,7 @@ using Gee; ...@@ -26,7 +26,7 @@ using Gee;
/** /**
* Dynamic binding provider for DBus objects. * Dynamic binding provider for DBus objects.
*/ */
public class Vala.DBusBindingProvider : BindingProvider { public class Vala.DBusBindingProvider : Object, BindingProvider {
public CodeContext context { public CodeContext context {
set { set {
_context = value; _context = value;
......
...@@ -25,7 +25,7 @@ using GLib; ...@@ -25,7 +25,7 @@ using GLib;
/** /**
* C function to register a type at runtime. * C function to register a type at runtime.
*/ */
public abstract class Vala.TypeRegisterFunction { public abstract class Vala.TypeRegisterFunction : Object {
private CCodeFragment declaration_fragment = new CCodeFragment (); private CCodeFragment declaration_fragment = new CCodeFragment ();
private CCodeFragment definition_fragment = new CCodeFragment (); private CCodeFragment definition_fragment = new CCodeFragment ();
......
using GLib; using GLib;
namespace Maman { namespace Maman {
class Bar { class Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Class in Namespace Test\n"); stdout.printf ("Class in Namespace Test\n");
return 0; return 0;
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
} }
class Maman.SubBar : Bar { class Maman.SubBar : Bar {
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
public void do_action () { public void do_action () {
stdout.printf (" 2"); stdout.printf (" 2");
} }
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
public static void do_action () { public static void do_action () {
stdout.printf (" 2"); stdout.printf (" 2");
} }
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("For Test: 1"); stdout.printf ("For Test: 1");
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
public virtual void do_action () { public virtual void do_action () {
stdout.printf (" BAD"); stdout.printf (" BAD");
} }
......
using GLib; using GLib;
class Maman.Foo { class Maman.Foo : Object {
public int public_base_field = 2; public int public_base_field = 2;
} }
......
using GLib; using GLib;
class Maman.Foo { class Maman.Foo : Object {
private int _public_base_property = 2; private int _public_base_property = 2;
public int public_base_property { public int public_base_property {
get { get {
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Assignment Test: 1"); stdout.printf ("Assignment Test: 1");
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Binary Expression Test: 1"); stdout.printf ("Binary Expression Test: 1");
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Block Test: 1"); stdout.printf ("Block Test: 1");
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Break Test: 1"); stdout.printf ("Break Test: 1");
......
...@@ -2,7 +2,7 @@ using GLib; ...@@ -2,7 +2,7 @@ using GLib;
public static delegate int Maman.ActionCallback (); public static delegate int Maman.ActionCallback ();
class Maman.Bar { class Maman.Bar : Object {
static int do_action () { static int do_action () {
return 2; return 2;
} }
......
...@@ -2,7 +2,7 @@ using GLib; ...@@ -2,7 +2,7 @@ using GLib;
static delegate int Maman.ActionCallback (int i); static delegate int Maman.ActionCallback (int i);
class Maman.Bar { class Maman.Bar : Object {
static int do_action (ActionCallback cb) { static int do_action (ActionCallback cb) {
return cb (1); return cb (1);
} }
......
using GLib; using GLib;
class Maman.Bar { class Maman.Bar : Object {
static int main (string[] args) { static int main (string[] args) {
stdout.printf ("Conditional Expression Test: 1"); stdout.printf ("Conditional Expression Test: 1");
......
using GLib; using GLib;
interface Maman.Ibaz { interface Maman.Ibaz : Object {
public abstract void do_action (); public abstract void do_action ();
} }
class Maman.Baz : Ibaz { class Maman.Baz : Object, Ibaz {
public void do_action () { public void do_action () {
stdout.printf (" 2"); stdout.printf (" 2");
} }
......
using GLib; using GLib;
class Maman.Foo { class Maman.Foo : Object {
public signal void activated (bool b);