vala r1934 - in trunk: . vala



Author: juergbi
Date: Mon Oct 27 08:12:26 2008
New Revision: 1934
URL: http://svn.gnome.org/viewvc/vala?rev=1934&view=rev

Log:
2008-10-27  JÃrg Billeter  <j bitron ch>

	* vala/valaarraylengthfield.vala:
	* vala/valaarraymovemethod.vala:
	* vala/valaarrayresizemethod.vala:
	* vala/valablock.vala:
	* vala/valaclass.vala:
	* vala/valaconstant.vala:
	* vala/valaconstructor.vala:
	* vala/valacreationmethod.vala:
	* vala/valadelegate.vala:
	* vala/valadestructor.vala:
	* vala/valadynamicmethod.vala:
	* vala/valadynamicproperty.vala:
	* vala/valadynamicsignal.vala:
	* vala/valaenum.vala:
	* vala/valaenumvalue.vala:
	* vala/valaerrorcode.vala:
	* vala/valaerrordomain.vala:
	* vala/valafield.vala:
	* vala/valaforeachstatement.vala:
	* vala/valaformalparameter.vala:
	* vala/valainterface.vala:
	* vala/valalocalvariable.vala:
	* vala/valamember.vala:
	* vala/valamethod.vala:
	* vala/valanamespace.vala:
	* vala/valaobjecttypesymbol.vala:
	* vala/valaproperty.vala:
	* vala/valasignal.vala:
	* vala/valastruct.vala:
	* vala/valaswitchsection.vala:
	* vala/valasymbol.vala:
	* vala/valatypeparameter.vala:
	* vala/valatypesymbol.vala:

	Use constructor chaining instead of helper method


Modified:
   trunk/ChangeLog
   trunk/vala/valaarraylengthfield.vala
   trunk/vala/valaarraymovemethod.vala
   trunk/vala/valaarrayresizemethod.vala
   trunk/vala/valablock.vala
   trunk/vala/valaclass.vala
   trunk/vala/valaconstant.vala
   trunk/vala/valaconstructor.vala
   trunk/vala/valacreationmethod.vala
   trunk/vala/valadelegate.vala
   trunk/vala/valadestructor.vala
   trunk/vala/valadynamicmethod.vala
   trunk/vala/valadynamicproperty.vala
   trunk/vala/valadynamicsignal.vala
   trunk/vala/valaenum.vala
   trunk/vala/valaenumvalue.vala
   trunk/vala/valaerrorcode.vala
   trunk/vala/valaerrordomain.vala
   trunk/vala/valafield.vala
   trunk/vala/valaforeachstatement.vala
   trunk/vala/valaformalparameter.vala
   trunk/vala/valainterface.vala
   trunk/vala/valalocalvariable.vala
   trunk/vala/valamember.vala
   trunk/vala/valamethod.vala
   trunk/vala/valanamespace.vala
   trunk/vala/valaobjecttypesymbol.vala
   trunk/vala/valaproperty.vala
   trunk/vala/valasignal.vala
   trunk/vala/valastruct.vala
   trunk/vala/valaswitchsection.vala
   trunk/vala/valasymbol.vala
   trunk/vala/valatypeparameter.vala
   trunk/vala/valatypesymbol.vala

Modified: trunk/vala/valaarraylengthfield.vala
==============================================================================
--- trunk/vala/valaarraylengthfield.vala	(original)
+++ trunk/vala/valaarraylengthfield.vala	Mon Oct 27 08:12:26 2008
@@ -32,9 +32,7 @@
 	 * @return newly created field
 	 */
 	public ArrayLengthField (SourceReference source_reference) {
-		base.init ();
-		name = "length";
+		base ("length", new InvalidType (), null, source_reference);
 		external = true;
-		this.source_reference = source_reference;
 	}
 }

Modified: trunk/vala/valaarraymovemethod.vala
==============================================================================
--- trunk/vala/valaarraymovemethod.vala	(original)
+++ trunk/vala/valaarraymovemethod.vala	Mon Oct 27 08:12:26 2008
@@ -32,9 +32,7 @@
 	 * @return newly created method
 	 */
 	public ArrayMoveMethod (SourceReference source_reference) {
-		base.init ();
-		name = "move";
+		base ("move", new VoidType (), source_reference);
 		external = true;
-		this.source_reference = source_reference;
 	}
 }

Modified: trunk/vala/valaarrayresizemethod.vala
==============================================================================
--- trunk/vala/valaarrayresizemethod.vala	(original)
+++ trunk/vala/valaarrayresizemethod.vala	Mon Oct 27 08:12:26 2008
@@ -32,10 +32,8 @@
 	 * @return newly created method
 	 */
 	public ArrayResizeMethod (SourceReference source_reference) {
-		base.init ();
-		name = "resize";
+		base ("resize", new VoidType (), source_reference);
 		external = true;
-		this.source_reference = source_reference;
 		cinstance_parameter_position = 0.1;
 	}
 }

Modified: trunk/vala/valablock.vala
==============================================================================
--- trunk/vala/valablock.vala	(original)
+++ trunk/vala/valablock.vala	Mon Oct 27 08:12:26 2008
@@ -42,8 +42,7 @@
 	 * @param source reference to source code
 	 */
 	public Block (SourceReference source_reference) {
-		base.init ();
-		this.source_reference = source_reference;
+		base (null, source_reference);
 	}
 	
 	/**

Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala	(original)
+++ trunk/vala/valaclass.vala	Mon Oct 27 08:12:26 2008
@@ -209,9 +209,7 @@
 	 * @return       newly created class
 	 */
 	public Class (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 	}
 
 	/**

Modified: trunk/vala/valaconstant.vala
==============================================================================
--- trunk/vala/valaconstant.vala	(original)
+++ trunk/vala/valaconstant.vala	Mon Oct 27 08:12:26 2008
@@ -68,11 +68,9 @@
 	 * @return                 newly created constant
 	 */
 	public Constant (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference) {
-		base.init ();
-		this.name = name;
+		base (name, source_reference);
 		this.type_reference = type_reference;
 		this.initializer = initializer;
-		this.source_reference = source_reference;
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valaconstructor.vala
==============================================================================
--- trunk/vala/valaconstructor.vala	(original)
+++ trunk/vala/valaconstructor.vala	Mon Oct 27 08:12:26 2008
@@ -48,8 +48,7 @@
 	 * @return       newly created constructor
 	 */
 	public Constructor (SourceReference source) {
-		base.init ();
-		source_reference = source;
+		base (null, source);
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valacreationmethod.vala
==============================================================================
--- trunk/vala/valacreationmethod.vala	(original)
+++ trunk/vala/valacreationmethod.vala	Mon Oct 27 08:12:26 2008
@@ -59,11 +59,8 @@
 	 * @return                 newly created method
 	 */
 	public CreationMethod (string? type_name, string? name, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
-		this.source_reference = source_reference;
+		base (name, new VoidType (), source_reference);
 		this.type_name = type_name;
-		return_type = new VoidType ();
 
 		carray_length_parameter_position = -3;
 		cdelegate_target_parameter_position = -3;

Modified: trunk/vala/valadelegate.vala
==============================================================================
--- trunk/vala/valadelegate.vala	(original)
+++ trunk/vala/valadelegate.vala	Mon Oct 27 08:12:26 2008
@@ -95,10 +95,8 @@
 	 * @return            newly created delegate
 	 */
 	public Delegate (string? name, DataType return_type, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		base (name, source_reference);
 		this.return_type = return_type;
-		this.source_reference = source_reference;
 
 		// error is -1 (right of user_data)
 		cinstance_parameter_position = -2;

Modified: trunk/vala/valadestructor.vala
==============================================================================
--- trunk/vala/valadestructor.vala	(original)
+++ trunk/vala/valadestructor.vala	Mon Oct 27 08:12:26 2008
@@ -48,8 +48,7 @@
 	 * @return                 newly created destructor
 	 */
 	public Destructor (SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
+		base (null, source_reference);
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valadynamicmethod.vala
==============================================================================
--- trunk/vala/valadynamicmethod.vala	(original)
+++ trunk/vala/valadynamicmethod.vala	Mon Oct 27 08:12:26 2008
@@ -35,11 +35,8 @@
 	static int dynamic_method_id;
 
 	public DynamicMethod (DataType dynamic_type, string name, DataType return_type, SourceReference? source_reference = null) {
-		base.init ();
+		base (name, return_type, source_reference);
 		this.dynamic_type = dynamic_type;
-		this.name = name;
-		this.return_type = return_type;
-		this.source_reference = source_reference;
 	}
 
 	public override Gee.List<string> get_cheader_filenames () {

Modified: trunk/vala/valadynamicproperty.vala
==============================================================================
--- trunk/vala/valadynamicproperty.vala	(original)
+++ trunk/vala/valadynamicproperty.vala	Mon Oct 27 08:12:26 2008
@@ -32,10 +32,8 @@
 	private string cname;
 
 	public DynamicProperty (DataType dynamic_type, string name, SourceReference? source_reference = null) {
-		base.init ();
+		base (name, null, null, null, source_reference);
 		this.dynamic_type = dynamic_type;
-		this.name = name;
-		this.source_reference = source_reference;
 	}
 
 	public override Gee.List<string> get_cheader_filenames () {

Modified: trunk/vala/valadynamicsignal.vala
==============================================================================
--- trunk/vala/valadynamicsignal.vala	(original)
+++ trunk/vala/valadynamicsignal.vala	Mon Oct 27 08:12:26 2008
@@ -31,10 +31,7 @@
 	public Expression handler { get; set; }
 
 	public DynamicSignal (DataType dynamic_type, string name, DataType return_type, SourceReference? source_reference = null) {
-		base.init ();
+		base (name, return_type, source_reference);
 		this.dynamic_type = dynamic_type;
-		this.name = name;
-		this.return_type = return_type;
-		this.source_reference = source_reference;
 	}
 }

Modified: trunk/vala/valaenum.vala
==============================================================================
--- trunk/vala/valaenum.vala	(original)
+++ trunk/vala/valaenum.vala	Mon Oct 27 08:12:26 2008
@@ -53,9 +53,7 @@
 	 * @return                 newly created enum
 	 */
 	public Enum (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 	}
 	
 	/**

Modified: trunk/vala/valaenumvalue.vala
==============================================================================
--- trunk/vala/valaenumvalue.vala	(original)
+++ trunk/vala/valaenumvalue.vala	Mon Oct 27 08:12:26 2008
@@ -40,9 +40,7 @@
 	 * @return     newly created enum value
 	 */
 	public EnumValue (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
-		this.source_reference = source_reference;
+		base (name, source_reference);
 	}
 
 	/**
@@ -53,10 +51,8 @@
 	 * @return      newly created enum value
 	 */
 	public EnumValue.with_value (string name, Expression value, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		this (name, source_reference);
 		this.value = value;
-		this.source_reference = source_reference;
 	}
 	
 	/**

Modified: trunk/vala/valaerrorcode.vala
==============================================================================
--- trunk/vala/valaerrorcode.vala	(original)
+++ trunk/vala/valaerrorcode.vala	Mon Oct 27 08:12:26 2008
@@ -40,9 +40,7 @@
 	 * @return     newly created enum value
 	 */
 	public ErrorCode (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
-		this.source_reference = source_reference;
+		base (name, source_reference);
 	}
 
 	/**
@@ -53,10 +51,8 @@
 	 * @return      newly created enum value
 	 */
 	public ErrorCode.with_value (string name, Expression value, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		this (name, source_reference);
 		this.value = value;
-		this.source_reference = source_reference;
 	}
 	
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valaerrordomain.vala
==============================================================================
--- trunk/vala/valaerrordomain.vala	(original)
+++ trunk/vala/valaerrordomain.vala	Mon Oct 27 08:12:26 2008
@@ -42,9 +42,7 @@
 	 * @return                 newly created error domain
 	 */
 	public ErrorDomain (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 	}
 	
 	/**

Modified: trunk/vala/valafield.vala
==============================================================================
--- trunk/vala/valafield.vala	(original)
+++ trunk/vala/valafield.vala	Mon Oct 27 08:12:26 2008
@@ -87,11 +87,9 @@
 	 * @return       newly created field
 	 */
 	public Field (string name, DataType field_type, Expression? initializer, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		base (name, source_reference);
 		this.field_type = field_type;
 		this.initializer = initializer;
-		this.source_reference = source_reference;
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valaforeachstatement.vala
==============================================================================
--- trunk/vala/valaforeachstatement.vala	(original)
+++ trunk/vala/valaforeachstatement.vala	Mon Oct 27 08:12:26 2008
@@ -101,11 +101,10 @@
 	 * @return       newly created foreach statement
 	 */
 	public ForeachStatement (DataType? type_reference, string variable_name, Expression collection, Block body, SourceReference source_reference) {
-		base.init ();
+		base (source_reference);
 		this.variable_name = variable_name;
 		this.collection = collection;
 		this.body = body;
-		this.source_reference = source_reference;
 		this.type_reference = type_reference;
 	}
 	

Modified: trunk/vala/valaformalparameter.vala
==============================================================================
--- trunk/vala/valaformalparameter.vala	(original)
+++ trunk/vala/valaformalparameter.vala	Mon Oct 27 08:12:26 2008
@@ -98,10 +98,8 @@
 	 * @return       newly created formal parameter
 	 */
 	public FormalParameter (string name, DataType parameter_type, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		base (name, source_reference);
 		this.parameter_type = parameter_type;
-		this.source_reference = source_reference;
 
 		access = SymbolAccessibility.PUBLIC;
 	}
@@ -110,10 +108,9 @@
 	 * Creates a new ellipsis parameter representing an indefinite number of
 	 * parameters.
 	 */
-	public FormalParameter.with_ellipsis (SourceReference? source = null) {
-		base.init ();
+	public FormalParameter.with_ellipsis (SourceReference? source_reference = null) {
+		base (null, source_reference);
 		ellipsis = true;
-		source_reference = source;
 
 		access = SymbolAccessibility.PUBLIC;
 	}

Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala	(original)
+++ trunk/vala/valainterface.vala	Mon Oct 27 08:12:26 2008
@@ -97,9 +97,7 @@
 	 * @return       newly created interface
 	 */
 	public Interface (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 	}
 
 	/**

Modified: trunk/vala/valalocalvariable.vala
==============================================================================
--- trunk/vala/valalocalvariable.vala	(original)
+++ trunk/vala/valalocalvariable.vala	Mon Oct 27 08:12:26 2008
@@ -66,11 +66,9 @@
 	 * @return       newly created variable declarator
 	 */
 	public LocalVariable (DataType? variable_type, string name, Expression? initializer = null, SourceReference? source_reference = null) {
-		base.init ();
+		base (name, source_reference);
 		this.variable_type = variable_type;
-		this.name = name;
 		this.initializer = initializer;
-		this.source_reference = source_reference;
 	}
 	
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valamember.vala
==============================================================================
--- trunk/vala/valamember.vala	(original)
+++ trunk/vala/valamember.vala	Mon Oct 27 08:12:26 2008
@@ -28,7 +28,11 @@
  */
 public abstract class Vala.Member : Symbol {
 	private Gee.List<string> cheader_filenames = new ArrayList<string> ();
-	
+
+	public Member (string? name, SourceReference? source_reference) {
+		base (name, source_reference);
+	}
+
 	public override void accept (CodeVisitor visitor) {
 		visitor.visit_member (this);
 	}

Modified: trunk/vala/valamethod.vala
==============================================================================
--- trunk/vala/valamethod.vala	(original)
+++ trunk/vala/valamethod.vala	Mon Oct 27 08:12:26 2008
@@ -222,11 +222,9 @@
 	 * @param source      reference to source code
 	 * @return            newly created method
 	 */
-	public Method (string name, DataType return_type, SourceReference? source_reference = null) {
-		base.init ();
+	public Method (string? name, DataType return_type, SourceReference? source_reference = null) {
+		base (name, source_reference);
 		this.return_type = return_type;
-		this.source_reference = source_reference;
-		this.name = name;
 
 		carray_length_parameter_position = -3;
 		cdelegate_target_parameter_position = -3;

Modified: trunk/vala/valanamespace.vala
==============================================================================
--- trunk/vala/valanamespace.vala	(original)
+++ trunk/vala/valanamespace.vala	Mon Oct 27 08:12:26 2008
@@ -52,9 +52,7 @@
 	 * @return                 newly created namespace
 	 */
 	public Namespace (string? name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 		access = SymbolAccessibility.PUBLIC;
 	}
 	

Modified: trunk/vala/valaobjecttypesymbol.vala
==============================================================================
--- trunk/vala/valaobjecttypesymbol.vala	(original)
+++ trunk/vala/valaobjecttypesymbol.vala	Mon Oct 27 08:12:26 2008
@@ -32,4 +32,8 @@
 	public abstract Gee.List<Method> get_methods ();
 	public abstract Gee.List<Signal> get_signals ();
 	public abstract Gee.List<Property> get_properties ();
+
+	public ObjectTypeSymbol (string name, SourceReference? source_reference = null) {
+		base (name, source_reference);
+	}
 }

Modified: trunk/vala/valaproperty.vala
==============================================================================
--- trunk/vala/valaproperty.vala	(original)
+++ trunk/vala/valaproperty.vala	Mon Oct 27 08:12:26 2008
@@ -30,7 +30,7 @@
 	/**
 	 * The property type.
 	 */
-	public DataType property_type {
+	public DataType? property_type {
 		get { return _data_type; }
 		set {
 			_data_type = value;
@@ -175,13 +175,11 @@
 	 * @param source       reference to source code
 	 * @return             newly created property
 	 */
-	public Property (string name, DataType property_type, PropertyAccessor? get_accessor, PropertyAccessor? set_accessor, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+	public Property (string name, DataType? property_type, PropertyAccessor? get_accessor, PropertyAccessor? set_accessor, SourceReference? source_reference = null) {
+		base (name, source_reference);
 		this.property_type = property_type;
 		this.get_accessor = get_accessor;
 		this.set_accessor = set_accessor;
-		this.source_reference = source_reference;
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valasignal.vala
==============================================================================
--- trunk/vala/valasignal.vala	(original)
+++ trunk/vala/valasignal.vala	Mon Oct 27 08:12:26 2008
@@ -66,10 +66,8 @@
 	 * @return            newly created signal
 	 */
 	public Signal (string name, DataType return_type, SourceReference? source_reference = null) {
-		base.init ();
-		this.name = name;
+		base (name, source_reference);
 		this.return_type = return_type;
-		this.source_reference = source_reference;
 	}
 	
 	/**

Modified: trunk/vala/valastruct.vala
==============================================================================
--- trunk/vala/valastruct.vala	(original)
+++ trunk/vala/valastruct.vala	Mon Oct 27 08:12:26 2008
@@ -66,9 +66,7 @@
 	 * @return                 newly created struct
 	 */
 	public Struct (string name, SourceReference? source_reference = null) {
-		base.init ();
-		this.source_reference = source_reference;
-		this.name = name;
+		base (name, source_reference);
 	}
 
 	/**

Modified: trunk/vala/valaswitchsection.vala
==============================================================================
--- trunk/vala/valaswitchsection.vala	(original)
+++ trunk/vala/valaswitchsection.vala	Mon Oct 27 08:12:26 2008
@@ -36,8 +36,7 @@
 	 * @return                 newly created switch section
 	 */
 	public SwitchSection (SourceReference source_reference) {
-		base.init ();
-		this.source_reference = source_reference;
+		base (source_reference);
 	}
 	
 	/**

Modified: trunk/vala/valasymbol.vala
==============================================================================
--- trunk/vala/valasymbol.vala	(original)
+++ trunk/vala/valasymbol.vala	Mon Oct 27 08:12:26 2008
@@ -56,7 +56,7 @@
 	/**
 	 * The symbol name.
 	 */
-	public string name { get; set; }
+	public string? name { get; set; }
 
 	/**
 	 * Specifies whether this symbol is active.
@@ -118,7 +118,9 @@
 	private weak Scope _owner;
 	private Scope _scope;
 
-	public void init () {
+	public Symbol (string? name, SourceReference? source_reference) {
+		this.name = name;
+		this.source_reference = source_reference;
 		_scope = new Scope (this);
 	}
 	

Modified: trunk/vala/valatypeparameter.vala
==============================================================================
--- trunk/vala/valatypeparameter.vala	(original)
+++ trunk/vala/valatypeparameter.vala	Mon Oct 27 08:12:26 2008
@@ -39,10 +39,8 @@
 	 * @param source reference to source code
 	 * @return       newly created generic type parameter
 	 */	
-	public TypeParameter (string _name, SourceReference source) {
-		base.init ();
-		name = _name;
-		source_reference = source;
+	public TypeParameter (string name, SourceReference source_reference) {
+		base (name, source_reference);
 	}
 
 	public override void accept (CodeVisitor visitor) {

Modified: trunk/vala/valatypesymbol.vala
==============================================================================
--- trunk/vala/valatypesymbol.vala	(original)
+++ trunk/vala/valatypesymbol.vala	Mon Oct 27 08:12:26 2008
@@ -31,6 +31,10 @@
 public abstract class Vala.TypeSymbol : Symbol {
 	private Gee.List<string> cheader_filenames = new ArrayList<string> ();
 
+	public TypeSymbol (string? name, SourceReference? source_reference = null) {
+		base (name, source_reference);
+	}
+
 	/**
 	 * Returns the name of this data type as it is used in C code.
 	 *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]