Commit 8621de12 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Don't derive from GObject in libvala where not necessary to improve

2008-08-14  Jürg Billeter  <j@bitron.ch>

	Don't derive from GObject in libvala where not necessary to improve
	compilation performance

svn path=/trunk/; revision=1757
parent 2166f7c3
2008-08-14 Jürg Billeter <j@bitron.ch>
Don't derive from GObject in libvala where not necessary to improve
compilation performance
2008-08-14 Jürg Billeter <j@bitron.ch>
* configure.ac: Post-release version bump
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeAssignment : CCodeExpression {
/**
* Left hand side of the assignment.
*/
public CCodeExpression left { get; construct; }
public CCodeExpression left { get; set; }
/**
* Assignment operator.
......@@ -39,7 +39,7 @@ public class Vala.CCodeAssignment : CCodeExpression {
/**
* Right hand side of the assignment.
*/
public CCodeExpression right { get; construct; }
public CCodeExpression right { get; set; }
public CCodeAssignment (CCodeExpression l, CCodeExpression r, CCodeAssignmentOperator op = CCodeAssignmentOperator.SIMPLE) {
left = l;
......
......@@ -34,12 +34,12 @@ public class Vala.CCodeBinaryExpression : CCodeExpression {
/**
* The left operand.
*/
public CCodeExpression left { get; set construct; }
public CCodeExpression left { get; set; }
/**
* The right operand.
*/
public CCodeExpression right { get; set construct; }
public CCodeExpression right { get; set; }
public CCodeBinaryExpression (CCodeBinaryOperator op, CCodeExpression l, CCodeExpression r) {
operator = op;
......
......@@ -29,12 +29,12 @@ public class Vala.CCodeCastExpression : CCodeExpression {
/**
* The expression to be cast.
*/
public CCodeExpression inner { get; set construct; }
public CCodeExpression inner { get; set; }
/**
* The target type.
*/
public string type_name { get; set construct; }
public string type_name { get; set; }
public CCodeCastExpression (CCodeExpression expr, string type) {
inner = expr;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeComment : CCodeNode {
/**
* The text content of the comment.
*/
public string text { get; set construct; }
public string text { get; set; }
public CCodeComment (string _text) {
text = _text;
......
......@@ -29,17 +29,17 @@ public class Vala.CCodeConditionalExpression : CCodeExpression {
/**
* The condition.
*/
public CCodeExpression condition { get; set construct; }
public CCodeExpression condition { get; set; }
/**
* The expression to be evaluated if the condition holds.
*/
public CCodeExpression true_expression { get; set construct; }
public CCodeExpression true_expression { get; set; }
/**
* The expression to be evaluated if the condition doesn't hold.
*/
public CCodeExpression false_expression { get; set construct; }
public CCodeExpression false_expression { get; set; }
public CCodeConditionalExpression (CCodeExpression cond, CCodeExpression true_expr, CCodeExpression false_expr) {
condition = cond;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeConstant : CCodeExpression {
/**
* The name of this constant.
*/
public string name { get; set construct; }
public string name { get; set; }
public CCodeConstant (string _name) {
name = _name;
......
......@@ -34,7 +34,7 @@ public class Vala.CCodeDoStatement : CCodeStatement {
/**
* The loop condition.
*/
public CCodeExpression condition { get; set construct; }
public CCodeExpression condition { get; set; }
public CCodeDoStatement (CCodeStatement stmt, CCodeExpression cond) {
body = stmt;
......
......@@ -31,13 +31,13 @@ public class Vala.CCodeElementAccess : CCodeExpression {
/**
* Expression representing the container on which we want to access.
*/
public CCodeExpression container { get; set construct; }
public CCodeExpression container { get; set; }
/**
* Expression representing the index we want to access inside the
* container.
*/
public CCodeExpression index { get; set construct; }
public CCodeExpression index { get; set; }
public CCodeElementAccess (CCodeExpression cont, CCodeExpression i) {
container = cont;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeExpressionStatement : CCodeStatement {
/**
* The expression to evaluate.
*/
public CCodeExpression expression { get; set construct; }
public CCodeExpression expression { get; set; }
public CCodeExpressionStatement (CCodeExpression expr) {
expression = expr;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeGotoStatement : CCodeStatement {
/**
* The name of the target label.
*/
public string name { get; set construct; }
public string name { get; set; }
public CCodeGotoStatement (string name) {
this.name = name;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeIdentifier : CCodeExpression {
/**
* The name of this identifier.
*/
public string name { get; set construct; }
public string name { get; set; }
public CCodeIdentifier (string _name) {
name = _name;
......
......@@ -29,17 +29,17 @@ public class Vala.CCodeIfStatement : CCodeStatement {
/**
* The boolean condition to evaluate.
*/
public CCodeExpression condition { get; set construct; }
public CCodeExpression condition { get; set; }
/**
* The statement to be evaluated if the condition holds.
*/
public CCodeStatement true_statement { get; set construct; }
public CCodeStatement true_statement { get; set; }
/**
* The optional statement to be evaluated if the condition doesn't hold.
*/
public CCodeStatement? false_statement { get; set construct; }
public CCodeStatement? false_statement { get; set; }
public CCodeIfStatement (CCodeExpression cond, CCodeStatement true_stmt, CCodeStatement? false_stmt = null) {
condition = cond;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeIncludeDirective : CCodeNode {
/**
* The file to be included.
*/
public string filename { get; set construct; }
public string filename { get; set; }
/**
* Specifies whether the specified file should be searched in the local
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeLabel : CCodeStatement {
/**
* The name of this label.
*/
public string name { get; set construct; }
public string name { get; set; }
public CCodeLabel (string name) {
this.name = name;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeLineDirective : CCodeNode {
/**
* The name of the source file to be presumed.
*/
public string filename { get; set construct; }
public string filename { get; set; }
/**
* The line number in the source file to be presumed.
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeMacroReplacement : CCodeNode {
/**
* The name of this macro.
*/
public string name { get; set construct; }
public string name { get; set; }
/**
* The replacement of this macro.
......
......@@ -29,12 +29,12 @@ public class Vala.CCodeMemberAccess : CCodeExpression {
/**
* The parent of the member.
*/
public CCodeExpression inner { get; set construct; }
public CCodeExpression inner { get; set; }
/**
* The name of the member.
*/
public string member_name { get; set construct; }
public string member_name { get; set; }
/**
* Specifies whether the member access happens by pointer dereferencing.
......
/* valaccodenode.vala
*
* Copyright (C) 2006-2007 Jürg Billeter
* Copyright (C) 2006-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a node in the C code tree.
*/
public abstract class Vala.CCodeNode : Object {
public abstract class Vala.CCodeNode {
/**
* The source file name and line number to be presumed for this code
* node.
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeOnceSection : CCodeFragment {
/**
* The name of the guarding define.
*/
public string define { get; set construct; }
public string define { get; set; }
public CCodeOnceSection (string def) {
define = def;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeParenthesizedExpression : CCodeExpression {
/**
* The expression in the parenthesis.
*/
public CCodeExpression inner { get; set construct; }
public CCodeExpression inner { get; set; }
public CCodeParenthesizedExpression (CCodeExpression expr) {
inner = expr;
......
......@@ -34,7 +34,7 @@ public class Vala.CCodeUnaryExpression : CCodeExpression {
/**
* The operand.
*/
public CCodeExpression inner { get; set construct; }
public CCodeExpression inner { get; set; }
public CCodeUnaryExpression (CCodeUnaryOperator op, CCodeExpression expr) {
operator = op;
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeVariableDeclarator : CCodeDeclarator {
/**
* The variable name.
*/
public string name { get; set construct; }
public string name { get; set; }
/**
* The optional initializer expression.
......
......@@ -29,7 +29,7 @@ public class Vala.CCodeWhileStatement : CCodeStatement {
/**
* The loop condition.
*/
public CCodeExpression condition { get; set construct; }
public CCodeExpression condition { get; set; }
/**
* The loop body.
......
......@@ -25,18 +25,11 @@ using GLib;
/**
* Represents a writer to write C source files.
*/
public class Vala.CCodeWriter : Object {
public class Vala.CCodeWriter {
/**
* Specifies the file to be written.
*/
public string filename {
get {
return _filename;
}
construct {
_filename = value;
}
}
public string filename { get; set; }
/**
* Specifies whether to emit line directives.
......@@ -50,7 +43,6 @@ public class Vala.CCodeWriter : Object {
get { return _bol; }
}
private string _filename;
private string temp_filename;
private bool file_exists;
......@@ -61,8 +53,8 @@ public class Vala.CCodeWriter : Object {
/* at begin of line */
private bool _bol = true;
public CCodeWriter (string _filename) {
filename = _filename;
public CCodeWriter (string filename) {
this.filename = filename;
}
/**
......@@ -72,12 +64,12 @@ public class Vala.CCodeWriter : Object {
* false otherwise
*/
public bool open () {
file_exists = FileUtils.test (_filename, FileTest.EXISTS);
file_exists = FileUtils.test (filename, FileTest.EXISTS);
if (file_exists) {
temp_filename = "%s.valatmp".printf (_filename);
temp_filename = "%s.valatmp".printf (filename);
stream = FileStream.open (temp_filename, "w");
} else {
stream = FileStream.open (_filename, "w");
stream = FileStream.open (filename, "w");
}
return (stream != null);
......@@ -93,7 +85,7 @@ public class Vala.CCodeWriter : Object {
var changed = true;
try {
var old_file = new MappedFile (_filename, false);
var old_file = new MappedFile (filename, false);
var new_file = new MappedFile (temp_filename, false);
var len = old_file.get_length ();
if (len == new_file.get_length ()) {
......@@ -108,7 +100,7 @@ public class Vala.CCodeWriter : Object {
}
if (changed) {
FileUtils.rename (temp_filename, _filename);
FileUtils.rename (temp_filename, filename);
} else {
FileUtils.unlink (temp_filename);
}
......
......@@ -23,7 +23,7 @@
using GLib;
class Vala.Compiler : Object {
class Vala.Compiler {
static string basedir;
static string directory;
static bool version;
......
......@@ -14,6 +14,7 @@ noinst_LTLIBRARIES = \
libgee_la_VALASOURCES = \
arraylist.vala \
collection.vala \
collectionobject.vala \
hashmap.vala \
hashset.vala \
iterable.vala \
......
......@@ -27,7 +27,7 @@ using GLib;
/**
* Arrays of arbitrary elements which grow automatically as elements are added.
*/
public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public class Gee.ArrayList<G> : CollectionObject, Iterable<G>, Collection<G>, List<G> {
public int size {
get { return _size; }
}
......@@ -152,7 +152,7 @@ public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
_items.resize (value);
}
private class Iterator<G> : Object, Gee.Iterator<G> {
private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public ArrayList<G> list {
set {
_list = value;
......
/* collectionobject.vala
*
* Copyright (C) 2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Jürg Billeter <j@bitron.ch>
*/
using GLib;
/**
* Base class for all collections.
*/
public class Gee.CollectionObject {
}
......@@ -27,7 +27,7 @@ using GLib;
/**
* Hashtable implementation of the Map interface.
*/
public class Gee.HashMap<K,V> : Object, Map<K,V> {
public class Gee.HashMap<K,V> : CollectionObject, Map<K,V> {
public int size {
get { return _nnodes; }
}
......@@ -62,9 +62,6 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
this.key_hash_func = key_hash_func;
this.key_equal_func = key_equal_func;
this.value_equal_func = value_equal_func;
}
construct {
_array_size = MIN_SIZE;
_nodes = new Node<K,V>[_array_size];
}
......@@ -182,7 +179,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
private class KeySet<K,V> : Object, Iterable<K>, Collection<K>, Set<K> {
private class KeySet<K,V> : CollectionObject, Iterable<K>, Collection<K>, Set<K> {
public HashMap<K,V> map {
set { _map = value; }
}
......@@ -222,7 +219,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
private class KeyIterator<K,V> : Object, Iterator<K> {
private class KeyIterator<K,V> : CollectionObject, Iterator<K> {
public HashMap<K,V> map {
set {
_map = value;
......@@ -259,7 +256,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
private class ValueCollection<K,V> : Object, Iterable<V>, Collection<V> {
private class ValueCollection<K,V> : CollectionObject, Iterable<V>, Collection<V> {
public HashMap<K,V> map {
set { _map = value; }
}
......@@ -305,7 +302,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
private class ValueIterator<K,V> : Object, Iterator<V> {
private class ValueIterator<K,V> : CollectionObject, Iterator<V> {
public HashMap<K,V> map {
set {
_map = value;
......
......@@ -27,7 +27,7 @@ using GLib;
/**
* Hashtable implementation of the Set interface.
*/
public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public class Gee.HashSet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
public int size {
get { return _nnodes; }
}
......@@ -56,9 +56,6 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public HashSet (HashFunc hash_func = GLib.direct_hash, EqualFunc equal_func = GLib.direct_equal) {
this.hash_func = hash_func;
this.equal_func = equal_func;
}
construct {
_array_size = MIN_SIZE;
_nodes = new Node<G>[_array_size];
}
......@@ -164,7 +161,7 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
}
}
private class Iterator<G> : Object, Gee.Iterator<G> {
private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public HashSet<G> set {
set {
_set = value;
......
......@@ -26,7 +26,7 @@ using GLib;
* Implemented by classes that support a simple iteration over instances of the
* collection.
*/
public interface Gee.Iterable<G> : GLib.Object {
public interface Gee.Iterable<G> : CollectionObject {
public abstract Type get_element_type ();
/**
......
......@@ -24,7 +24,7 @@
* Implemented by classes that support a simple iteration over instances of the
* collection.
*/
public interface Gee.Iterator<G> : GLib.Object {
public interface Gee.Iterator<G> : CollectionObject {
/**
* Advances to the next element in the iteration.
*
......
......@@ -23,7 +23,7 @@
/**
* A map is a generic collection of key/value pairs.
*/
public interface Gee.Map<K,V> : GLib.Object {
public interface Gee.Map<K,V> : CollectionObject {
/**
* The number of items in this map.
*/
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items.
*/
public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
public class Gee.ReadOnlyCollection<G> : CollectionObject, Iterable<G>, Collection<G> {
public int size {
get { return _collection.size; }
}
......@@ -72,7 +72,7 @@ public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
assert_not_reached ();
}
private class Iterator<G> : Object, Gee.Iterator<G> {
private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items in a well-defined order.
*/
public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public class Gee.ReadOnlyList<G> : CollectionObject, Iterable<G>, Collection<G>, List<G> {
public int size {
get { return _list.size; }
}
......@@ -100,7 +100,7 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
assert_not_reached ();
}
class Iterator<G> : Object, Gee.Iterator<G> {
class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of key/value pairs.
*/
public class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
public class Gee.ReadOnlyMap<K,V> : CollectionObject, Map<K,V> {
public int size {
get { return _map.size; }
}
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items without duplicates.
*/
public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public class Gee.ReadOnlySet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
public int size {
get { return _set.size; }
}
......@@ -72,7 +72,7 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
assert_not_reached ();
}
private class Iterator<G> : Object, Gee.Iterator<G> {
private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* Interface to the C compiler.
*/
public class Vala.CCodeCompiler : Object {
public class Vala.CCodeCompiler {
public CCodeCompiler () {
}
......
......@@ -136,9 +136,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
private Set<string> wrappers;
public CCodeGenerator () {
}
construct {
predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
predefined_marshal_set.add ("VOID:VOID");
predefined_marshal_set.add ("VOID:BOOLEAN");
......
......@@ -25,7 +25,7 @@ using GLib;
/**
* C function to register a type at runtime.
*/
public abstract class Vala.TypeRegisterFunction : Object {
public abstract class Vala.TypeRegisterFunction {
private CCodeFragment declaration_fragment = new CCodeFragment ();
private CCodeFragment definition_fragment = new CCodeFragment ();
......
......@@ -4,7 +4,7 @@ class Maman.Foo : Object {
public Foo (construct string bar) {
}
public string bar { get; set construct; }
public string bar { get; set; }
static void test_integer_array () {
stdout.printf ("One dimensional array creation and assignment: 1");
......
......@@ -33,7 +33,7 @@ public class Vala.AddressofExpression : Expression {
get {
return _inner;
}
set construct {
set {
_inner = value;
_inner.parent_node = this;
}
......
......@@ -42,7 +42,7 @@ public class Vala.ArrayCreationExpression : Expression {
/**
* The rank of the array.
*/
public int rank { get; set construct; }
public int rank { get; set; }
/**
* The size for each dimension ascending from left to right.
......@@ -52,7 +52,7 @@ public class Vala.ArrayCreationExpression : Expression {
/**
* The root array initializer list.
*/
public InitializerList? initializer_list { get; set construct; }
public InitializerList? initializer_list { get; set; }
private DataType _element_type;
......
......@@ -32,6 +32,7 @@ public class Vala.ArrayLengthField : Field {
* @return newly created field
*/
public ArrayLengthField (SourceReference source_reference) {
base.init ();
name = "length";
external = true;
this.source_reference = source_reference;
......
......@@ -32,6 +32,7 @@ public class Vala.ArrayMoveMethod : Method {
* @return newly created method
*/
public ArrayMoveMethod (SourceReference source_reference) {
base.init ();
name = "move";
external = true;