port to construction methods add interface documentation, use implicit
authorJürg Billeter <j@bitron.ch>
Wed, 2 Aug 2006 18:22:00 +0000 (18:22 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 2 Aug 2006 18:22:00 +0000 (18:22 +0000)
2006-08-02  Jürg Billeter  <j@bitron.ch>

* port to construction methods
* vala/valaparenthesizedexpression.vala, vala/valareport.vala,
  vala/valareturnstatement.vala, vala/valasourcefilecycle.vala,
  vala/valasourcereference.vala, vala/valatypecheck.vala,
  vala/valatypeofexpression.vala, vala/valatypeparameter.vala: add
  interface documentation, use implicit namespace specification
* vala/Makefile.am: sort source file list

svn path=/trunk/; revision=89

115 files changed:
vala/ChangeLog
vala/ccode/valaccodeassignment.vala
vala/ccode/valaccodebinaryexpression.vala
vala/ccode/valaccodecasestatement.vala
vala/ccode/valaccodecastexpression.vala
vala/ccode/valaccodecomment.vala
vala/ccode/valaccodeconditionalexpression.vala
vala/ccode/valaccodeconstant.vala
vala/ccode/valaccodedeclaration.vala
vala/ccode/valaccodeelementaccess.vala
vala/ccode/valaccodeenum.vala
vala/ccode/valaccodeexpressionstatement.vala
vala/ccode/valaccodeformalparameter.vala
vala/ccode/valaccodeforstatement.vala
vala/ccode/valaccodefunction.vala
vala/ccode/valaccodefunctioncall.vala
vala/ccode/valaccodefunctiondeclarator.vala
vala/ccode/valaccodeidentifier.vala
vala/ccode/valaccodeifstatement.vala
vala/ccode/valaccodeincludedirective.vala
vala/ccode/valaccodelinedirective.vala
vala/ccode/valaccodemacroreplacement.vala
vala/ccode/valaccodememberaccess.vala
vala/ccode/valaccodeoncesection.vala
vala/ccode/valaccodeparenthesizedexpression.vala
vala/ccode/valaccodereturnstatement.vala
vala/ccode/valaccodestruct.vala
vala/ccode/valaccodeswitchstatement.vala
vala/ccode/valaccodetypedefinition.vala
vala/ccode/valaccodeunaryexpression.vala
vala/ccode/valaccodevariabledeclarator.vala
vala/ccode/valaccodewhilestatement.vala
vala/ccode/valaccodewriter.vala
vala/compiler/valacompiler.vala
vala/vala/Makefile.am
vala/vala/parser.y
vala/vala/valaarray.vala
vala/vala/valaassignment.vala
vala/vala/valaattribute.vala
vala/vala/valabinaryexpression.vala
vala/vala/valablock.vala
vala/vala/valabooleanliteral.vala
vala/vala/valabreakstatement.vala
vala/vala/valacallback.vala
vala/vala/valacastexpression.vala
vala/vala/valacharacterliteral.vala
vala/vala/valaclass.vala
vala/vala/valaclassregisterfunction.vala
vala/vala/valacodegenerator.vala
vala/vala/valacodenode.vala
vala/vala/valaconditionalexpression.vala
vala/vala/valaconstant.vala
vala/vala/valaconstructor.vala
vala/vala/valacontinuestatement.vala
vala/vala/valadatatype.vala
vala/vala/valadeclarationstatement.vala
vala/vala/valadestructor.vala
vala/vala/valadostatement.vala
vala/vala/valaelementaccess.vala
vala/vala/valaemptystatement.vala
vala/vala/valaenum.vala
vala/vala/valaenumvalue.vala
vala/vala/valaexpressionstatement.vala
vala/vala/valafield.vala
vala/vala/valaflags.vala
vala/vala/valaflagsvalue.vala
vala/vala/valaforeachstatement.vala
vala/vala/valaformalparameter.vala
vala/vala/valaforstatement.vala
vala/vala/valaifstatement.vala
vala/vala/valainitializerlist.vala
vala/vala/valainstancecast.vala
vala/vala/valaintegerliteral.vala
vala/vala/valainterface.vala
vala/vala/valainterfaceregisterfunction.vala
vala/vala/valainvocationexpression.vala
vala/vala/valalambdaexpression.vala
vala/vala/valaliteralexpression.vala
vala/vala/valalocalvariabledeclaration.vala
vala/vala/valamemberaccess.vala
vala/vala/valamethod.vala
vala/vala/valanamedargument.vala
vala/vala/valanamespace.vala
vala/vala/valanamespacereference.vala
vala/vala/valanullliteral.vala
vala/vala/valaobjectcreationexpression.vala
vala/vala/valaparenthesizedexpression.vala
vala/vala/valaparser.vala
vala/vala/valapostfixexpression.vala
vala/vala/valaproperty.vala
vala/vala/valapropertyaccessor.vala
vala/vala/valarealliteral.vala
vala/vala/valareport.vala
vala/vala/valareturnstatement.vala
vala/vala/valasemanticanalyzer.vala
vala/vala/valasignal.vala
vala/vala/valasourcefile.vala
vala/vala/valasourcefilecycle.vala
vala/vala/valasourcereference.vala
vala/vala/valastringliteral.vala
vala/vala/valastruct.vala
vala/vala/valaswitchlabel.vala
vala/vala/valaswitchsection.vala
vala/vala/valaswitchstatement.vala
vala/vala/valasymbol.vala
vala/vala/valasymbolbuilder.vala
vala/vala/valatypecheck.vala
vala/vala/valatypeofexpression.vala
vala/vala/valatypeparameter.vala
vala/vala/valatypereference.vala
vala/vala/valatyperegisterfunction.vala
vala/vala/valaunaryexpression.vala
vala/vala/valavariabledeclarator.vala
vala/vala/valawhilestatement.vala
vala/vapi/glib-2.0.vala

index 7476dc1..d90c612 100644 (file)
@@ -1,5 +1,15 @@
 2006-08-02  Jürg Billeter  <j@bitron.ch>
 
+       * port to construction methods
+       * vala/valaparenthesizedexpression.vala, vala/valareport.vala,
+         vala/valareturnstatement.vala, vala/valasourcefilecycle.vala,
+         vala/valasourcereference.vala, vala/valatypecheck.vala,
+         vala/valatypeofexpression.vala, vala/valatypeparameter.vala: add
+         interface documentation, use implicit namespace specification
+       * vala/Makefile.am: sort source file list
+
+2006-08-02  Jürg Billeter  <j@bitron.ch>
+
        * vala/parser.y, vala/valacodevisitor.vala, vala/valasymbolbuilder.vala,
          vala/valasemanticanalyzer.vala, vala/valacodegenerator.vala,
          vala/valainterfacewriter.vala, vala/valaclass.vala,
index cb53c61..1871812 100644 (file)
@@ -41,6 +41,12 @@ public class Vala.CCodeAssignment : CCodeExpression {
         */
        public CCodeExpression right { get; construct; }
        
+       public construct (CCodeExpression l, CCodeExpression r, CCodeAssignmentOperator op = CCodeAssignmentOperator.SIMPLE) {
+               left = l;
+               operator = op;
+               right = r;
+       }
+       
        public override void write (CCodeWriter! writer) {
                if (left != null) {
                        left.write (writer);
index 9fc063a..4326e9d 100644 (file)
@@ -41,6 +41,12 @@ public class Vala.CCodeBinaryExpression : CCodeExpression {
         */
        public CCodeExpression! right { get; set construct; }
        
+       public construct (CCodeBinaryOperator op, CCodeExpression! l, CCodeExpression! r) {
+               operator = op;
+               left = l;
+               right = r;
+       }
+       
        public override void write (CCodeWriter! writer) {
                if (left != null) {
                        left.write (writer);
index 55a75b7..0019b45 100644 (file)
@@ -33,6 +33,10 @@ public class Vala.CCodeCaseStatement : CCodeStatement {
        
        private List<CCodeStatement> statements;
        
+       public construct (CCodeExpression! expr) {
+               expression = expr;
+       }
+       
        /**
         * Append the specified statement to this switch section.
         *
index fcf6e2e..756e5c8 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeCastExpression : CCodeExpression {
         */
        public string! type_name { get; set construct; }
        
+       public construct (CCodeExpression! expr, string! type) {
+               inner = expr;
+               type_name = type;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string ("(");
                writer.write_string (type_name);
index 885ce7e..6abcd59 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeComment : CCodeNode {
         */
        public string! text { get; set construct; }
        
+       public construct (string! _text) {
+               text = _text;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_comment (text);
        }
index 4ee31e5..d7cef73 100644 (file)
@@ -41,6 +41,12 @@ public class Vala.CCodeConditionalExpression : CCodeExpression {
         */
        public CCodeExpression! false_expression { get; set construct; }
        
+       public construct (CCodeExpression! cond, CCodeExpression! true_expr, CCodeExpression! false_expr) {
+               condition = cond;
+               true_expression = true_expr;
+               false_expression = false_expr;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string ("(");
                condition.write (writer);
index 7ab5270..11048c6 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeConstant : CCodeExpression {
         */
        public string! name { get; set construct; }
        
+       public construct (string! _name) {
+               name = _name;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string (name);
        }
index d0db440..01cb239 100644 (file)
@@ -38,6 +38,10 @@ public class Vala.CCodeDeclaration : CCodeStatement {
        
        private List<CCodeDeclarator> declarators;
        
+       public construct (string! _type_name) {
+               type_name = _type_name;
+       }
+       
        /**
         * Adds the specified declarator to this declaration.
         *
index 3a290e6..92e871c 100644 (file)
@@ -1,6 +1,7 @@
 /* valaccodememberaccess.vala
  *
  * Copyright (C) 2006  Raffaele Sandrini
+ * Copyright (C) 2006  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
  *
  * Author:
  *     Raffaele Sandrini <rasa@gmx.ch>
+ *     Jürg Billeter <j@bitron.ch>
  */
 
 using GLib;
 
 /**
- * Represents an access to a array member in the C code.
+ * Represents an access to an array member in the C code.
  */
 public class Vala.CCodeElementAccess : CCodeExpression {
        /**
-        * Expression representing the container on wich we want to access.
+        * Expression representing the container on which we want to access.
         */
        public CCodeExpression! container { get; set construct; }
        
        /**
-        * Expression representing the index we want to access inside the container.
+        * Expression representing the index we want to access inside the
+        * container.
         */
        public CCodeExpression! index { get; set construct; }
        
+       public construct (CCodeExpression! cont, CCodeExpression! i) {
+               container = cont;
+               index = i;
+       }
+       
        public override void write (CCodeWriter! writer) {
                container.write (writer);
                writer.write_string ("[");
index 11b4424..467ba7e 100644 (file)
@@ -29,10 +29,14 @@ public class Vala.CCodeEnum : CCodeNode {
        /**
         * The name of this enum.
         */
-       public string! name { get; set construct; }
+       public string name { get; set; }
        
        private List<string> values;
        
+       public construct (string n = null) {
+               name = n;
+       }
+       
        /**
         * Adds the specified value to this enum.
         *
index a2bbec2..f21fd60 100644 (file)
@@ -30,6 +30,10 @@ public class Vala.CCodeExpressionStatement : CCodeStatement {
         * The expression to evaluate.
         */
        public CCodeExpression! expression { get; set construct; }
+       
+       public construct (CCodeExpression expr) {
+               expression = expr;
+       }
 
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
index 14eb8d8..5613892 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeFormalParameter : CCodeNode {
         */
        public string! type_name { get; set construct; }
        
+       public construct (string! n, string! type) {
+               name = n;
+               type_name = type;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string (type_name);
                writer.write_string (" ");
index d7313e9..19a2566 100644 (file)
@@ -38,6 +38,11 @@ public class Vala.CCodeForStatement : CCodeStatement {
        
        private List<CCodeExpression> initializer;
        private List<CCodeExpression> iterator;
+       
+       public construct (CCodeExpression! cond, CCodeStatement stmt = null) {
+               condition = cond;
+               body = stmt;
+       }
 
        /**
         * Appends the specified expression to the list of initializers.
index e8b2831..599dd61 100644 (file)
@@ -48,6 +48,11 @@ public class Vala.CCodeFunction : CCodeNode {
 
        private List<CCodeFormalParameter> parameters;
        
+       public construct (string! _name, string! _return_type) {
+               name = _name;
+               return_type = _return_type;
+       }
+       
        /**
         * Appends the specified parameter to the list of function parameters.
         *
@@ -63,7 +68,7 @@ public class Vala.CCodeFunction : CCodeNode {
         * @return copied function
         */
        public ref CCodeFunction! copy () {
-               var func = new CCodeFunction (name = name, return_type = return_type);
+               var func = new CCodeFunction (name, return_type);
                func.modifiers = modifiers;
 
                /* no deep copy for lists available yet
index 351dcf0..46332f3 100644 (file)
@@ -33,6 +33,10 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
        
        private List<CCodeExpression> arguments;
        
+       public construct (CCodeExpression _call = null) {
+               call = _call;
+       }
+       
        /**
         * Appends the specified expression to the list of arguments.
         *
index 9537a15..1533f8b 100644 (file)
@@ -33,6 +33,10 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
        
        private List<CCodeFormalParameter> parameters;
        
+       public construct (string! n) {
+               name = n;
+       }
+       
        /**
         * Appends the specified parameter to the list of function parameters.
         *
index 6b15bce..0390742 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeIdentifier : CCodeExpression {
         */
        public string! name { get; set construct; }
        
+       public construct (string! _name) {
+               name = _name;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string (name);
        }
index f699da6..22de9a0 100644 (file)
@@ -41,6 +41,12 @@ public class Vala.CCodeIfStatement : CCodeStatement {
         */
        public CCodeStatement false_statement { get; set construct; }
        
+       public construct (CCodeExpression! cond, CCodeStatement! true_stmt, CCodeStatement false_stmt = null) {
+               condition = cond;
+               true_statement = true_stmt;
+               false_statement = false_stmt;
+       }
+       
        /**
         * Specifies whether this if statement is part of an else if statement.
         * This only affects the output formatting.
index 0f38f95..4630658 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeIncludeDirective : CCodeNode {
         */
        public string! filename { get; set construct; }
        
+       public construct (string! _filename) {
+               filename = _filename;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("#include <");
index f5210e5..b563c27 100644 (file)
@@ -35,6 +35,11 @@ public class Vala.CCodeLineDirective : CCodeNode {
         * The line number in the source file to be presumed.
         */
        public int line { get; set; }
+       
+       public construct (string! _filename, int _line) {
+               filename = _filename;
+               line = _line;
+       }
 
        public override void write (CCodeWriter! writer) {
                if (!writer.bol) {
index 20b421d..acdae2e 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeMacroReplacement : CCodeNode {
         */
        public string! replacement { get; set construct; }
        
+       public construct (string! n, string! replace) {
+               name = n;
+               replacement = replace;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("#define ");
index bad06e4..5b93508 100644 (file)
@@ -41,6 +41,17 @@ public class Vala.CCodeMemberAccess : CCodeExpression {
         */
        public bool is_pointer { get; set; }
        
+       public construct (CCodeExpression! container, string! member) {
+               inner = container;
+               member_name = member;
+       }
+       
+       public construct pointer (CCodeExpression! container, string! member) {
+               inner = container;
+               member_name = member;
+               is_pointer = true;
+       }
+       
        public override void write (CCodeWriter! writer) {
                inner.write (writer);
                if (is_pointer) {
index 9cd993a..b130f23 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeOnceSection : CCodeFragment {
         */
        public string! define { get; set construct; }
        
+       public construct (string! def) {
+               define = def;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("#ifndef ");
index e2770af..c51a49a 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeParenthesizedExpression : CCodeExpression {
         */
        public CCodeExpression! inner { get; set construct; }
        
+       public construct (CCodeExpression! expr) {
+               inner = expr;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string ("(");
                
index e5d6d81..97d43fd 100644 (file)
@@ -31,6 +31,10 @@ public class Vala.CCodeReturnStatement : CCodeStatement {
         */
        public CCodeExpression return_expression { get; set; }
        
+       public construct (CCodeExpression expr = null) {
+               return_expression = expr;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("return");
index ce7ac54..8c8d2e5 100644 (file)
@@ -33,6 +33,10 @@ public class Vala.CCodeStruct : CCodeNode {
        
        private List<CCodeDeclaration> declarations;
        
+       public construct (string! n) {
+               name = n;
+       }
+       
        /**
         * Adds the specified declaration as member to this struct.
         *
@@ -49,8 +53,8 @@ public class Vala.CCodeStruct : CCodeNode {
         * @param name      member name
         */
        public void add_field (string! type_name, string! name) {
-               var decl = new CCodeDeclaration (type_name = type_name);
-               decl.add_declarator (new CCodeVariableDeclarator (name = name));
+               var decl = new CCodeDeclaration (type_name);
+               decl.add_declarator (new CCodeVariableDeclarator (name));
                add_declaration (decl);
        }
        
index 818293d..fe4b929 100644 (file)
@@ -33,6 +33,10 @@ public class Vala.CCodeSwitchStatement : CCodeStatement {
        
        private List<CCodeCaseStatement> case_statements;
        
+       public construct (CCodeExpression! expr) {
+               expression = expr;
+       }
+       
        /**
         * Adds the specified case statement to the list of switch sections.
         *
index 0eb9f3c..2fe569b 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeTypeDefinition : CCodeNode {
         */
        public CCodeDeclarator declarator { get; set; }
        
+       public construct (string type, CCodeDeclarator decl) {
+               type_name = type;
+               declarator = decl;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("typedef ");
index 0c4e535..12665c4 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeUnaryExpression : CCodeExpression {
         */
        public CCodeExpression! inner { get; set construct; }
        
+       public construct (CCodeUnaryOperator op, CCodeExpression! expr) {
+               operator = op;
+               inner = expr;
+       }
+       
        public override void write (CCodeWriter! writer) {
                if (operator == CCodeUnaryOperator.PLUS) {
                        writer.write_string ("+");
index ae2fee4..1653a0d 100644 (file)
@@ -36,6 +36,15 @@ public class Vala.CCodeVariableDeclarator : CCodeDeclarator {
         */
        public CCodeExpression initializer { get; set; }
        
+       public construct (string! _name) {
+               name = _name;
+       }
+       
+       public construct with_initializer (string! _name, CCodeExpression init) {
+               name = _name;
+               initializer = init;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_string (name);
                
index ce74ebd..d4ac64a 100644 (file)
@@ -36,6 +36,11 @@ public class Vala.CCodeWhileStatement : CCodeStatement {
         */
        public CCodeStatement body { get; set; }
        
+       public construct (CCodeExpression! cond, CCodeStatement stmt = null) {
+               condition = cond;
+               body = stmt;
+       }
+       
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
                writer.write_string ("while (");
index e444b3f..e52ea90 100644 (file)
@@ -65,6 +65,10 @@ public class Vala.CCodeWriter {
        /* at begin of line */
        private bool _bol = true;
        
+       public construct (string! _filename) {
+               filename = _filename;
+       }
+       
        /**
         * Closes the file.
         */
@@ -74,8 +78,8 @@ public class Vala.CCodeWriter {
                if (file_exists) {
                        var changed = true;
                
-                       var old_file = MappedFile.new (_filename, false, null);
-                       var new_file = MappedFile.new (temp_filename, false, null);
+                       var old_file = new MappedFile (_filename, false, null);
+                       var new_file = new MappedFile (temp_filename, false, null);
                        var len = old_file.get_length ();
                        if (len == new_file.get_length ()) {
                                if (Memory.cmp (old_file.get_contents (), new_file.get_contents (), len) == 0) {
index d78317d..6ff6de5 100644 (file)
@@ -85,7 +85,7 @@ class Vala.Compiler {
                        return false;
                }
                
-               context.add_source_file (new SourceFile (filename = package_path, pkg = true));
+               context.add_source_file (new SourceFile (package_path, true));
                
                return true;
        }
@@ -113,7 +113,7 @@ class Vala.Compiler {
                
                foreach (string source in sources) {
                        if (File.test (source, FileTest.EXISTS)) {
-                               context.add_source_file (new SourceFile (filename = source));
+                               context.add_source_file (new SourceFile (source));
                        } else {
                                Report.error (null, "%s not found".printf (source));
                        }
@@ -152,7 +152,7 @@ class Vala.Compiler {
                        return quit ();
                }
                
-               var analyzer = new SemanticAnalyzer (memory_management = !disable_memory_management);
+               var analyzer = new SemanticAnalyzer (!disable_memory_management);
                analyzer.analyze (context);
                
                if (Report.get_errors () > 0) {
@@ -168,7 +168,7 @@ class Vala.Compiler {
                        }
                }
                
-               var code_generator = new CodeGenerator (memory_management = !disable_memory_management);
+               var code_generator = new CodeGenerator (!disable_memory_management);
                code_generator.emit (context);
                
                if (Report.get_errors () > 0) {
@@ -188,7 +188,7 @@ class Vala.Compiler {
        static int main (int argc, string[] argv) {
                Error err = null;
        
-               var opt_context = OptionContext.@new ("- Vala Compiler");
+               var opt_context = new OptionContext ("- Vala Compiler");
                opt_context.set_help_enabled (true);
                opt_context.add_main_entries (options, null);
                opt_context.parse (ref argc, out argv, out err);
index 72a54e2..a0ab140 100644 (file)
@@ -89,6 +89,9 @@ libvala_la_SOURCES = \
        valadostatement.c \
        valadostatement.h \
        valadostatement.vala \
+       valaelementaccess.c \
+       valaelementaccess.h \
+       valaelementaccess.vala \
        valaemptystatement.c \
        valaemptystatement.h \
        valaemptystatement.vala \
@@ -275,9 +278,6 @@ libvala_la_SOURCES = \
        valawhilestatement.c \
        valawhilestatement.h \
        valawhilestatement.vala \
-       valaelementaccess.c \
-       valaelementaccess.h \
-       valaelementaccess.vala \
        valaarray.c \
        valaarray.h \
        valaarray.vala \
index 7ac0d7b..79a5354 100644 (file)
@@ -414,7 +414,7 @@ type_name
          {
                GList *l;
                ValaSourceReference *src = src(@1);
-               $$ = vala_type_reference_new (NULL, $1, src);
+               $$ = vala_type_reference_new_from_name (NULL, $1, src);
                g_free ($1);
                g_object_unref (src);
                for (l = $2; l != NULL; l = l->next) {
@@ -427,7 +427,7 @@ type_name
          {
                GList *l;
                ValaSourceReference *src = src(@1);
-               $$ = vala_type_reference_new ($1, $3, src);
+               $$ = vala_type_reference_new_from_name ($1, $3, src);
                g_free ($1);
                g_free ($3);
                g_object_unref (src);
@@ -1011,7 +1011,7 @@ assignment
        : unary_expression assignment_operator expression
          {
                ValaSourceReference *src = src(@2);
-               $$ = VALA_EXPRESSION (vala_assignment_new ($1, $2, $3, src));
+               $$ = VALA_EXPRESSION (vala_assignment_new ($1, $3, $2, src));
                g_object_unref (src);
                g_object_unref ($1);
                g_object_unref ($3);
@@ -1172,7 +1172,7 @@ local_variable_declaration
          {
                GList *l;
                ValaSourceReference *src = src(@2);
-               $$ = vala_local_variable_declaration_new_var (src);
+               $$ = vala_local_variable_declaration_new_var_type (src);
                g_object_unref (src);
                for (l = $2; l != NULL; l = l->next) {
                        vala_local_variable_declaration_add_declarator ($$, l->data);
@@ -1382,7 +1382,7 @@ switch_label
        | DEFAULT COLON
          {
                ValaSourceReference *src = src(@1);
-               $$ = vala_switch_label_new_default (src);
+               $$ = vala_switch_label_new_with_default (src);
                g_object_unref (src);
          }
        ;
@@ -1465,7 +1465,7 @@ for_statement
                        if (init != NULL) {
                                ValaSourceReference *decl_src = vala_code_node_get_source_reference (VALA_CODE_NODE (decl));
                                ValaMemberAccess *lhs = vala_member_access_new (NULL, vala_variable_declarator_get_name (decl), decl_src);
-                               ValaAssignment *assign = vala_assignment_new (VALA_EXPRESSION (lhs), VALA_ASSIGNMENT_OPERATOR_SIMPLE, init, decl_src);
+                               ValaAssignment *assign = vala_assignment_new (VALA_EXPRESSION (lhs), init, VALA_ASSIGNMENT_OPERATOR_SIMPLE, decl_src);
                                g_object_unref (lhs);
                                vala_for_statement_add_initializer (for_statement, VALA_EXPRESSION (assign));
                                g_object_unref (assign);
@@ -2189,13 +2189,13 @@ formal_parameter_list
        | fixed_parameters COMMA ELLIPSIS
          {
                ValaSourceReference *src = src(@3);
-               $$ = g_list_append ($1, vala_formal_parameter_new_ellipsis (src));
+               $$ = g_list_append ($1, vala_formal_parameter_new_with_ellipsis (src));
                g_object_unref (src);
          }
        | ELLIPSIS
          {
                ValaSourceReference *src = src(@1);
-               $$ = g_list_append (NULL, vala_formal_parameter_new_ellipsis (src));
+               $$ = g_list_append (NULL, vala_formal_parameter_new_with_ellipsis (src));
                g_object_unref (src);
          }
        ;
index 43e3845..83b7b4a 100644 (file)
@@ -32,11 +32,16 @@ public class Vala.Array : DataType {
         */
        public DataType! element_type { get; set construct; }
        
+       private string cname;
+       
+       public construct (DataType! type) {
+               element_type = type;
+       }
+
        Array () {
                name = "%s[]".printf (element_type.name);
        }
        
-       private string cname;
        /**
         * Returns the name of this data type as it is used in C code.
         *
index a6f9468..90f88a1 100644 (file)
@@ -52,8 +52,11 @@ public class Vala.Assignment : Expression {
         * @param source reference to source code
         * @return newly created assignment
         */
-       public static ref Assignment! new (Expression! left, AssignmentOperator op, Expression! right, SourceReference source) {
-               return (new Assignment (left = left, operator = op, right = right, source_reference = source));
+       public construct (Expression! _left, Expression! _right, AssignmentOperator _op = AssignmentOperator.SIMPLE, SourceReference _source = null) {
+               left = _left;
+               operator = _op;
+               right = _right;
+               source_reference = _source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 21d7bd6..57bd0b7 100644 (file)
@@ -43,8 +43,9 @@ public class Vala.Attribute : CodeNode {
         * @param source reference to source code
         * @return newly created attribute
         */
-       public static ref Attribute! new (string! name, SourceReference source) {
-               return (new Attribute (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
 
        /**
index a019375..ea29fd5 100644 (file)
@@ -52,8 +52,11 @@ public class Vala.BinaryExpression : Expression {
         * @param source reference to source code
         * @return       newly created binary expression
         */
-       public static ref BinaryExpression! new (BinaryOperator op, Expression! left, Expression! right, SourceReference source) {
-               return (new BinaryExpression (operator = op, left = left, right = right, source_reference = source));
+       public construct (BinaryOperator op, Expression! _left, Expression! _right, SourceReference source) {
+               operator = op;
+               left = _left;
+               right = _right;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 32094b7..9ef7c3c 100644 (file)
@@ -40,8 +40,8 @@ public class Vala.Block : Statement {
         *
         * @param source reference to source code
         */
-       public static ref Block! new (SourceReference source) {
-               return (new Block (source_reference = source));
+       public construct (SourceReference source = null) {
+               source_reference = source;
        }
        
        /**
index e58fa52..711867b 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.BooleanLiteral : Literal {
         * @param source reference to source code
         * @return       newly created boolean literal
         */
-       public static ref BooleanLiteral! new (bool b, SourceReference source) {
-               return (new BooleanLiteral (value = b, source_reference = source));
+       public construct (bool b, SourceReference source) {
+               value = b;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 0bce118..3897e3b 100644 (file)
@@ -32,8 +32,8 @@ public class Vala.BreakStatement : Statement {
         * @param source reference to source code
         * @return       newly created break statement
         */
-       public static ref BreakStatement! new (SourceReference source) {
-               return (new BreakStatement (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 968f553..25d7080 100644 (file)
@@ -51,8 +51,10 @@ public class Vala.Callback : DataType {
         * @param source      reference to source code
         * @return            newly created callback
         */
-       public static ref Callback new (string! name, TypeReference return_type, SourceReference source) {
-               return (new Callback (name = name, return_type = return_type, source_reference = source));
+       public construct (string _name, TypeReference _return_type, SourceReference source = null) {
+               name = _name;
+               return_type = _return_type;
+               source_reference = source;
        }
 
        /**
index e70f9ee..a41b873 100644 (file)
@@ -43,8 +43,10 @@ public class Vala.CastExpression : Expression {
         * @param type  target type
         * @return      newly created cast expression
         */
-       public static ref CastExpression! new (Expression! inner, TypeReference! type, SourceReference source) {
-               return (new CastExpression (inner = inner, type_reference = type, source_reference = source));
+       public construct (Expression! _inner, TypeReference! type, SourceReference source) {
+               inner = _inner;
+               type_reference = type;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 35458d0..ea97323 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.CharacterLiteral : Literal {
         * @param source reference to source code
         * @return       newly created character literal
         */
-       public static ref CharacterLiteral! new (string! c, SourceReference source) {
-               return (new CharacterLiteral (value = c, source_reference = source));
+       public construct (string! c, SourceReference source) {
+               value = c;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index ef0e30e..55de21b 100644 (file)
@@ -84,8 +84,9 @@ public class Vala.Class : DataType {
         * @param source reference to source code
         * @return       newly created class
         */
-       public static ref Class! new (string! name, SourceReference source) {
-               return (new Class (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
 
        /**
@@ -175,7 +176,7 @@ public class Vala.Class : DataType {
                
                if (prop.set_accessor != null && prop.set_accessor.body == null) {
                        /* automatic property accessor body generation */
-                       var f = new Field (name = "_%s".printf (prop.name), type_reference = prop.type_reference, source_reference = prop.source_reference);
+                       var f = new Field ("_%s".printf (prop.name), prop.type_reference, null, prop.source_reference);
                        f.access = MemberAccessibility.PRIVATE;
                        add_field (f);
                }
index 545616b..ca3424c 100644 (file)
@@ -29,7 +29,17 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
        /**
         * Specifies the class to be registered.
         */
-       public Class class_reference { get; construct; }
+       public Class! class_reference { get; set construct; }
+       
+       /**
+        * Creates a new C function to register the specified class at runtime.
+        *
+        * @param cl a class
+        * @return   newly created class register function
+        */
+       public construct (Class! cl) {
+               class_reference = cl;
+       }
        
        public override DataType! get_type_declaration () {
                return class_reference;
@@ -75,15 +85,15 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
                        
                        var iface_info_name = "%s_info".printf (iface.get_lower_case_cname (null));
                        
-                       var ctypedecl = new CCodeDeclaration (type_name = "const GInterfaceInfo");
+                       var ctypedecl = new CCodeDeclaration ("const GInterfaceInfo");
                        ctypedecl.modifiers = CCodeModifiers.STATIC;
-                       ctypedecl.add_declarator (new CCodeVariableDeclarator (name = iface_info_name, initializer = new CCodeConstant (name = "{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf (class_reference.get_lower_case_cname (null), iface.get_lower_case_cname (null)))));
+                       ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer (iface_info_name, new CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf (class_reference.get_lower_case_cname (null), iface.get_lower_case_cname (null)))));
                        frag.append (ctypedecl);
-                       var reg_call = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_add_interface_static"));
-                       reg_call.add_argument (new CCodeIdentifier (name = "g_define_type_id"));
-                       reg_call.add_argument (new CCodeIdentifier (name = iface.get_upper_case_cname ("TYPE_")));
-                       reg_call.add_argument (new CCodeIdentifier (name = "&%s".printf (iface_info_name)));
-                       frag.append (new CCodeExpressionStatement (expression = reg_call));
+                       var reg_call = new CCodeFunctionCall (new CCodeIdentifier ("g_type_add_interface_static"));
+                       reg_call.add_argument (new CCodeIdentifier ("g_define_type_id"));
+                       reg_call.add_argument (new CCodeIdentifier (iface.get_upper_case_cname ("TYPE_")));
+                       reg_call.add_argument (new CCodeIdentifier ("&%s".printf (iface_info_name)));
+                       frag.append (new CCodeExpressionStatement (reg_call));
                }
                
                return frag;
index 8eb53c6..5647610 100644 (file)
@@ -63,6 +63,10 @@ public class Vala.CodeGenerator : CodeVisitor {
        TypeReference bool_type;
        TypeReference int_type;
        TypeReference string_type;
+       
+       public construct (bool manage_memory = true) {
+               memory_management = manage_memory;
+       }
 
        /**
         * Generate and emit C code for the specified code context.
@@ -104,8 +108,8 @@ public class Vala.CodeGenerator : CodeVisitor {
                
                next_temp_var_id = 0;
                
-               header_begin.append (new CCodeIncludeDirective (filename = "glib.h"));
-               source_include_directives.append (new CCodeIncludeDirective (filename = source_file.get_cheader_filename ()));
+               header_begin.append (new CCodeIncludeDirective ("glib.h"));
+               source_include_directives.append (new CCodeIncludeDirective (source_file.get_cheader_filename ()));
                
                ref List<string> used_includes = null;
                used_includes.append ("glib.h");
@@ -113,19 +117,19 @@ public class Vala.CodeGenerator : CodeVisitor {
                
                foreach (string filename1 in source_file.get_header_external_includes ()) {
                        if (used_includes.find_custom (filename1, strcmp) == null) {
-                               header_begin.append (new CCodeIncludeDirective (filename = filename1));
+                               header_begin.append (new CCodeIncludeDirective (filename1));
                                used_includes.append (filename1);
                        }
                }
                foreach (string filename2 in source_file.get_header_internal_includes ()) {
                        if (used_includes.find_custom (filename2, strcmp) == null) {
-                               header_begin.append (new CCodeIncludeDirective (filename = filename2));
+                               header_begin.append (new CCodeIncludeDirective (filename2));
                                used_includes.append (filename2);
                        }
                }
                foreach (string filename3 in source_file.get_source_includes ()) {
                        if (used_includes.find_custom (filename3, strcmp) == null) {
-                               source_include_directives.append (new CCodeIncludeDirective (filename = filename3));
+                               source_include_directives.append (new CCodeIncludeDirective (filename3));
                                used_includes.append (filename3);
                        }
                }
@@ -135,12 +139,12 @@ public class Vala.CodeGenerator : CodeVisitor {
                                foreach (Namespace ns in namespaces) {
                                        var structs = ns.get_structs ();
                                        foreach (Struct st in structs) {
-                                               header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct _%s".printf (st.get_cname ()), declarator = new CCodeVariableDeclarator (name = st.get_cname ())));
+                                               header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (st.get_cname ()), new CCodeVariableDeclarator (st.get_cname ())));
                                        }
                                        var classes = ns.get_classes ();
                                        foreach (Class cl in classes) {
-                                               header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct _%s".printf (cl.get_cname ()), declarator = new CCodeVariableDeclarator (name = cl.get_cname ())));
-                                               header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct _%sClass".printf (cl.get_cname ()), declarator = new CCodeVariableDeclarator (name = "%sClass".printf (cl.get_cname ()))));
+                                               header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (cl.get_cname ()), new CCodeVariableDeclarator (cl.get_cname ())));
+                                               header_type_declaration.append (new CCodeTypeDefinition ("struct _%sClass".printf (cl.get_cname ()), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
                                        }
                                }
                        }
@@ -148,7 +152,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        private static ref string get_define_for_filename (string! filename) {
-               var define = String.new ("__");
+               var define = new String ("__");
                
                var i = filename;
                while (i.len () > 0) {
@@ -173,19 +177,19 @@ public class Vala.CodeGenerator : CodeVisitor {
                
                CCodeComment comment = null;
                if (source_file.comment != null) {
-                       comment = new CCodeComment (text = source_file.comment);
+                       comment = new CCodeComment (source_file.comment);
                }
 
-               var writer = new CCodeWriter (filename = source_file.get_cheader_filename ());
+               var writer = new CCodeWriter (source_file.get_cheader_filename ());
                if (comment != null) {
                        comment.write (writer);
                }
                writer.write_newline ();
-               var once = new CCodeOnceSection (define = header_define);
+               var once = new CCodeOnceSection (header_define);
                once.append (new CCodeNewline ());
                once.append (header_begin);
                once.append (new CCodeNewline ());
-               once.append (new CCodeIdentifier (name = "G_BEGIN_DECLS"));
+               once.append (new CCodeIdentifier ("G_BEGIN_DECLS"));
                once.append (new CCodeNewline ());
                once.append (new CCodeNewline ());
                once.append (header_type_declaration);
@@ -194,13 +198,13 @@ public class Vala.CodeGenerator : CodeVisitor {
                once.append (new CCodeNewline ());
                once.append (header_type_member_declaration);
                once.append (new CCodeNewline ());
-               once.append (new CCodeIdentifier (name = "G_END_DECLS"));
+               once.append (new CCodeIdentifier ("G_END_DECLS"));
                once.append (new CCodeNewline ());
                once.append (new CCodeNewline ());
                once.write (writer);
                writer.close ();
                
-               writer = new CCodeWriter (filename = source_file.get_csource_filename ());
+               writer = new CCodeWriter (source_file.get_csource_filename ());
                if (comment != null) {
                        comment.write (writer);
                }
@@ -228,52 +232,52 @@ public class Vala.CodeGenerator : CodeVisitor {
                current_symbol = cl.symbol;
                current_type_symbol = cl.symbol;
 
-               instance_struct = new CCodeStruct (name = "_%s".printf (cl.get_cname ()));
-               type_struct = new CCodeStruct (name = "_%sClass".printf (cl.get_cname ()));
-               instance_priv_struct = new CCodeStruct (name = "_%sPrivate".printf (cl.get_cname ()));
+               instance_struct = new CCodeStruct ("_%s".printf (cl.get_cname ()));
+               type_struct = new CCodeStruct ("_%sClass".printf (cl.get_cname ()));
+               instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (cl.get_cname ()));
                prop_enum = new CCodeEnum ();
                prop_enum.add_value ("%s_DUMMY_PROPERTY".printf (cl.get_upper_case_cname (null)), null);
                
                
                header_type_declaration.append (new CCodeNewline ());
                var macro = "(%s_get_type ())".printf (cl.get_lower_case_cname (null));
-               header_type_declaration.append (new CCodeMacroReplacement (name = cl.get_upper_case_cname ("TYPE_"), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement (cl.get_upper_case_cname ("TYPE_"), macro));
 
                macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (cl.get_upper_case_cname ("TYPE_"), cl.get_cname ());
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s(obj)".printf (cl.get_upper_case_cname (null)), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (cl.get_upper_case_cname (null)), macro));
 
                macro = "(G_TYPE_CHECK_CLASS_CAST ((klass), %s, %sClass))".printf (cl.get_upper_case_cname ("TYPE_"), cl.get_cname ());
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s_CLASS(klass)".printf (cl.get_upper_case_cname (null)), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (cl.get_upper_case_cname (null)), macro));
 
                macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (cl.get_upper_case_cname ("TYPE_"));
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s(obj)".printf (cl.get_upper_case_cname ("IS_")), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (cl.get_upper_case_cname ("IS_")), macro));
 
                macro = "(G_TYPE_CHECK_CLASS_TYPE ((klass), %s))".printf (cl.get_upper_case_cname ("TYPE_"));
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s_CLASS(klass)".printf (cl.get_upper_case_cname ("IS_")), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (cl.get_upper_case_cname ("IS_")), macro));
 
                macro = "(G_TYPE_INSTANCE_GET_CLASS ((obj), %s, %sClass))".printf (cl.get_upper_case_cname ("TYPE_"), cl.get_cname ());
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s_GET_CLASS(obj)".printf (cl.get_upper_case_cname (null)), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s_GET_CLASS(obj)".printf (cl.get_upper_case_cname (null)), macro));
                header_type_declaration.append (new CCodeNewline ());
 
 
                if (cl.source_reference.file.cycle == null) {
-                       header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct %s".printf (instance_struct.name), declarator = new CCodeVariableDeclarator (name = cl.get_cname ())));
-                       header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct %s".printf (type_struct.name), declarator = new CCodeVariableDeclarator (name = "%sClass".printf (cl.get_cname ()))));
+                       header_type_declaration.append (new CCodeTypeDefinition ("struct %s".printf (instance_struct.name), new CCodeVariableDeclarator (cl.get_cname ())));
+                       header_type_declaration.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
                }
-               header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct %s".printf (instance_priv_struct.name), declarator = new CCodeVariableDeclarator (name = "%sPrivate".printf (cl.get_cname ()))));
+               header_type_declaration.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");
                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) {
-                       header_type_definition.append (new CCodeComment (text = cl.source_reference.comment));
+                       header_type_definition.append (new CCodeComment (cl.source_reference.comment));
                }
                header_type_definition.append (instance_struct);
                header_type_definition.append (type_struct);
                source_type_member_declaration.append (instance_priv_struct);
                macro = "(G_TYPE_INSTANCE_GET_PRIVATE ((o), %s, %sPrivate))".printf (cl.get_upper_case_cname ("TYPE_"), cl.get_cname ());
-               source_type_member_declaration.append (new CCodeMacroReplacement (name = "%s_GET_PRIVATE(o)".printf (cl.get_upper_case_cname (null)), replacement = macro));
+               source_type_member_declaration.append (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (cl.get_upper_case_cname (null)), macro));
                source_type_member_declaration.append (prop_enum);
        }
        
@@ -293,7 +297,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        add_dispose_function (cl);
                }
                
-               var type_fun = new ClassRegisterFunction (class_reference = cl);
+               var type_fun = new ClassRegisterFunction (cl);
                type_fun.init_from_type ();
                header_type_member_declaration.append (type_fun.get_declaration ());
                source_type_member_definition.append (type_fun);
@@ -302,8 +306,8 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        private void add_class_init_function (Class! cl) {
-               var class_init = new CCodeFunction (name = "%s_class_init".printf (cl.get_lower_case_cname (null)), return_type = "void");
-               class_init.add_parameter (new CCodeFormalParameter (type_name = "%sClass *".printf (cl.get_cname ()), name = "klass"));
+               var class_init = new CCodeFunction ("%s_class_init".printf (cl.get_lower_case_cname (null)), "void");
+               class_init.add_parameter (new CCodeFormalParameter ("klass", "%sClass *".printf (cl.get_cname ())));
                class_init.modifiers = CCodeModifiers.STATIC;
                
                var init_block = new CCodeBlock ();
@@ -312,27 +316,27 @@ public class Vala.CodeGenerator : CodeVisitor {
                ref CCodeFunctionCall ccall;
                
                if (cl.has_private_fields) {
-                       ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_class_add_private"));
-                       ccall.add_argument (new CCodeIdentifier (name = "klass"));
-                       ccall.add_argument (new CCodeConstant (name = "sizeof (%sPrivate)".printf (cl.get_cname ())));
-                       init_block.add_statement (new CCodeExpressionStatement (expression = ccall));
+                       ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_add_private"));
+                       ccall.add_argument (new CCodeIdentifier ("klass"));
+                       ccall.add_argument (new CCodeConstant ("sizeof (%sPrivate)".printf (cl.get_cname ())));
+                       init_block.add_statement (new CCodeExpressionStatement (ccall));
                }
                
-               ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT_CLASS"));
-               ccall.add_argument (new CCodeIdentifier (name = "klass"));
-               init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ccall, member_name = "get_property", is_pointer = true), right = new CCodeIdentifier (name = "%s_get_property".printf (cl.get_lower_case_cname (null))))));
-               init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ccall, member_name = "set_property", is_pointer = true), right = new CCodeIdentifier (name = "%s_set_property".printf (cl.get_lower_case_cname (null))))));
+               ccall = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
+               ccall.add_argument (new CCodeIdentifier ("klass"));
+               init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccall, "get_property"), new CCodeIdentifier ("%s_get_property".printf (cl.get_lower_case_cname (null))))));
+               init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccall, "set_property"), new CCodeIdentifier ("%s_set_property".printf (cl.get_lower_case_cname (null))))));
                
                if (cl.constructor != null) {
-                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT_CLASS"));
-                       ccast.add_argument (new CCodeIdentifier (name = "klass"));
-                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ccast, member_name = "constructor", is_pointer = true), right = new CCodeIdentifier (name = "%s_constructor".printf (cl.get_lower_case_cname (null))))));
+                       var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
+                       ccast.add_argument (new CCodeIdentifier ("klass"));
+                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "constructor"), new CCodeIdentifier ("%s_constructor".printf (cl.get_lower_case_cname (null))))));
                }
 
                if (memory_management && cl.get_fields () != null) {
-                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT_CLASS"));
-                       ccast.add_argument (new CCodeIdentifier (name = "klass"));
-                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ccast, member_name = "dispose", is_pointer = true), right = new CCodeIdentifier (name = "%s_dispose".printf (cl.get_lower_case_cname (null))))));
+                       var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
+                       ccast.add_argument (new CCodeIdentifier ("klass"));
+                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "dispose"), new CCodeIdentifier ("%s_dispose".printf (cl.get_lower_case_cname (null))))));
                }
                
                var methods = cl.get_methods ();
@@ -346,37 +350,37 @@ public class Vala.CodeGenerator : CodeVisitor {
                                continue;
                        }
                        
-                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
-                       ccast.add_argument (new CCodeIdentifier (name = "klass"));
-                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ccast, member_name = m.name, is_pointer = true), right = new CCodeIdentifier (name = m.get_real_cname ()))));
+                       var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
+                       ccast.add_argument (new CCodeIdentifier ("klass"));
+                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, m.name), new CCodeIdentifier (m.get_real_cname ()))));
                }
                
                var props = cl.get_properties ();
                foreach (Property prop in props) {
-                       var cinst = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_class_install_property"));
+                       var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_class_install_property"));
                        cinst.add_argument (ccall);
-                       cinst.add_argument (new CCodeConstant (name = prop.get_upper_case_cname ()));
+                       cinst.add_argument (new CCodeConstant (prop.get_upper_case_cname ()));
                        var cspec = new CCodeFunctionCall ();
                        cspec.add_argument (prop.get_canonical_cconstant ());
-                       cspec.add_argument (new CCodeConstant (name = "\"foo\""));
-                       cspec.add_argument (new CCodeConstant (name = "\"bar\""));
+                       cspec.add_argument (new CCodeConstant ("\"foo\""));
+                       cspec.add_argument (new CCodeConstant ("\"bar\""));
                        if (prop.type_reference.data_type is Class) {
-                               cspec.call = new CCodeIdentifier (name = "g_param_spec_object");
-                               cspec.add_argument (new CCodeIdentifier (name = prop.type_reference.data_type.get_upper_case_cname ("TYPE_")));
+                               cspec.call = new CCodeIdentifier ("g_param_spec_object");
+                               cspec.add_argument (new CCodeIdentifier (prop.type_reference.data_type.get_upper_case_cname ("TYPE_")));
                        } else if (prop.type_reference.data_type == string_type.data_type) {
-                               cspec.call = new CCodeIdentifier (name = "g_param_spec_string");
-                               cspec.add_argument (new CCodeConstant (name = "NULL"));
+                               cspec.call = new CCodeIdentifier ("g_param_spec_string");
+                               cspec.add_argument (new CCodeConstant ("NULL"));
                        } else if (prop.type_reference.data_type == int_type.data_type
                                   || prop.type_reference.data_type is Enum) {
-                               cspec.call = new CCodeIdentifier (name = "g_param_spec_int");
-                               cspec.add_argument (new CCodeConstant (name = "G_MININT"));
-                               cspec.add_argument (new CCodeConstant (name = "G_MAXINT"));
-                               cspec.add_argument (new CCodeConstant (name = "0"));
+                               cspec.call = new CCodeIdentifier ("g_param_spec_int");
+                               cspec.add_argument (new CCodeConstant ("G_MININT"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXINT"));
+                               cspec.add_argument (new CCodeConstant ("0"));
                        } else if (prop.type_reference.data_type == bool_type.data_type) {
-                               cspec.call = new CCodeIdentifier (name = "g_param_spec_boolean");
-                               cspec.add_argument (new CCodeConstant (name = "FALSE"));
+                               cspec.call = new CCodeIdentifier ("g_param_spec_boolean");
+                               cspec.add_argument (new CCodeConstant ("FALSE"));
                        } else {
-                               cspec.call = new CCodeIdentifier (name = "g_param_spec_pointer");
+                               cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
                        }
                        
                        var pflags = "G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB";
@@ -393,40 +397,40 @@ public class Vala.CodeGenerator : CodeVisitor {
                                        }
                                }
                        }
-                       cspec.add_argument (new CCodeConstant (name = pflags));
+                       cspec.add_argument (new CCodeConstant (pflags));
                        cinst.add_argument (cspec);
                        
-                       init_block.add_statement (new CCodeExpressionStatement (expression = cinst));
+                       init_block.add_statement (new CCodeExpressionStatement (cinst));
                }
                
                foreach (Signal sig in cl.get_signals ()) {
-                       var csignew = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_signal_new"));
-                       csignew.add_argument (new CCodeConstant (name = "\"%s\"".printf (sig.name)));
-                       csignew.add_argument (new CCodeIdentifier (name = cl.get_upper_case_cname ("TYPE_")));
-                       csignew.add_argument (new CCodeConstant (name = "G_SIGNAL_RUN_LAST"));
-                       csignew.add_argument (new CCodeConstant (name = "0"));
-                       csignew.add_argument (new CCodeConstant (name = "NULL"));
-                       csignew.add_argument (new CCodeConstant (name = "NULL"));
+                       var csignew = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_new"));
+                       csignew.add_argument (new CCodeConstant ("\"%s\"".printf (sig.name)));
+                       csignew.add_argument (new CCodeIdentifier (cl.get_upper_case_cname ("TYPE_")));
+                       csignew.add_argument (new CCodeConstant ("G_SIGNAL_RUN_LAST"));
+                       csignew.add_argument (new CCodeConstant ("0"));
+                       csignew.add_argument (new CCodeConstant ("NULL"));
+                       csignew.add_argument (new CCodeConstant ("NULL"));
                        
                        /* TODO: generate marshallers */
                        string marshaller = "g_cclosure_marshal";
                        
-                       var marshal_arg = new CCodeIdentifier (name = marshaller);
+                       var marshal_arg = new CCodeIdentifier (marshaller);
                        csignew.add_argument (marshal_arg);
                        
                        var params = sig.get_parameters ();
                        var params_len = params.length ();
                        if (sig.return_type.data_type == null) {
                                marshaller = "%s_VOID_".printf (marshaller);
-                               csignew.add_argument (new CCodeConstant (name = "G_TYPE_NONE"));
+                               csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
                        } else {
                                marshaller = "%s_%s_".printf (marshaller, sig.return_type.data_type.get_marshaller_type_name ());
-                               csignew.add_argument (new CCodeConstant (name = sig.return_type.data_type.get_type_id ()));
+                               csignew.add_argument (new CCodeConstant (sig.return_type.data_type.get_type_id ()));
                        }
-                       csignew.add_argument (new CCodeConstant (name = "%d".printf (params_len)));
+                       csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
                        foreach (FormalParameter param in params) {
                                marshaller = "%s_%s".printf (marshaller, param.type_reference.data_type.get_marshaller_type_name ());
-                               csignew.add_argument (new CCodeConstant (name = param.type_reference.data_type.get_type_id ()));
+                               csignew.add_argument (new CCodeConstant (param.type_reference.data_type.get_type_id ()));
                        }
                        
                        if (params_len == 0) {
@@ -435,15 +439,15 @@ public class Vala.CodeGenerator : CodeVisitor {
                        
                        marshal_arg.name = marshaller;
                        
-                       init_block.add_statement (new CCodeExpressionStatement (expression = csignew));
+                       init_block.add_statement (new CCodeExpressionStatement (csignew));
                }
                
                source_type_member_definition.append (class_init);
        }
        
        private void add_interface_init_function (Class! cl, Interface! iface) {
-               var iface_init = new CCodeFunction (name = "%s_%s_interface_init".printf (cl.get_lower_case_cname (null), iface.get_lower_case_cname (null)), return_type = "void");
-               iface_init.add_parameter (new CCodeFormalParameter (type_name = "%sInterface *".printf (iface.get_cname ()), name = "iface"));
+               var iface_init = new CCodeFunction ("%s_%s_interface_init".printf (cl.get_lower_case_cname (null), iface.get_lower_case_cname (null)), "void");
+               iface_init.add_parameter (new CCodeFormalParameter ("iface", "%sInterface *".printf (iface.get_cname ())));
                iface_init.modifiers = CCodeModifiers.STATIC;
                
                var init_block = new CCodeBlock ();
@@ -462,25 +466,25 @@ public class Vala.CodeGenerator : CodeVisitor {
                                continue;
                        }
                        
-                       var ciface = new CCodeIdentifier (name = "iface");
-                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = ciface, member_name = m.name, is_pointer = true), right = new CCodeIdentifier (name = m.get_real_cname ()))));
+                       var ciface = new CCodeIdentifier ("iface");
+                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ciface, m.name), new CCodeIdentifier (m.get_real_cname ()))));
                }
                
                source_type_member_definition.append (iface_init);
        }
        
        private void add_instance_init_function (Class! cl) {
-               var instance_init = new CCodeFunction (name = "%s_init".printf (cl.get_lower_case_cname (null)), return_type = "void");
-               instance_init.add_parameter (new CCodeFormalParameter (type_name = "%s *".printf (cl.get_cname ()), name = "self"));
+               var instance_init = new CCodeFunction ("%s_init".printf (cl.get_lower_case_cname (null)), "void");
+               instance_init.add_parameter (new CCodeFormalParameter ("self", "%s *".printf (cl.get_cname ())));
                instance_init.modifiers = CCodeModifiers.STATIC;
                
                var init_block = new CCodeBlock ();
                instance_init.block = init_block;
                
                if (cl.has_private_fields) {
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
-                       ccall.add_argument (new CCodeIdentifier (name = "self"));
-                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeMemberAccess (inner = new CCodeIdentifier (name = "self"), member_name = "priv", is_pointer = true), right = ccall)));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
+                       ccall.add_argument (new CCodeIdentifier ("self"));
+                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), ccall)));
                }
                
                var fields = cl.get_fields ();
@@ -489,15 +493,15 @@ public class Vala.CodeGenerator : CodeVisitor {
                                ref CCodeExpression lhs = null;
                                if (f.instance) {
                                        if (f.access == MemberAccessibility.PRIVATE) {
-                                               lhs = new CCodeMemberAccess (inner = new CCodeMemberAccess (inner = new CCodeIdentifier (name = "self"), member_name = "priv", is_pointer = true), member_name = f.get_cname (), is_pointer = true);
+                                               lhs = new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), f.get_cname ());
                                        } else {
-                                               lhs = new CCodeMemberAccess (inner = new CCodeIdentifier (name = "self"), member_name = f.get_cname (), is_pointer = true);
+                                               lhs = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), f.get_cname ());
                                        }
                                } /* else {
-                                       lhs = new CCodeIdentifier (name = "%s_%s".printf (cl.get_lower_case_cname (null), f.get_cname ()));
+                                       lhs = new CCodeIdentifier ("%s_%s".printf (cl.get_lower_case_cname (null), f.get_cname ()));
                                } */
                                if (lhs != null)  {
-                                       init_block.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = lhs, right = f.initializer.ccodenode)));
+                                       init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (lhs, (CCodeExpression) f.initializer.ccodenode)));
                                }
                        }
                }
@@ -512,21 +516,21 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        private void add_dispose_function (Class! cl) {
-               function = new CCodeFunction (name = "%s_dispose".printf (cl.get_lower_case_cname (null)), return_type = "void");
+               function = new CCodeFunction ("%s_dispose".printf (cl.get_lower_case_cname (null)), "void");
                function.modifiers = CCodeModifiers.STATIC;
                
-               function.add_parameter (new CCodeFormalParameter (name = "obj", type_name = "GObject *"));
+               function.add_parameter (new CCodeFormalParameter ("obj", "GObject *"));
                
                source_type_member_declaration.append (function.copy ());
 
 
                var cblock = new CCodeBlock ();
 
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = cl.get_upper_case_cname (null)));
-               ccall.add_argument (new CCodeIdentifier (name = "obj"));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null)));
+               ccall.add_argument (new CCodeIdentifier ("obj"));
                
-               var cdecl = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "self", initializer = ccall));
+               var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
                
                cblock.add_statement (cdecl);
                
@@ -534,43 +538,43 @@ public class Vala.CodeGenerator : CodeVisitor {
                var fields = cl.get_fields ();
                foreach (Field f in fields) {
                        if (f.instance && f.type_reference.takes_ownership) {
-                               var cself = new CCodeIdentifier (name = "self");
+                               var cself = new CCodeIdentifier ("self");
                                CCodeExpression cstruct = cself;
                                if (f.access == MemberAccessibility.PRIVATE) {
-                                       cstruct = new CCodeMemberAccess (inner = cself, member_name = "priv", is_pointer = true);
+                                       cstruct = new CCodeMemberAccess.pointer (cself, "priv");
                                }
-                               var cfield = new CCodeMemberAccess (inner = cstruct, member_name = f.get_cname (), is_pointer = true);
+                               var cfield = new CCodeMemberAccess.pointer (cstruct, f.get_cname ());
 
-                               cblock.add_statement (new CCodeExpressionStatement (expression = get_unref_expression (cfield, f.type_reference)));
+                               cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (cfield, f.type_reference)));
                        }
                }
 
 
-               cdecl = new CCodeDeclaration (type_name = "%sClass *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "klass"));
+               cdecl = new CCodeDeclaration ("%sClass *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator ("klass"));
                cblock.add_statement (cdecl);
 
-               cdecl = new CCodeDeclaration (type_name = "GObjectClass *");
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "parent_class"));
+               cdecl = new CCodeDeclaration ("GObjectClass *");
+               cdecl.add_declarator (new CCodeVariableDeclarator ("parent_class"));
                cblock.add_statement (cdecl);
 
 
-               ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_class_peek"));
-               ccall.add_argument (new CCodeIdentifier (name = cl.get_upper_case_cname ("TYPE_")));
-               var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_CLASS".printf (cl.get_upper_case_cname (null))));
+               ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek"));
+               ccall.add_argument (new CCodeIdentifier (cl.get_upper_case_cname ("TYPE_")));
+               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (cl.get_upper_case_cname (null))));
                ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "klass"), right = ccast)));
+               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("klass"), ccast)));
 
-               ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_class_peek_parent"));
-               ccall.add_argument (new CCodeIdentifier (name = "klass"));
-               ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT_CLASS"));
+               ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek_parent"));
+               ccall.add_argument (new CCodeIdentifier ("klass"));
+               ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "parent_class"), right = ccast)));
+               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("parent_class"), ccast)));
 
                
-               ccall = new CCodeFunctionCall (call = new CCodeMemberAccess (inner = new CCodeIdentifier (name = "parent_class"), member_name = "dispose", is_pointer = true));
-               ccall.add_argument (new CCodeIdentifier (name = "obj"));
-               cblock.add_statement (new CCodeExpressionStatement (expression = ccall));
+               ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (new CCodeIdentifier ("parent_class"), "dispose"));
+               ccall.add_argument (new CCodeIdentifier ("obj"));
+               cblock.add_statement (new CCodeExpressionStatement (ccall));
 
 
                function.block = cblock;
@@ -580,49 +584,49 @@ public class Vala.CodeGenerator : CodeVisitor {
        
        private ref CCodeIdentifier! get_value_setter_function (TypeReference! type_reference) {
                if (type_reference.data_type is Class) {
-                       return new CCodeIdentifier (name = "g_value_set_object");
+                       return new CCodeIdentifier ("g_value_set_object");
                } else if (type_reference.data_type == string_type.data_type) {
-                       return new CCodeIdentifier (name = "g_value_set_string");
+                       return new CCodeIdentifier ("g_value_set_string");
                } else if (type_reference.type_name == "int"
                           || type_reference.data_type is Enum) {
-                       return new CCodeIdentifier (name = "g_value_set_int");
+                       return new CCodeIdentifier ("g_value_set_int");
                } else if (type_reference.data_type == bool_type.data_type) {
-                       return new CCodeIdentifier (name = "g_value_set_boolean");
+                       return new CCodeIdentifier ("g_value_set_boolean");
                } else {
-                       return new CCodeIdentifier (name = "g_value_set_pointer");
+                       return new CCodeIdentifier ("g_value_set_pointer");
                }
        }
        
        private void add_get_property_function (Class! cl) {
-               var get_prop = new CCodeFunction (name = "%s_get_property".printf (cl.get_lower_case_cname (null)), return_type = "void");
-               get_prop.add_parameter (new CCodeFormalParameter (type_name = "GObject *", name = "object"));
-               get_prop.add_parameter (new CCodeFormalParameter (type_name = "guint", name = "property_id"));
-               get_prop.add_parameter (new CCodeFormalParameter (type_name = "GValue *", name = "value"));
-               get_prop.add_parameter (new CCodeFormalParameter (type_name = "GParamSpec *", name = "pspec"));
+               var get_prop = new CCodeFunction ("%s_get_property".printf (cl.get_lower_case_cname (null)), "void");
+               get_prop.add_parameter (new CCodeFormalParameter ("object", "GObject *"));
+               get_prop.add_parameter (new CCodeFormalParameter ("property_id", "guint"));
+               get_prop.add_parameter (new CCodeFormalParameter ("value", "GValue *"));
+               get_prop.add_parameter (new CCodeFormalParameter ("pspec", "GParamSpec *"));
                
                var block = new CCodeBlock ();
                
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = cl.get_upper_case_cname (null)));
-               ccall.add_argument (new CCodeIdentifier (name = "object"));
-               var cdecl = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "self", initializer = ccall));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null)));
+               ccall.add_argument (new CCodeIdentifier ("object"));
+               var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
                block.add_statement (cdecl);
                
-               var cswitch = new CCodeSwitchStatement (expression = new CCodeIdentifier (name = "property_id"));
+               var cswitch = new CCodeSwitchStatement (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
                foreach (Property prop in props) {
                        if (prop.get_accessor == null) {
                                continue;
                        }
 
-                       var ccase = new CCodeCaseStatement (expression = new CCodeIdentifier (name = prop.get_upper_case_cname ()));
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name)));
-                       ccall.add_argument (new CCodeIdentifier (name = "self"));
+                       var ccase = new CCodeCaseStatement (new CCodeIdentifier (prop.get_upper_case_cname ()));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name)));
+                       ccall.add_argument (new CCodeIdentifier ("self"));
                        var csetcall = new CCodeFunctionCall ();
                        csetcall.call = get_value_setter_function (prop.type_reference);
-                       csetcall.add_argument (new CCodeIdentifier (name = "value"));
+                       csetcall.add_argument (new CCodeIdentifier ("value"));
                        csetcall.add_argument (ccall);
-                       ccase.add_statement (new CCodeExpressionStatement (expression = csetcall));
+                       ccase.add_statement (new CCodeExpressionStatement (csetcall));
                        ccase.add_statement (new CCodeBreakStatement ());
                        cswitch.add_case (ccase);
                }
@@ -634,46 +638,46 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        private void add_set_property_function (Class! cl) {
-               var set_prop = new CCodeFunction (name = "%s_set_property".printf (cl.get_lower_case_cname (null)), return_type = "void");
-               set_prop.add_parameter (new CCodeFormalParameter (type_name = "GObject *", name = "object"));
-               set_prop.add_parameter (new CCodeFormalParameter (type_name = "guint", name = "property_id"));
-               set_prop.add_parameter (new CCodeFormalParameter (type_name = "const GValue *", name = "value"));
-               set_prop.add_parameter (new CCodeFormalParameter (type_name = "GParamSpec *", name = "pspec"));
+               var set_prop = new CCodeFunction ("%s_set_property".printf (cl.get_lower_case_cname (null)), "void");
+               set_prop.add_parameter (new CCodeFormalParameter ("object", "GObject *"));
+               set_prop.add_parameter (new CCodeFormalParameter ("property_id", "guint"));
+               set_prop.add_parameter (new CCodeFormalParameter ("value", "const GValue *"));
+               set_prop.add_parameter (new CCodeFormalParameter ("pspec", "GParamSpec *"));
                
                var block = new CCodeBlock ();
                
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = cl.get_upper_case_cname (null)));
-               ccall.add_argument (new CCodeIdentifier (name = "object"));
-               var cdecl = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "self", initializer = ccall));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null)));
+               ccall.add_argument (new CCodeIdentifier ("object"));
+               var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
                block.add_statement (cdecl);
                
-               var cswitch = new CCodeSwitchStatement (expression = new CCodeIdentifier (name = "property_id"));
+               var cswitch = new CCodeSwitchStatement (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
                foreach (Property prop in props) {
                        if (prop.set_accessor == null) {
                                continue;
                        }
 
-                       var ccase = new CCodeCaseStatement (expression = new CCodeIdentifier (name = prop.get_upper_case_cname ()));
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name)));
-                       ccall.add_argument (new CCodeIdentifier (name = "self"));
+                       var ccase = new CCodeCaseStatement (new CCodeIdentifier (prop.get_upper_case_cname ()));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name)));
+                       ccall.add_argument (new CCodeIdentifier ("self"));
                        var cgetcall = new CCodeFunctionCall ();
                        if (prop.type_reference.data_type is Class) {
-                               cgetcall.call = new CCodeIdentifier (name = "g_value_get_object");
+                               cgetcall.call = new CCodeIdentifier ("g_value_get_object");
                        } else if (prop.type_reference.type_name == "string") {
-                               cgetcall.call = new CCodeIdentifier (name = "g_value_get_string");
+                               cgetcall.call = new CCodeIdentifier ("g_value_get_string");
                        } else if (prop.type_reference.type_name == "int"
                                  || prop.type_reference.data_type is Enum) {
-                               cgetcall.call = new CCodeIdentifier (name = "g_value_get_int");
+                               cgetcall.call = new CCodeIdentifier ("g_value_get_int");
                        } else if (prop.type_reference.type_name == "bool") {
-                               cgetcall.call = new CCodeIdentifier (name = "g_value_get_boolean");
+                               cgetcall.call = new CCodeIdentifier ("g_value_get_boolean");
                        } else {
-                               cgetcall.call = new CCodeIdentifier (name = "g_value_get_pointer");
+                               cgetcall.call = new CCodeIdentifier ("g_value_get_pointer");
                        }
-                       cgetcall.add_argument (new CCodeIdentifier (name = "value"));
+                       cgetcall.add_argument (new CCodeIdentifier ("value"));
                        ccall.add_argument (cgetcall);
-                       ccase.add_statement (new CCodeExpressionStatement (expression = ccall));
+                       ccase.add_statement (new CCodeExpressionStatement (ccall));
                        ccase.add_statement (new CCodeBreakStatement ());
                        cswitch.add_case (ccase);
                }
@@ -685,10 +689,10 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        public override void visit_begin_struct (Struct! st) {
-               instance_struct = new CCodeStruct (name = "_%s".printf (st.name));
+               instance_struct = new CCodeStruct ("_%s".printf (st.name));
 
                if (st.source_reference.comment != null) {
-                       header_type_definition.append (new CCodeComment (text = st.source_reference.comment));
+                       header_type_definition.append (new CCodeComment (st.source_reference.comment));
                }
                header_type_definition.append (instance_struct);
        }
@@ -697,38 +701,38 @@ public class Vala.CodeGenerator : CodeVisitor {
                current_symbol = iface.symbol;
                current_type_symbol = iface.symbol;
 
-               type_struct = new CCodeStruct (name = "_%sInterface".printf (iface.get_cname ()));
+               type_struct = new CCodeStruct ("_%sInterface".printf (iface.get_cname ()));
                
                header_type_declaration.append (new CCodeNewline ());
                var macro = "(%s_get_type ())".printf (iface.get_lower_case_cname (null));
-               header_type_declaration.append (new CCodeMacroReplacement (name = iface.get_upper_case_cname ("TYPE_"), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement (iface.get_upper_case_cname ("TYPE_"), macro));
 
                macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_cname ());
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s(obj)".printf (iface.get_upper_case_cname (null)), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
 
                macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_upper_case_cname ("TYPE_"));
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s(obj)".printf (iface.get_upper_case_cname ("IS_")), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname ("IS_")), macro));
 
                macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %sInterface))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_cname ());
-               header_type_declaration.append (new CCodeMacroReplacement (name = "%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), replacement = macro));
+               header_type_declaration.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
                header_type_declaration.append (new CCodeNewline ());
 
 
                if (iface.source_reference.file.cycle == null) {
-                       header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct _%s".printf (iface.get_cname ()), declarator = new CCodeVariableDeclarator (name = iface.get_cname ())));
-                       header_type_declaration.append (new CCodeTypeDefinition (type_name = "struct %s".printf (type_struct.name), declarator = new CCodeVariableDeclarator (name = "%sInterface".printf (iface.get_cname ()))));
+                       header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
+                       header_type_declaration.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator ("%sInterface".printf (iface.get_cname ()))));
                }
                
                type_struct.add_field ("GTypeInterface", "parent");
 
                if (iface.source_reference.comment != null) {
-                       header_type_definition.append (new CCodeComment (text = iface.source_reference.comment));
+                       header_type_definition.append (new CCodeComment (iface.source_reference.comment));
                }
                header_type_definition.append (type_struct);
        }
 
        public override void visit_end_interface (Interface! iface) {
-               var type_fun = new InterfaceRegisterFunction (interface_reference = iface);
+               var type_fun = new InterfaceRegisterFunction (iface);
                type_fun.init_from_type ();
                header_type_member_declaration.append (type_fun.get_declaration ());
                source_type_member_definition.append (type_fun);
@@ -737,10 +741,10 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        public override void visit_begin_enum (Enum! en) {
-               cenum = new CCodeEnum (name = en.get_cname ());
+               cenum = new CCodeEnum (en.get_cname ());
 
                if (en.source_reference.comment != null) {
-                       header_type_definition.append (new CCodeComment (text = en.source_reference.comment));
+                       header_type_definition.append (new CCodeComment (en.source_reference.comment));
                }
                header_type_definition.append (cenum);
        }
@@ -750,15 +754,12 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
 
        public override void visit_end_callback (Callback! cb) {
-               var ctypedef = new CCodeTypeDefinition ();
-               
-               ctypedef.type_name = cb.return_type.get_cname ();
-               
-               var cfundecl = new CCodeFunctionDeclarator (name = cb.get_cname ());
+               var cfundecl = new CCodeFunctionDeclarator (cb.get_cname ());
                foreach (FormalParameter param in cb.get_parameters ()) {
                        cfundecl.add_parameter ((CCodeFormalParameter) param.ccodenode);
                }
-               ctypedef.declarator = cfundecl;
+               
+               var ctypedef = new CCodeTypeDefinition (cb.return_type.get_cname (), cfundecl);
                
                if (cb.access == MemberAccessibility.PUBLIC) {
                        header_type_declaration.append (ctypedef);
@@ -770,12 +771,12 @@ public class Vala.CodeGenerator : CodeVisitor {
        public override void visit_constant (Constant! c) {
                if (c.symbol.parent_symbol.node is DataType) {
                        var t = (DataType) c.symbol.parent_symbol.node;
-                       var cdecl = new CCodeDeclaration (type_name = c.type_reference.get_const_cname ());
+                       var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
                        var arr = "";
                        if (c.type_reference.data_type is Array) {
                                arr = "[]";
                        }
-                       cdecl.add_declarator (new CCodeVariableDeclarator (name = "%s%s".printf (c.get_cname (), arr), initializer = c.initializer.ccodenode));
+                       cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.initializer.ccodenode));
                        cdecl.modifiers = CCodeModifiers.STATIC;
                        source_type_member_declaration.append (cdecl);
                }
@@ -790,8 +791,8 @@ public class Vala.CodeGenerator : CodeVisitor {
                        } else {
                                if (f.symbol.parent_symbol.node is DataType) {
                                        var t = (DataType) f.symbol.parent_symbol.node;
-                                       var cdecl = new CCodeDeclaration (type_name = f.type_reference.get_cname ());
-                                       var var_decl = new CCodeVariableDeclarator (name = "%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ()));
+                                       var cdecl = new CCodeDeclaration (f.type_reference.get_cname ());
+                                       var var_decl = new CCodeVariableDeclarator ("%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ()));
                                        if (f.initializer != null) {
                                                var_decl.initializer = (CCodeExpression) f.initializer.ccodenode;
                                        }
@@ -823,42 +824,42 @@ public class Vala.CodeGenerator : CodeVisitor {
                var ccheck = new CCodeFunctionCall ();
                
                if (t is Class || t is Interface) {
-                       var ctype_check = new CCodeFunctionCall (call = new CCodeIdentifier (name = t.get_upper_case_cname ("IS_")));
-                       ctype_check.add_argument (new CCodeIdentifier (name = var_name));
+                       var ctype_check = new CCodeFunctionCall (new CCodeIdentifier (t.get_upper_case_cname ("IS_")));
+                       ctype_check.add_argument (new CCodeIdentifier (var_name));
                        
                        ref CCodeExpression cexpr = ctype_check;
                        if (!non_null) {
-                               var cnull = new CCodeBinaryExpression (operator = CCodeBinaryOperator.EQUALITY, left = new CCodeIdentifier (name = var_name), right = new CCodeConstant (name = "NULL"));
+                               var cnull = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new CCodeIdentifier (var_name), new CCodeConstant ("NULL"));
                        
-                               cexpr = new CCodeBinaryExpression (operator = CCodeBinaryOperator.OR, left = cnull, right = ctype_check);
+                               cexpr = new CCodeBinaryExpression (CCodeBinaryOperator.OR, cnull, ctype_check);
                        }
                        ccheck.add_argument (cexpr);
                } else if (!non_null) {
                        return null;
                } else {
-                       var cnonnull = new CCodeBinaryExpression (operator = CCodeBinaryOperator.INEQUALITY, left = new CCodeIdentifier (name = var_name), right = new CCodeConstant (name = "NULL"));
+                       var cnonnull = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier (var_name), new CCodeConstant ("NULL"));
                        ccheck.add_argument (cnonnull);
                }
                
                if (ret_type == null) {
                        /* void function */
-                       ccheck.call = new CCodeIdentifier (name = "g_return_if_fail");
+                       ccheck.call = new CCodeIdentifier ("g_return_if_fail");
                } else {
-                       ccheck.call = new CCodeIdentifier (name = "g_return_val_if_fail");
+                       ccheck.call = new CCodeIdentifier ("g_return_val_if_fail");
                        
                        if (ret_type.is_reference_type ()) {
-                               ccheck.add_argument (new CCodeConstant (name = "NULL"));
+                               ccheck.add_argument (new CCodeConstant ("NULL"));
                        } else if (ret_type.name == "bool") {
-                               ccheck.add_argument (new CCodeConstant (name = "FALSE"));
+                               ccheck.add_argument (new CCodeConstant ("FALSE"));
                        } else if (ret_type.name == "int" || ret_type.name == "long" || ret_type.name == "double" || ret_type.name == "float" || ret_type is Enum || ret_type is Flags) {
-                               ccheck.add_argument (new CCodeConstant (name = "0"));
+                               ccheck.add_argument (new CCodeConstant ("0"));
                        } else {
                                Report.error (method_node.source_reference, "not supported return type for runtime type checks");
                                return null;
                        }
                }
                
-               return new CCodeExpressionStatement (expression = ccheck);
+               return new CCodeExpressionStatement (ccheck);
        }
 
        private DataType find_parent_type (CodeNode node) {
@@ -875,7 +876,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        public override void visit_end_method (Method! m) {
                current_symbol = current_symbol.parent_symbol;
 
-               function = new CCodeFunction (name = m.get_real_cname (), return_type = m.return_type.get_cname ());
+               function = new CCodeFunction (m.get_real_cname (), m.return_type.get_cname ());
                CCodeFunctionDeclarator vdeclarator = null;
                
                CCodeFormalParameter instance_param = null;
@@ -884,19 +885,19 @@ public class Vala.CodeGenerator : CodeVisitor {
                        var this_type = new TypeReference ();
                        this_type.data_type = find_parent_type (m);
                        if (!m.overrides) {
-                               instance_param = new CCodeFormalParameter (type_name = this_type.get_cname (), name = "self");
+                               instance_param = new CCodeFormalParameter ("self", this_type.get_cname ());
                        } else {
                                var base_type = new TypeReference ();
                                base_type.data_type = (DataType) m.base_method.symbol.parent_symbol.node;
-                               instance_param = new CCodeFormalParameter (type_name = base_type.get_cname (), name = "base");
+                               instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
                        }
                        if (!m.instance_last) {
                                function.add_parameter (instance_param);
                        }
                        
                        if (m.is_abstract || m.is_virtual) {
-                               var vdecl = new CCodeDeclaration (type_name = m.return_type.get_cname ());
-                               vdeclarator = new CCodeFunctionDeclarator (name = m.name);
+                               var vdecl = new CCodeDeclaration (m.return_type.get_cname ());
+                               vdeclarator = new CCodeFunctionDeclarator (m.name);
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
 
@@ -941,11 +942,11 @@ public class Vala.CodeGenerator : CodeVisitor {
                                if (m.symbol.parent_symbol.node is Class) {
                                        var cl = (Class) m.symbol.parent_symbol.node;
                                        if (m.overrides) {
-                                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = cl.get_upper_case_cname (null)));
-                                               ccall.add_argument (new CCodeIdentifier (name = "base"));
+                                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null)));
+                                               ccall.add_argument (new CCodeIdentifier ("base"));
                                                
-                                               var cdecl = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
-                                               cdecl.add_declarator (new CCodeVariableDeclarator (name = "self", initializer = ccall));
+                                               var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
+                                               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
                                                
                                                cinit.append (cdecl);
                                        } else if (m.instance) {
@@ -963,34 +964,34 @@ public class Vala.CodeGenerator : CodeVisitor {
                                }
 
                                if (m.source_reference != null && m.source_reference.comment != null) {
-                                       source_type_member_definition.append (new CCodeComment (text = m.source_reference.comment));
+                                       source_type_member_definition.append (new CCodeComment (m.source_reference.comment));
                                }
                                source_type_member_definition.append (function);
                                
                                if (m.construction) {
                                        // declare construction parameter array
-                                       var cparamsinit = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_new0"));
-                                       cparamsinit.add_argument (new CCodeIdentifier (name = "GParameter"));
-                                       cparamsinit.add_argument (new CCodeConstant (name = m.n_construction_params.to_string ()));
+                                       var cparamsinit = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
+                                       cparamsinit.add_argument (new CCodeIdentifier ("GParameter"));
+                                       cparamsinit.add_argument (new CCodeConstant (m.n_construction_params.to_string ()));
                                        
-                                       var cdecl = new CCodeDeclaration (type_name = "GParameter *");
-                                       cdecl.add_declarator (new CCodeVariableDeclarator (name = "__params", initializer = cparamsinit));
+                                       var cdecl = new CCodeDeclaration ("GParameter *");
+                                       cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("__params", cparamsinit));
                                        cinit.append (cdecl);
                                        
-                                       cdecl = new CCodeDeclaration (type_name = "GParameter *");
-                                       cdecl.add_declarator (new CCodeVariableDeclarator (name = "__params_it", initializer = new CCodeIdentifier (name = "__params")));
+                                       cdecl = new CCodeDeclaration ("GParameter *");
+                                       cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("__params_it", new CCodeIdentifier ("__params")));
                                        cinit.append (cdecl);
                                }
                        }
                }
                
                if (m.is_abstract || m.is_virtual) {
-                       var vfunc = new CCodeFunction (name = m.get_cname (), return_type = m.return_type.get_cname ());
+                       var vfunc = new CCodeFunction (m.get_cname (), m.return_type.get_cname ());
 
                        var this_type = new TypeReference ();
                        this_type.data_type = (DataType) m.symbol.parent_symbol.node;
 
-                       var cparam = new CCodeFormalParameter (type_name = this_type.get_cname (), name = "self");
+                       var cparam = new CCodeFormalParameter ("self", this_type.get_cname ());
                        vfunc.add_parameter (cparam);
                        
                        var vblock = new CCodeBlock ();
@@ -999,24 +1000,24 @@ public class Vala.CodeGenerator : CodeVisitor {
                        if (m.symbol.parent_symbol.node is Interface) {
                                var iface = (Interface) m.symbol.parent_symbol.node;
 
-                               vcast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_GET_INTERFACE".printf (iface.get_upper_case_cname (null))));
+                               vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (iface.get_upper_case_cname (null))));
                        } else {
                                var cl = (Class) m.symbol.parent_symbol.node;
 
-                               vcast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
+                               vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
                        }
-                       vcast.add_argument (new CCodeIdentifier (name = "self"));
+                       vcast.add_argument (new CCodeIdentifier ("self"));
                
-                       var vcall = new CCodeFunctionCall (call = new CCodeMemberAccess (inner = vcast, member_name = m.name, is_pointer = true));
-                       vcall.add_argument (new CCodeIdentifier (name = "self"));
+                       var vcall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, m.name));
+                       vcall.add_argument (new CCodeIdentifier ("self"));
                
                        var params = m.get_parameters ();
                        foreach (FormalParameter param in params) {
                                vfunc.add_parameter ((CCodeFormalParameter) param.ccodenode);
-                               vcall.add_argument (new CCodeIdentifier (name = param.name));
+                               vcall.add_argument (new CCodeIdentifier (param.name));
                        }
 
-                       vblock.add_statement (new CCodeExpressionStatement (expression = vcall));
+                       vblock.add_statement (new CCodeExpressionStatement (vcall));
 
                        header_type_member_declaration.append (vfunc.copy ());
                        
@@ -1027,20 +1028,20 @@ public class Vala.CodeGenerator : CodeVisitor {
                
                if (m.construction) {
                        var creturn = new CCodeReturnStatement ();
-                       creturn.return_expression = new CCodeIdentifier (name = "self");
+                       creturn.return_expression = new CCodeIdentifier ("self");
                        function.block.add_statement (creturn);
                }
                
                if (m.name != null && m.name == "main") {
-                       var cmain = new CCodeFunction (name = "main", return_type = "int");
-                       cmain.add_parameter (new CCodeFormalParameter (type_name = "int", name = "argc"));
-                       cmain.add_parameter (new CCodeFormalParameter (type_name = "char **", name = "argv"));
+                       var cmain = new CCodeFunction ("main", "int");
+                       cmain.add_parameter (new CCodeFormalParameter ("argc", "int"));
+                       cmain.add_parameter (new CCodeFormalParameter ("argv", "char **"));
                        var main_block = new CCodeBlock ();
-                       main_block.add_statement (new CCodeExpressionStatement (expression = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_init"))));
-                       var main_call = new CCodeFunctionCall (call = new CCodeIdentifier (name = function.name));
-                       main_call.add_argument (new CCodeIdentifier (name = "argc"));
-                       main_call.add_argument (new CCodeIdentifier (name = "argv"));
-                       main_block.add_statement (new CCodeReturnStatement (return_expression = main_call));
+                       main_block.add_statement (new CCodeExpressionStatement (new CCodeFunctionCall (new CCodeIdentifier ("g_type_init"))));
+                       var main_call = new CCodeFunctionCall (new CCodeIdentifier (function.name));
+                       main_call.add_argument (new CCodeIdentifier ("argc"));
+                       main_call.add_argument (new CCodeIdentifier ("argv"));
+                       main_block.add_statement (new CCodeReturnStatement (main_call));
                        cmain.block = main_block;
                        source_type_member_definition.append (cmain);
                }
@@ -1048,7 +1049,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        
        public override void visit_formal_parameter (FormalParameter! p) {
                if (!p.ellipsis) {
-                       p.ccodenode = new CCodeFormalParameter (type_name = p.type_reference.get_cname (), name = p.name);
+                       p.ccodenode = new CCodeFormalParameter (p.name, p.type_reference.get_cname ());
                }
        }
 
@@ -1061,16 +1062,16 @@ public class Vala.CodeGenerator : CodeVisitor {
                var cl = (Class) prop.symbol.parent_symbol.node;
                
                if (acc.readable) {
-                       function = new CCodeFunction (name = "%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name), return_type = prop.type_reference.get_cname ());
+                       function = new CCodeFunction ("%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name), prop.type_reference.get_cname ());
                } else {
-                       function = new CCodeFunction (name = "%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name), return_type = "void");
+                       function = new CCodeFunction ("%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name), "void");
                }
                var this_type = new TypeReference ();
                this_type.data_type = cl;
-               var cparam = new CCodeFormalParameter (type_name = this_type.get_cname (), name = "self");
+               var cparam = new CCodeFormalParameter ("self", this_type.get_cname ());
                function.add_parameter (cparam);
                if (acc.writable || acc.construction) {
-                       function.add_parameter (new CCodeFormalParameter (type_name = prop.type_reference.get_cname (), name = "value"));
+                       function.add_parameter (new CCodeFormalParameter ("value", prop.type_reference.get_cname ()));
                }
                
                header_type_member_declaration.append (function.copy ());
@@ -1087,67 +1088,67 @@ public class Vala.CodeGenerator : CodeVisitor {
        public override void visit_end_constructor (Constructor! c) {
                var cl = (Class) c.symbol.parent_symbol.node;
        
-               function = new CCodeFunction (name = "%s_constructor".printf (cl.get_lower_case_cname (null)), return_type = "GObject *");
+               function = new CCodeFunction ("%s_constructor".printf (cl.get_lower_case_cname (null)), "GObject *");
                function.modifiers = CCodeModifiers.STATIC;
                
-               function.add_parameter (new CCodeFormalParameter (name = "type", type_name = "GType"));
-               function.add_parameter (new CCodeFormalParameter (name = "n_construct_properties", type_name = "guint"));
-               function.add_parameter (new CCodeFormalParameter (name = "construct_properties", type_name = "GObjectConstructParam *"));
+               function.add_parameter (new CCodeFormalParameter ("type", "GType"));
+               function.add_parameter (new CCodeFormalParameter ("n_construct_properties", "guint"));
+               function.add_parameter (new CCodeFormalParameter ("construct_properties", "GObjectConstructParam *"));
                
                source_type_member_declaration.append (function.copy ());
 
 
                var cblock = new CCodeBlock ();
-               var cdecl = new CCodeDeclaration (type_name = "GObject *");
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "obj"));
+               var cdecl = new CCodeDeclaration ("GObject *");
+               cdecl.add_declarator (new CCodeVariableDeclarator ("obj"));
                cblock.add_statement (cdecl);
 
-               cdecl = new CCodeDeclaration (type_name = "%sClass *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "klass"));
+               cdecl = new CCodeDeclaration ("%sClass *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator ("klass"));
                cblock.add_statement (cdecl);
 
-               cdecl = new CCodeDeclaration (type_name = "GObjectClass *");
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "parent_class"));
+               cdecl = new CCodeDeclaration ("GObjectClass *");
+               cdecl.add_declarator (new CCodeVariableDeclarator ("parent_class"));
                cblock.add_statement (cdecl);
 
 
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_class_peek"));
-               ccall.add_argument (new CCodeIdentifier (name = cl.get_upper_case_cname ("TYPE_")));
-               var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_CLASS".printf (cl.get_upper_case_cname (null))));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek"));
+               ccall.add_argument (new CCodeIdentifier (cl.get_upper_case_cname ("TYPE_")));
+               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (cl.get_upper_case_cname (null))));
                ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "klass"), right = ccast)));
+               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("klass"), ccast)));
 
-               ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_class_peek_parent"));
-               ccall.add_argument (new CCodeIdentifier (name = "klass"));
-               ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT_CLASS"));
+               ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek_parent"));
+               ccall.add_argument (new CCodeIdentifier ("klass"));
+               ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "parent_class"), right = ccast)));
+               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("parent_class"), ccast)));
 
                
-               ccall = new CCodeFunctionCall (call = new CCodeMemberAccess (inner = new CCodeIdentifier (name = "parent_class"), member_name = "constructor", is_pointer = true));
-               ccall.add_argument (new CCodeIdentifier (name = "type"));
-               ccall.add_argument (new CCodeIdentifier (name = "n_construct_properties"));
-               ccall.add_argument (new CCodeIdentifier (name = "construct_properties"));
-               cblock.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "obj"), right = ccall)));
+               ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (new CCodeIdentifier ("parent_class"), "constructor"));
+               ccall.add_argument (new CCodeIdentifier ("type"));
+               ccall.add_argument (new CCodeIdentifier ("n_construct_properties"));
+               ccall.add_argument (new CCodeIdentifier ("construct_properties"));
+               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("obj"), ccall)));
 
 
-               ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = cl.get_upper_case_cname (null)));
-               ccall.add_argument (new CCodeIdentifier (name = "obj"));
+               ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null)));
+               ccall.add_argument (new CCodeIdentifier ("obj"));
                
-               cdecl = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "self", initializer = ccall));
+               cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
+               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
                
                cblock.add_statement (cdecl);
 
 
                cblock.add_statement (c.body.ccodenode);
                
-               cblock.add_statement (new CCodeReturnStatement (return_expression = new CCodeIdentifier (name = "obj")));
+               cblock.add_statement (new CCodeReturnStatement (new CCodeIdentifier ("obj")));
                
                function.block = cblock;
 
                if (c.source_reference.comment != null) {
-                       source_type_member_definition.append (new CCodeComment (text = c.source_reference.comment));
+                       source_type_member_definition.append (new CCodeComment (c.source_reference.comment));
                }
                source_type_member_definition.append (function);
        }
@@ -1159,15 +1160,15 @@ public class Vala.CodeGenerator : CodeVisitor {
        private void add_object_creation (CCodeBlock! b) {
                var cl = (Class) current_type_symbol.node;
        
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_newv"));
-               ccall.add_argument (new CCodeConstant (name = cl.get_type_id ()));
-               ccall.add_argument (new CCodeConstant (name = "__params_it - __params"));
-               ccall.add_argument (new CCodeConstant (name = "__params"));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_newv"));
+               ccall.add_argument (new CCodeConstant (cl.get_type_id ()));
+               ccall.add_argument (new CCodeConstant ("__params_it - __params"));
+               ccall.add_argument (new CCodeConstant ("__params"));
                
-               var cdecl = new CCodeVariableDeclarator (name = "self");
+               var cdecl = new CCodeVariableDeclarator ("self");
                cdecl.initializer = ccall;
                
-               var cdeclaration = new CCodeDeclaration (type_name = "%s *".printf (cl.get_cname ()));
+               var cdeclaration = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
                cdeclaration.add_declarator (cdecl);
                
                b.add_statement (cdeclaration);
@@ -1192,7 +1193,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                
                        var src = stmt.source_reference;
                        if (src != null && src.comment != null) {
-                               cblock.add_statement (new CCodeComment (text = src.comment));
+                               cblock.add_statement (new CCodeComment (src.comment));
                        }
                        
                        if (stmt.ccodenode is CCodeFragment) {
@@ -1212,7 +1213,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (memory_management) {
                        foreach (VariableDeclarator decl in local_vars) {
                                if (decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) {
-                                       cblock.add_statement (new CCodeExpressionStatement (expression = get_unref_expression (new CCodeIdentifier (name = decl.name), decl.type_reference)));
+                                       cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference)));
                                }
                        }
                }
@@ -1233,7 +1234,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                var cfrag = new CCodeFragment ();
                
                foreach (VariableDeclarator decl in stmt.declaration.get_variable_declarators ()) {
-                       var cdecl = new CCodeDeclaration (type_name = decl.type_reference.get_cname ());
+                       var cdecl = new CCodeDeclaration (decl.type_reference.get_cname ());
                
                        cdecl.add_declarator ((CCodeVariableDeclarator) decl.ccodenode);
 
@@ -1258,13 +1259,13 @@ public class Vala.CodeGenerator : CodeVisitor {
                            && decl.initializer.static_type.data_type != null
                            && decl.type_reference.data_type.is_reference_type ()
                            && decl.initializer.static_type.data_type != decl.type_reference.data_type) {
-                               rhs = new InstanceCast (type_reference = decl.type_reference.data_type, inner = rhs);
+                               rhs = new InstanceCast (rhs, decl.type_reference.data_type);
                        }
                } else if (decl.type_reference.data_type != null && decl.type_reference.data_type.is_reference_type ()) {
-                       rhs = new CCodeConstant (name = "NULL");
+                       rhs = new CCodeConstant ("NULL");
                }
                        
-               decl.ccodenode = new CCodeVariableDeclarator (name = decl.name, initializer = rhs);
+               decl.ccodenode = new CCodeVariableDeclarator.with_initializer (decl.name, rhs);
 
                decl.symbol.active = true;
        }
@@ -1278,7 +1279,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
        
        private ref VariableDeclarator get_temp_variable_declarator (TypeReference! type) {
-               var decl = new VariableDeclarator (name = "__temp%d".printf (next_temp_var_id));
+               var decl = new VariableDeclarator ("__temp%d".printf (next_temp_var_id));
                decl.type_reference = type.copy ();
                decl.type_reference.reference_to_value_type = false;
                decl.type_reference.is_out = false;
@@ -1296,7 +1297,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                 * if foo is of static type non-null
                 */
 
-               var cisnull = new CCodeBinaryExpression (operator = CCodeBinaryOperator.EQUALITY, left = cvar, right = new CCodeConstant (name = "NULL"));
+               var cisnull = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, cvar, new CCodeConstant ("NULL"));
 
                string unref_function;
                if (type.data_type.is_reference_counting ()) {
@@ -1308,7 +1309,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (type.data_type is Array && ((Array) type.data_type).element_type.name == "string") {
                        unref_function = "g_strfreev";
                }
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = unref_function));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier (unref_function));
                ccall.add_argument (cvar);
                
                /* set freed references to NULL to prevent further use */
@@ -1324,26 +1325,26 @@ public class Vala.CodeGenerator : CodeVisitor {
                        }
                        
                        if (is_ref) {
-                               var cunrefcall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_list_foreach"));
+                               var cunrefcall = new CCodeFunctionCall (new CCodeIdentifier ("g_list_foreach"));
                                cunrefcall.add_argument (cvar);
                                if (is_class) {
-                                       cunrefcall.add_argument (new CCodeIdentifier (name = "(GFunc) g_object_unref"));
+                                       cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_object_unref"));
                                } else {
-                                       cunrefcall.add_argument (new CCodeIdentifier (name = "(GFunc) g_free"));
+                                       cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_free"));
                                }
-                               cunrefcall.add_argument (new CCodeConstant (name = "NULL"));
+                               cunrefcall.add_argument (new CCodeConstant ("NULL"));
                                ccomma.append_expression (cunrefcall);
                        }
                } else if (unref_function == "g_string_free") {
-                       ccall.add_argument (new CCodeConstant (name = "TRUE"));
+                       ccall.add_argument (new CCodeConstant ("TRUE"));
                }
                
                ccomma.append_expression (ccall);
-               ccomma.append_expression (new CCodeConstant (name = "NULL"));
+               ccomma.append_expression (new CCodeConstant ("NULL"));
                
-               var cassign = new CCodeAssignment (left = cvar, right = ccomma);
+               var cassign = new CCodeAssignment (cvar, ccomma);
                
-               return new CCodeConditionalExpression (condition = cisnull, true_expression = new CCodeConstant (name = "NULL"), false_expression = new CCodeParenthesizedExpression (inner = cassign));
+               return new CCodeConditionalExpression (cisnull, new CCodeConstant ("NULL"), new CCodeParenthesizedExpression (cassign));
        }
        
        public override void visit_end_full_expression (Expression! expr) {
@@ -1382,13 +1383,13 @@ public class Vala.CodeGenerator : CodeVisitor {
                expr.temp_vars.append (full_expr_decl);
                
                var expr_list = new CCodeCommaExpression ();
-               expr_list.append_expression (new CCodeAssignment (left = new CCodeIdentifier (name = full_expr_decl.name), right = expr.ccodenode));
+               expr_list.append_expression (new CCodeAssignment (new CCodeIdentifier (full_expr_decl.name), (CCodeExpression) expr.ccodenode));
                
                foreach (VariableDeclarator decl in temp_ref_vars) {
-                       expr_list.append_expression (get_unref_expression (new CCodeIdentifier (name = decl.name), decl.type_reference));
+                       expr_list.append_expression (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference));
                }
                
-               expr_list.append_expression (new CCodeIdentifier (name = full_expr_decl.name));
+               expr_list.append_expression (new CCodeIdentifier (full_expr_decl.name));
                
                expr.ccodenode = expr_list;
                
@@ -1397,13 +1398,13 @@ public class Vala.CodeGenerator : CodeVisitor {
        
        private void append_temp_decl (CCodeFragment! cfrag, List<VariableDeclarator> temp_vars) {
                foreach (VariableDeclarator decl in temp_vars) {
-                       var cdecl = new CCodeDeclaration (type_name = decl.type_reference.get_cname (true));
+                       var cdecl = new CCodeDeclaration (decl.type_reference.get_cname (true));
                
-                       var vardecl = new CCodeVariableDeclarator (name = decl.name);
+                       var vardecl = new CCodeVariableDeclarator (decl.name);
                        cdecl.add_declarator (vardecl);
                        
                        if (decl.type_reference.data_type != null && decl.type_reference.data_type.is_reference_type ()) {
-                               vardecl.initializer = new CCodeConstant (name = "NULL");
+                               vardecl.initializer = new CCodeConstant ("NULL");
                        }
                        
                        cfrag.append (cdecl);
@@ -1411,7 +1412,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
 
        public override void visit_expression_statement (ExpressionStatement! stmt) {
-               stmt.ccodenode = new CCodeExpressionStatement (expression = (CCodeExpression) stmt.expression.ccodenode);
+               stmt.ccodenode = new CCodeExpressionStatement ((CCodeExpression) stmt.expression.ccodenode);
                
                /* free temporary objects */
                if (!memory_management) {
@@ -1431,7 +1432,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                cfrag.append (stmt.ccodenode);
                
                foreach (VariableDeclarator decl in temp_ref_vars) {
-                       cfrag.append (new CCodeExpressionStatement (expression = get_unref_expression (new CCodeIdentifier (name = decl.name), decl.type_reference)));
+                       cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference)));
                }
                
                stmt.ccodenode = cfrag;
@@ -1458,22 +1459,22 @@ public class Vala.CodeGenerator : CodeVisitor {
 
        public override void visit_if_statement (IfStatement! stmt) {
                if (stmt.false_statement != null) {
-                       stmt.ccodenode = new CCodeIfStatement (condition = (CCodeExpression) stmt.condition.ccodenode, true_statement = (CCodeStatement) stmt.true_statement.ccodenode, false_statement = (CCodeStatement) stmt.false_statement.ccodenode);
+                       stmt.ccodenode = new CCodeIfStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.true_statement.ccodenode, (CCodeStatement) stmt.false_statement.ccodenode);
                } else {
-                       stmt.ccodenode = new CCodeIfStatement (condition = (CCodeExpression) stmt.condition.ccodenode, true_statement = (CCodeStatement) stmt.true_statement.ccodenode);
+                       stmt.ccodenode = new CCodeIfStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.true_statement.ccodenode);
                }
                
                create_temp_decl (stmt, stmt.condition.temp_vars);
        }
 
        public override void visit_while_statement (WhileStatement! stmt) {
-               stmt.ccodenode = new CCodeWhileStatement (condition = (CCodeExpression) stmt.condition.ccodenode, body = (CCodeStatement) stmt.body.ccodenode);
+               stmt.ccodenode = new CCodeWhileStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.body.ccodenode);
                
                create_temp_decl (stmt, stmt.condition.temp_vars);
        }
 
        public override void visit_for_statement (ForStatement! stmt) {
-               var cfor = new CCodeForStatement (condition = (CCodeExpression) stmt.condition.ccodenode, body = (CCodeStatement) stmt.body.ccodenode);
+               var cfor = new CCodeForStatement ((CCodeExpression) stmt.condition.ccodenode, (CCodeStatement) stmt.body.ccodenode);
                
                foreach (Expression init_expr in stmt.get_initializer ()) {
                        cfor.add_initializer ((CCodeExpression) init_expr.ccodenode);
@@ -1494,45 +1495,45 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (stmt.collection.static_type.data_type is Array) {
                        var it_name = "%s_it".printf (stmt.variable_name);
                
-                       var citdecl = new CCodeDeclaration (type_name = stmt.collection.static_type.get_cname ());
-                       citdecl.add_declarator (new CCodeVariableDeclarator (name = it_name));
+                       var citdecl = new CCodeDeclaration (stmt.collection.static_type.get_cname ());
+                       citdecl.add_declarator (new CCodeVariableDeclarator (it_name));
                        cblock.add_statement (citdecl);
                        
                        var cbody = new CCodeBlock ();
                        
-                       var cdecl = new CCodeDeclaration (type_name = stmt.type_reference.get_cname ());
-                       cdecl.add_declarator (new CCodeVariableDeclarator (name = stmt.variable_name, initializer = new CCodeIdentifier (name = "*%s".printf (it_name))));
+                       var cdecl = new CCodeDeclaration (stmt.type_reference.get_cname ());
+                       cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (stmt.variable_name, new CCodeIdentifier ("*%s".printf (it_name))));
                        cbody.add_statement (cdecl);
                        
                        cbody.add_statement (stmt.body.ccodenode);
                        
-                       var ccond = new CCodeBinaryExpression (operator = CCodeBinaryOperator.INEQUALITY, left = new CCodeIdentifier (name = "*%s".printf (it_name)), right = new CCodeConstant (name = "NULL"));
+                       var ccond = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("*%s".printf (it_name)), new CCodeConstant ("NULL"));
                        
-                       var cfor = new CCodeForStatement (condition = ccond, body = cbody);
-                       cfor.add_initializer (new CCodeAssignment (left = new CCodeIdentifier (name = it_name), right = (CCodeExpression) stmt.collection.ccodenode));
-                       cfor.add_iterator (new CCodeAssignment (left = new CCodeIdentifier (name = it_name), right = new CCodeBinaryExpression (operator = CCodeBinaryOperator.PLUS, left = new CCodeIdentifier (name = it_name), right = new CCodeConstant (name = "1"))));
+                       var cfor = new CCodeForStatement (ccond, cbody);
+                       cfor.add_initializer (new CCodeAssignment (new CCodeIdentifier (it_name), (CCodeExpression) stmt.collection.ccodenode));
+                       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.static_type.data_type.name == "List" ||
                           stmt.collection.static_type.data_type.name == "SList") {
                        var it_name = "%s_it".printf (stmt.variable_name);
                
-                       var citdecl = new CCodeDeclaration (type_name = stmt.collection.static_type.get_cname ());
-                       citdecl.add_declarator (new CCodeVariableDeclarator (name = it_name));
+                       var citdecl = new CCodeDeclaration (stmt.collection.static_type.get_cname ());
+                       citdecl.add_declarator (new CCodeVariableDeclarator (it_name));
                        cblock.add_statement (citdecl);
                        
                        var cbody = new CCodeBlock ();
                        
-                       var cdecl = new CCodeDeclaration (type_name = stmt.type_reference.get_cname ());
-                       cdecl.add_declarator (new CCodeVariableDeclarator (name = stmt.variable_name, initializer = new CCodeMemberAccess (inner = new CCodeIdentifier (name = it_name), member_name = "data", is_pointer = true)));
+                       var cdecl = new CCodeDeclaration (stmt.type_reference.get_cname ());
+                       cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (stmt.variable_name, new CCodeMemberAccess.pointer (new CCodeIdentifier (it_name), "data")));
                        cbody.add_statement (cdecl);
                        
                        cbody.add_statement (stmt.body.ccodenode);
                        
-                       var ccond = new CCodeBinaryExpression (operator = CCodeBinaryOperator.INEQUALITY, left = new CCodeIdentifier (name = it_name), right = new CCodeConstant (name = "NULL"));
+                       var ccond = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier (it_name), new CCodeConstant ("NULL"));
                        
-                       var cfor = new CCodeForStatement (condition = ccond, body = cbody);
-                       cfor.add_initializer (new CCodeAssignment (left = new CCodeIdentifier (name = it_name), right = (CCodeExpression) stmt.collection.ccodenode));
-                       cfor.add_iterator (new CCodeAssignment (left = new CCodeIdentifier (name = it_name), right = new CCodeMemberAccess (inner = new CCodeIdentifier (name = it_name), member_name = "next", is_pointer = true)));
+                       var cfor = new CCodeForStatement (ccond, cbody);
+                       cfor.add_initializer (new CCodeAssignment (new CCodeIdentifier (it_name), (CCodeExpression) stmt.collection.ccodenode));
+                       cfor.add_iterator (new CCodeAssignment (new CCodeIdentifier (it_name), new CCodeMemberAccess.pointer (new CCodeIdentifier (it_name), "next")));
                        cblock.add_statement (cfor);
                }
                
@@ -1553,7 +1554,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                var local_vars = b.get_local_variables ();
                foreach (VariableDeclarator decl in local_vars) {
                        if (decl.symbol.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) {
-                               cfrag.append (new CCodeExpressionStatement (expression = get_unref_expression (new CCodeIdentifier (name = decl.name), decl.type_reference)));
+                               cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference)));
                        }
                }
                
@@ -1584,7 +1585,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                foreach (VariableDeclarator decl in local_vars) {
                        if (decl.symbol.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) {
                                found = true;
-                               ccomma.append_expression (get_unref_expression (new CCodeIdentifier (name = decl.name), decl.type_reference));
+                               ccomma.append_expression (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference));
                        }
                }
                
@@ -1603,14 +1604,14 @@ public class Vala.CodeGenerator : CodeVisitor {
                var return_expr_decl = get_temp_variable_declarator (expr.static_type);
                
                var ccomma = new CCodeCommaExpression ();
-               ccomma.append_expression (new CCodeAssignment (left = new CCodeIdentifier (name = return_expr_decl.name), right = expr.ccodenode));
+               ccomma.append_expression (new CCodeAssignment (new CCodeIdentifier (return_expr_decl.name), (CCodeExpression) expr.ccodenode));
 
                if (!append_local_free_expr (current_symbol, ccomma, false)) {
                        /* no local variables need to be freed */
                        return;
                }
 
-               ccomma.append_expression (new CCodeIdentifier (name = return_expr_decl.name));
+               ccomma.append_expression (new CCodeIdentifier (return_expr_decl.name));
                
                expr.ccodenode = ccomma;
                expr.temp_vars.append (return_expr_decl);
@@ -1624,7 +1625,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                } else {
                        create_local_free_expr (stmt.return_expression);
 
-                       stmt.ccodenode = new CCodeReturnStatement (return_expression = (CCodeExpression) stmt.return_expression.ccodenode);
+                       stmt.ccodenode = new CCodeReturnStatement ((CCodeExpression) stmt.return_expression.ccodenode);
                
                        create_temp_decl (stmt, stmt.return_expression.temp_vars);
                }
@@ -1632,30 +1633,30 @@ public class Vala.CodeGenerator : CodeVisitor {
 
        public override void visit_boolean_literal (BooleanLiteral! expr) {
                if (expr.value) {
-                       expr.ccodenode = new CCodeConstant (name = "TRUE");
+                       expr.ccodenode = new CCodeConstant ("TRUE");
                } else {
-                       expr.ccodenode = new CCodeConstant (name = "FALSE");
+                       expr.ccodenode = new CCodeConstant ("FALSE");
                }
        }
 
        public override void visit_character_literal (CharacterLiteral! expr) {
-               expr.ccodenode = new CCodeConstant (name = expr.value);
+               expr.ccodenode = new CCodeConstant (expr.value);
        }
 
        public override void visit_integer_literal (IntegerLiteral! expr) {
-               expr.ccodenode = new CCodeConstant (name = expr.value);
+               expr.ccodenode = new CCodeConstant (expr.value);
        }
 
        public override void visit_real_literal (RealLiteral! expr) {
-               expr.ccodenode = new CCodeConstant (name = expr.value);
+               expr.ccodenode = new CCodeConstant (expr.value);
        }
 
        public override void visit_string_literal (StringLiteral! expr) {
-               expr.ccodenode = new CCodeConstant (name = expr.value);
+               expr.ccodenode = new CCodeConstant (expr.value);
        }
 
        public override void visit_null_literal (NullLiteral! expr) {
-               expr.ccodenode = new CCodeConstant (name = "NULL");
+               expr.ccodenode = new CCodeConstant ("NULL");
        }
 
        public override void visit_literal_expression (LiteralExpression! expr) {
@@ -1668,44 +1669,48 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (expr.symbol_reference.node is Method) {
                        var m = (Method) expr.symbol_reference.node;
                        if (!m.overrides) {
-                               expr.ccodenode = new CCodeIdentifier (name = m.get_cname ());
+                               expr.ccodenode = new CCodeIdentifier (m.get_cname ());
                        } else {
-                               expr.ccodenode = new CCodeIdentifier (name = m.base_method.get_cname ());
+                               expr.ccodenode = new CCodeIdentifier (m.base_method.get_cname ());
                        }
                } else if (expr.symbol_reference.node is Field) {
                        var f = (Field) expr.symbol_reference.node;
                        if (f.instance) {
                                ref CCodeExpression typed_inst;
                                if (f.symbol.parent_symbol.node != base_type) {
-                                       typed_inst = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) f.symbol.parent_symbol.node).get_upper_case_cname (null)));
+                                       typed_inst = new CCodeFunctionCall (new CCodeIdentifier (((DataType) f.symbol.parent_symbol.node).get_upper_case_cname (null)));
                                        ((CCodeFunctionCall) typed_inst).add_argument (pub_inst);
                                } else {
                                        typed_inst = pub_inst;
                                }
                                ref CCodeExpression inst;
                                if (f.access == MemberAccessibility.PRIVATE) {
-                                       inst = new CCodeMemberAccess (inner = typed_inst, member_name = "priv", is_pointer = true);
+                                       inst = new CCodeMemberAccess.pointer (typed_inst, "priv");
                                } else {
                                        inst = typed_inst;
                                }
-                               expr.ccodenode = new CCodeMemberAccess (inner = inst, member_name = f.get_cname (), is_pointer = ((DataType) f.symbol.parent_symbol.node).is_reference_type ());
+                               if (((DataType) f.symbol.parent_symbol.node).is_reference_type ()) {
+                                       expr.ccodenode = new CCodeMemberAccess.pointer (inst, f.get_cname ());
+                               } else {
+                                       expr.ccodenode = new CCodeMemberAccess (inst, f.get_cname ());
+                               }
                        } else {
                                if (f.symbol.parent_symbol.node is DataType) {
                                        var t = (DataType) f.symbol.parent_symbol.node;
-                                       expr.ccodenode = new CCodeIdentifier (name = "%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ()));
+                                       expr.ccodenode = new CCodeIdentifier ("%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ()));
                                } else {
-                                       expr.ccodenode = new CCodeIdentifier (name = f.get_cname ());
+                                       expr.ccodenode = new CCodeIdentifier (f.get_cname ());
                                }
                        }
                } else if (expr.symbol_reference.node is Constant) {
                        var c = (Constant) expr.symbol_reference.node;
-                       expr.ccodenode = new CCodeIdentifier (name = c.get_cname ());
+                       expr.ccodenode = new CCodeIdentifier (c.get_cname ());
                } else if (expr.symbol_reference.node is Property) {
                        var prop = (Property) expr.symbol_reference.node;
                        var cl = (Class) prop.symbol.parent_symbol.node;
 
                        if (!prop.no_accessor_method) {
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name)));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (cl.get_lower_case_cname (null), prop.name)));
                                
                                /* explicitly use strong reference as ccast
                                 * gets unrefed at the end of the inner block
@@ -1714,7 +1719,7 @@ public class Vala.CodeGenerator : CodeVisitor {
 
                                /* cast if necessary */
                                if (prop.symbol.parent_symbol.node != base_type) {
-                                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null)));
+                                       var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null)));
                                        ccast.add_argument (pub_inst);
                                        typed_pub_inst = ccast;
                                }
@@ -1722,9 +1727,9 @@ public class Vala.CodeGenerator : CodeVisitor {
                                ccall.add_argument (typed_pub_inst);
                                expr.ccodenode = ccall;
                        } else {
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_get"));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_get"));
                        
-                               var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT"));
+                               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT"));
                                ccast.add_argument (pub_inst);
                                ccall.add_argument (ccast);
                                
@@ -1736,11 +1741,11 @@ public class Vala.CodeGenerator : CodeVisitor {
                                var temp_decl = get_temp_variable_declarator (expr.static_type);
                                temp_vars.prepend (temp_decl);
 
-                               var ctemp = new CCodeIdentifier (name = temp_decl.name);
-                               ccall.add_argument (new CCodeUnaryExpression (operator = CCodeUnaryOperator.ADDRESS_OF, inner = ctemp));
+                               var ctemp = new CCodeIdentifier (temp_decl.name);
+                               ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
                                
                                
-                               ccall.add_argument (new CCodeConstant (name = "NULL"));
+                               ccall.add_argument (new CCodeConstant ("NULL"));
                                
                                var ccomma = new CCodeCommaExpression ();
                                ccomma.append_expression (ccall);
@@ -1749,38 +1754,38 @@ public class Vala.CodeGenerator : CodeVisitor {
                        }
                } else if (expr.symbol_reference.node is EnumValue) {
                        var ev = (EnumValue) expr.symbol_reference.node;
-                       expr.ccodenode = new CCodeConstant (name = ev.get_cname ());
+                       expr.ccodenode = new CCodeConstant (ev.get_cname ());
                } else if (expr.symbol_reference.node is VariableDeclarator) {
                        var decl = (VariableDeclarator) expr.symbol_reference.node;
-                       expr.ccodenode = new CCodeIdentifier (name = decl.name);
+                       expr.ccodenode = new CCodeIdentifier (decl.name);
                } else if (expr.symbol_reference.node is FormalParameter) {
                        var p = (FormalParameter) expr.symbol_reference.node;
                        if (p.name == "this") {
                                expr.ccodenode = pub_inst;
                        } else {
                                if (p.type_reference.is_out || p.type_reference.reference_to_value_type) {
-                                       expr.ccodenode = new CCodeIdentifier (name = "*%s".printf (p.name));
+                                       expr.ccodenode = new CCodeIdentifier ("*%s".printf (p.name));
                                } else {
-                                       expr.ccodenode = new CCodeIdentifier (name = p.name);
+                                       expr.ccodenode = new CCodeIdentifier (p.name);
                                }
                        }
                } else if (expr.symbol_reference.node is Signal) {
                        var sig = (Signal) expr.symbol_reference.node;
                        
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_signal_emit_by_name"));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_emit_by_name"));
 
-                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_OBJECT"));
+                       var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT"));
                        ccast.add_argument (pub_inst);
                        ccall.add_argument (ccast);
 
-                       ccall.add_argument (new CCodeConstant (name = "\"%s\"".printf (sig.name)));
+                       ccall.add_argument (new CCodeConstant ("\"%s\"".printf (sig.name)));
                        
                        expr.ccodenode = ccall;
                }
        }
        
        public override void visit_parenthesized_expression (ParenthesizedExpression! expr) {
-               expr.ccodenode = new CCodeParenthesizedExpression (inner = (CCodeExpression) expr.inner.ccodenode);
+               expr.ccodenode = new CCodeParenthesizedExpression ((CCodeExpression) expr.inner.ccodenode);
 
                visit_expression (expr);
        }
@@ -1790,7 +1795,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                DataType base_type = null;
        
                if (expr.inner == null) {
-                       pub_inst = new CCodeIdentifier (name = "self");
+                       pub_inst = new CCodeIdentifier ("self");
 
                        if (current_type_symbol != null) {
                                /* base type is available if this is a type method */
@@ -1810,7 +1815,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
 
        public override void visit_end_invocation_expression (InvocationExpression! expr) {
-               var ccall = new CCodeFunctionCall (call = (CCodeExpression) expr.call.ccodenode);
+               var ccall = new CCodeFunctionCall ((CCodeExpression) expr.call.ccodenode);
                
                Method m = null;
                List<FormalParameter> params;
@@ -1857,7 +1862,7 @@ public class Vala.CodeGenerator : CodeVisitor {
 
                        var req_cast = false;
                        if (ma.inner == null) {
-                               instance = new CCodeIdentifier (name = "self");
+                               instance = new CCodeIdentifier ("self");
                                /* require casts for overriden and inherited methods */
                                req_cast = m.overrides || (m.symbol.parent_symbol != current_type_symbol);
                        } else {
@@ -1868,7 +1873,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        }
                        
                        if (req_cast && ((DataType) m.symbol.parent_symbol.node).is_reference_type ()) {
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) base_method.symbol.parent_symbol.node).get_upper_case_cname (null)));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_method.symbol.parent_symbol.node).get_upper_case_cname (null)));
                                ccall.add_argument (instance);
                                instance = ccall;
                        }
@@ -1891,7 +1896,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                    && param.type_reference.data_type.is_reference_type ()
                                    && arg.static_type.data_type != null
                                    && param.type_reference.data_type != arg.static_type.data_type) {
-                                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = param.type_reference.data_type.get_upper_case_cname (null)));
+                                       var ccall = new CCodeFunctionCall (new CCodeIdentifier (param.type_reference.data_type.get_upper_case_cname (null)));
                                        ccall.add_argument (cexpr);
                                        cexpr = ccall;
                                }
@@ -1932,7 +1937,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                }
                
                if (m != null && m.instance && m.returns_modified_pointer) {
-                       expr.ccodenode = new CCodeAssignment (left = instance, right = ccall);
+                       expr.ccodenode = new CCodeAssignment (instance, ccall);
                } else {
                        expr.ccodenode = ccall;
                
@@ -1942,14 +1947,14 @@ public class Vala.CodeGenerator : CodeVisitor {
        
        public override void visit_element_access (ElementAccess! expr)
        {
-               expr.ccodenode = new CCodeElementAccess (container = expr.container.ccodenode, index = expr.index.ccodenode);
+               expr.ccodenode = new CCodeElementAccess ((CCodeExpression) expr.container.ccodenode, (CCodeExpression) expr.index.ccodenode);
        }
 
        public override void visit_postfix_expression (PostfixExpression! expr) {
                if (expr.increment) {
-                       expr.ccodenode = new CCodeUnaryExpression (operator = CCodeUnaryOperator.POSTFIX_INCREMENT, inner = expr.inner.ccodenode);
+                       expr.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, (CCodeExpression) expr.inner.ccodenode);
                } else {
-                       expr.ccodenode = new CCodeUnaryExpression (operator = CCodeUnaryOperator.POSTFIX_DECREMENT, inner = expr.inner.ccodenode);
+                       expr.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_DECREMENT, (CCodeExpression) expr.inner.ccodenode);
                }
                
                visit_expression (expr);
@@ -1977,7 +1982,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        ref_function = expr.static_type.data_type.get_dup_function ();
                }
        
-               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = ref_function));
+               var ccall = new CCodeFunctionCall (new CCodeIdentifier (ref_function));
 
                if (expr.static_type.non_null) {
                        ccall.add_argument ((CCodeExpression) expr.ccodenode);
@@ -1987,15 +1992,15 @@ public class Vala.CodeGenerator : CodeVisitor {
                        var decl = get_temp_variable_declarator (expr.static_type);
                        temp_vars.prepend (decl);
 
-                       var ctemp = new CCodeIdentifier (name = decl.name);
+                       var ctemp = new CCodeIdentifier (decl.name);
                        
-                       var cisnull = new CCodeBinaryExpression (operator = CCodeBinaryOperator.EQUALITY, left = ctemp, right = new CCodeConstant (name = "NULL"));
+                       var cisnull = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ctemp, new CCodeConstant ("NULL"));
                        
                        ccall.add_argument (ctemp);
                        
                        var ccomma = new CCodeCommaExpression ();
-                       ccomma.append_expression (new CCodeAssignment (left = ctemp, right = expr.ccodenode));
-                       ccomma.append_expression (new CCodeConditionalExpression (condition = cisnull, true_expression = ctemp, false_expression = ccall));
+                       ccomma.append_expression (new CCodeAssignment (ctemp, (CCodeExpression) expr.ccodenode));
+                       ccomma.append_expression (new CCodeConditionalExpression (cisnull, ctemp, ccall));
 
                        return ccomma;
                }
@@ -2008,7 +2013,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        /* constructor of GInitiallyUnowned subtype
                         * returns floating reference, sink it
                         */
-                       var csink = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_ref_sink"));
+                       var csink = new CCodeFunctionCall (new CCodeIdentifier ("g_object_ref_sink"));
                        csink.add_argument ((CCodeExpression) expr.ccodenode);
                        
                        expr.ccodenode = csink;
@@ -2018,7 +2023,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        var decl = get_temp_variable_declarator (expr.static_type);
                        temp_vars.prepend (decl);
                        temp_ref_vars.prepend (decl);
-                       expr.ccodenode = new CCodeParenthesizedExpression (inner = new CCodeAssignment (left = new CCodeIdentifier (name = decl.name), right = expr.ccodenode));
+                       expr.ccodenode = new CCodeParenthesizedExpression (new CCodeAssignment (new CCodeIdentifier (decl.name), (CCodeExpression) expr.ccodenode));
                } else if (expr.ref_missing) {
                        expr.ccodenode = get_ref_expression (expr);
                }
@@ -2028,19 +2033,19 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (expr.symbol_reference == null) {
                        // no construction method
                        if (expr.type_reference.data_type is Class) {
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_new"));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
                                
-                               ccall.add_argument (new CCodeConstant (name = expr.type_reference.data_type.get_type_id ()));
+                               ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_type_id ()));
 
-                               ccall.add_argument (new CCodeConstant (name = "NULL"));
+                               ccall.add_argument (new CCodeConstant ("NULL"));
                                
                                expr.ccodenode = ccall;
                        } else {
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_new0"));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
                                
-                               ccall.add_argument (new CCodeConstant (name = expr.type_reference.data_type.get_cname ()));
+                               ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_cname ()));
                                
-                               ccall.add_argument (new CCodeConstant (name = "1"));
+                               ccall.add_argument (new CCodeConstant ("1"));
                                
                                expr.ccodenode = ccall;
                        }
@@ -2049,7 +2054,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                        var m = (Method) expr.symbol_reference.node;
                        var params = m.get_parameters ();
        
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = m.get_cname ()));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ()));
 
                        var i = 1;
                        foreach (Expression arg in expr.get_argument_list ()) {
@@ -2064,7 +2069,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                            && param.type_reference.data_type.is_reference_type ()
                                            && arg.static_type.data_type != null
                                            && param.type_reference.data_type != arg.static_type.data_type) {
-                                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = param.type_reference.data_type.get_upper_case_cname (null)));
+                                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (param.type_reference.data_type.get_upper_case_cname (null)));
                                                ccall.add_argument (cexpr);
                                                cexpr = ccall;
                                        }
@@ -2107,7 +2112,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
 
        public override void visit_typeof_expression (TypeofExpression! expr) {
-               expr.ccodenode = new CCodeIdentifier (name = expr.type_reference.data_type.get_type_id ());
+               expr.ccodenode = new CCodeIdentifier (expr.type_reference.data_type.get_type_id ());
        }
 
        public override void visit_unary_expression (UnaryExpression! expr) {
@@ -2129,7 +2134,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                } else if (expr.operator == UnaryOperator.OUT) {
                        op = CCodeUnaryOperator.ADDRESS_OF;
                }
-               expr.ccodenode = new CCodeUnaryExpression (operator = op, inner = expr.inner.ccodenode);
+               expr.ccodenode = new CCodeUnaryExpression (op, (CCodeExpression) expr.inner.ccodenode);
                
                visit_expression (expr);
        }
@@ -2138,30 +2143,68 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (expr.type_reference.data_type is Struct || expr.type_reference.data_type is Enum || expr.type_reference.data_type is Flags) {
                        expr.ccodenode = expr.inner.ccodenode;
                } else {
-                       expr.ccodenode = new InstanceCast (type_reference = expr.type_reference.data_type, inner = (CCodeExpression) expr.inner.ccodenode);
+                       expr.ccodenode = new InstanceCast ((CCodeExpression) expr.inner.ccodenode, expr.type_reference.data_type);
                }
                
                visit_expression (expr);
        }
 
        public override void visit_binary_expression (BinaryExpression! expr) {
-               expr.ccodenode = new CCodeBinaryExpression (operator = expr.operator, left = expr.left.ccodenode, right = expr.right.ccodenode);
+               CCodeBinaryOperator op;
+               if (expr.operator == BinaryOperator.PLUS) {
+                       op = CCodeBinaryOperator.PLUS;
+               } else if (expr.operator == BinaryOperator.MINUS) {
+                       op = CCodeBinaryOperator.MINUS;
+               } else if (expr.operator == BinaryOperator.MUL) {
+                       op = CCodeBinaryOperator.MUL;
+               } else if (expr.operator == BinaryOperator.DIV) {
+                       op = CCodeBinaryOperator.DIV;
+               } else if (expr.operator == BinaryOperator.MOD) {
+                       op = CCodeBinaryOperator.MOD;
+               } else if (expr.operator == BinaryOperator.SHIFT_LEFT) {
+                       op = CCodeBinaryOperator.SHIFT_LEFT;
+               } else if (expr.operator == BinaryOperator.SHIFT_RIGHT) {
+                       op = CCodeBinaryOperator.SHIFT_RIGHT;
+               } else if (expr.operator == BinaryOperator.LESS_THAN) {
+                       op = CCodeBinaryOperator.LESS_THAN;
+               } else if (expr.operator == BinaryOperator.GREATER_THAN) {
+                       op = CCodeBinaryOperator.GREATER_THAN;
+               } else if (expr.operator == BinaryOperator.LESS_THAN_OR_EQUAL) {
+                       op = CCodeBinaryOperator.LESS_THAN_OR_EQUAL;
+               } else if (expr.operator == BinaryOperator.GREATER_THAN_OR_EQUAL) {
+                       op = CCodeBinaryOperator.GREATER_THAN_OR_EQUAL;
+               } else if (expr.operator == BinaryOperator.EQUALITY) {
+                       op = CCodeBinaryOperator.EQUALITY;
+               } else if (expr.operator == BinaryOperator.INEQUALITY) {
+                       op = CCodeBinaryOperator.INEQUALITY;
+               } else if (expr.operator == BinaryOperator.BITWISE_AND) {
+                       op = CCodeBinaryOperator.BITWISE_AND;
+               } else if (expr.operator == BinaryOperator.BITWISE_OR) {
+                       op = CCodeBinaryOperator.BITWISE_OR;
+               } else if (expr.operator == BinaryOperator.BITWISE_XOR) {
+                       op = CCodeBinaryOperator.BITWISE_XOR;
+               } else if (expr.operator == BinaryOperator.AND) {
+                       op = CCodeBinaryOperator.AND;
+               } else if (expr.operator == BinaryOperator.OR) {
+                       op = CCodeBinaryOperator.OR;
+               }
+               expr.ccodenode = new CCodeBinaryExpression (op, (CCodeExpression) expr.left.ccodenode, (CCodeExpression) expr.right.ccodenode);
                
                visit_expression (expr);
        }
 
        public override void visit_type_check (TypeCheck! expr) {
-               var ccheck = new CCodeFunctionCall (call = new CCodeIdentifier (name = expr.type_reference.data_type.get_upper_case_cname ("IS_")));
+               var ccheck = new CCodeFunctionCall (new CCodeIdentifier (expr.type_reference.data_type.get_upper_case_cname ("IS_")));
                ccheck.add_argument ((CCodeExpression) expr.expression.ccodenode);
                expr.ccodenode = ccheck;
        }
 
        public override void visit_conditional_expression (ConditionalExpression! expr) {
-               expr.ccodenode = new CCodeConditionalExpression (condition = (CCodeExpression) expr.condition.ccodenode, true_expression = (CCodeExpression) expr.true_expression.ccodenode, false_expression = (CCodeExpression) expr.false_expression.ccodenode);
+               expr.ccodenode = new CCodeConditionalExpression ((CCodeExpression) expr.condition.ccodenode, (CCodeExpression) expr.true_expression.ccodenode, (CCodeExpression) expr.false_expression.ccodenode);
        }
 
        public override void visit_end_lambda_expression (LambdaExpression! l) {
-               l.ccodenode = new CCodeIdentifier (name = l.method.get_cname ());
+               l.ccodenode = new CCodeIdentifier (l.method.get_cname ());
        }
 
        public override void visit_end_assignment (Assignment! a) {
@@ -2174,30 +2217,30 @@ public class Vala.CodeGenerator : CodeVisitor {
                        if (ma.inner == null && a.parent_node is Statement &&
                            ((Statement) a.parent_node).construction) {
                                // this property is used as a construction parameter
-                               var cpointer = new CCodeIdentifier (name = "__params_it");
+                               var cpointer = new CCodeIdentifier ("__params_it");
                                
                                var ccomma = new CCodeCommaExpression ();
                                // set name in array for current parameter
-                               var cnamemember = new CCodeMemberAccess (inner = cpointer, member_name = "name", is_pointer = true);
-                               var cnameassign = new CCodeAssignment (left = cnamemember, right = prop.get_canonical_cconstant ());
+                               var cnamemember = new CCodeMemberAccess.pointer (cpointer, "name");
+                               var cnameassign = new CCodeAssignment (cnamemember, prop.get_canonical_cconstant ());
                                ccomma.append_expression (cnameassign);
                                
-                               var gvaluearg = new CCodeUnaryExpression (operator = CCodeUnaryOperator.ADDRESS_OF, inner = new CCodeMemberAccess (inner = cpointer, member_name = "value", is_pointer = true));
+                               var gvaluearg = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeMemberAccess.pointer (cpointer, "value"));
                                
                                // initialize GValue in array for current parameter
-                               var cvalueinit = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_value_init"));
+                               var cvalueinit = new CCodeFunctionCall (new CCodeIdentifier ("g_value_init"));
                                cvalueinit.add_argument (gvaluearg);
-                               cvalueinit.add_argument (new CCodeIdentifier (name = prop.type_reference.data_type.get_type_id ()));
+                               cvalueinit.add_argument (new CCodeIdentifier (prop.type_reference.data_type.get_type_id ()));
                                ccomma.append_expression (cvalueinit);
                                
                                // set GValue for current parameter
-                               var cvalueset = new CCodeFunctionCall (call = get_value_setter_function (prop.type_reference));
+                               var cvalueset = new CCodeFunctionCall (get_value_setter_function (prop.type_reference));
                                cvalueset.add_argument (gvaluearg);
                                cvalueset.add_argument ((CCodeExpression) a.right.ccodenode);
                                ccomma.append_expression (cvalueset);
                                
                                // move pointer to next parameter in array
-                               ccomma.append_expression (new CCodeUnaryExpression (operator = CCodeUnaryOperator.POSTFIX_INCREMENT, inner = cpointer));
+                               ccomma.append_expression (new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, cpointer));
                                
                                a.ccodenode = ccomma;
                        } else {
@@ -2207,14 +2250,14 @@ public class Vala.CodeGenerator : CodeVisitor {
                                        set_func = "%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name);
                                }
                                
-                               var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = set_func));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (set_func));
 
                                /* target instance is first argument */
                                ref CCodeExpression instance;
                                var req_cast = false;
 
                                if (ma.inner == null) {
-                                       instance = new CCodeIdentifier (name = "self");
+                                       instance = new CCodeIdentifier ("self");
                                        /* require casts for inherited properties */
                                        req_cast = (prop.symbol.parent_symbol != current_type_symbol);
                                } else {
@@ -2225,7 +2268,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                }
                                
                                if (req_cast && ((DataType) prop.symbol.parent_symbol.node).is_reference_type ()) {
-                                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null)));
+                                       var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null)));
                                        ccast.add_argument (instance);
                                        instance = ccast;
                                }
@@ -2242,7 +2285,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                    && a.right.static_type.data_type != null
                                    && prop.type_reference.data_type != a.right.static_type.data_type) {
                                        /* cast is necessary */
-                                       var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = prop.type_reference.data_type.get_upper_case_cname (null)));
+                                       var ccast = new CCodeFunctionCall (new CCodeIdentifier (prop.type_reference.data_type.get_upper_case_cname (null)));
                                        ccast.add_argument (cexpr);
                                        cexpr = ccast;
                                }
@@ -2250,7 +2293,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                ccall.add_argument (cexpr);
                                
                                if (prop.no_accessor_method) {
-                                       ccall.add_argument (new CCodeConstant (name = "NULL"));
+                                       ccall.add_argument (new CCodeConstant ("NULL"));
                                }
                                
                                a.ccodenode = ccall;
@@ -2264,17 +2307,17 @@ public class Vala.CodeGenerator : CodeVisitor {
                                connect_func = "g_signal_connect";
                        }
 
-                       var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = connect_func));
+                       var ccall = new CCodeFunctionCall (new CCodeIdentifier (connect_func));
                
                        if (ma.inner != null) {
                                ccall.add_argument ((CCodeExpression) ma.inner.ccodenode);
                        } else {
-                               ccall.add_argument (new CCodeIdentifier (name = "self"));
+                               ccall.add_argument (new CCodeIdentifier ("self"));
                        }
 
-                       ccall.add_argument (new CCodeConstant (name = "\"%s\"".printf (sig.name)));
+                       ccall.add_argument (new CCodeConstant ("\"%s\"".printf (sig.name)));
 
-                       ccall.add_argument (new CCodeCastExpression (inner = new CCodeIdentifier (name = m.get_cname ()), type_name = "GCallback"));
+                       ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier (m.get_cname ()), "GCallback"));
 
                        if (m.instance) {
                                if (a.right is MemberAccess) {
@@ -2282,14 +2325,14 @@ public class Vala.CodeGenerator : CodeVisitor {
                                        if (right_ma.inner != null) {
                                                ccall.add_argument ((CCodeExpression) right_ma.inner.ccodenode);
                                        } else {
-                                               ccall.add_argument (new CCodeIdentifier (name = "self"));
+                                               ccall.add_argument (new CCodeIdentifier ("self"));
                                        }
                                } else if (a.right is LambdaExpression) {
-                                       ccall.add_argument (new CCodeIdentifier (name = "self"));
+                                       ccall.add_argument (new CCodeIdentifier ("self"));
                                }
-                               ccall.add_argument (new CCodeConstant (name = "0"));
+                               ccall.add_argument (new CCodeConstant ("0"));
                        } else {
-                               ccall.add_argument (new CCodeConstant (name = "NULL"));
+                               ccall.add_argument (new CCodeConstant ("NULL"));
                        }
                        
                        a.ccodenode = ccall;
@@ -2303,7 +2346,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                            && a.right.static_type.data_type != null
                            && a.left.static_type.data_type.is_reference_type ()
                            && a.right.static_type.data_type != a.left.static_type.data_type) {
-                               var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = a.left.static_type.data_type.get_upper_case_cname (null)));
+                               var ccast = new CCodeFunctionCall (new CCodeIdentifier (a.left.static_type.data_type.get_upper_case_cname (null)));
                                ccast.add_argument (rhs);
                                rhs = ccast;
                        }
@@ -2314,9 +2357,9 @@ public class Vala.CodeGenerator : CodeVisitor {
                                
                                var temp_decl = get_temp_variable_declarator (a.left.static_type);
                                temp_vars.prepend (temp_decl);
-                               ccomma.append_expression (new CCodeAssignment (left = new CCodeIdentifier (name = temp_decl.name), right = rhs));
+                               ccomma.append_expression (new CCodeAssignment (new CCodeIdentifier (temp_decl.name), rhs));
                                ccomma.append_expression (get_unref_expression ((CCodeExpression) a.left.ccodenode, a.left.static_type));
-                               ccomma.append_expression (new CCodeIdentifier (name = temp_decl.name));
+                               ccomma.append_expression (new CCodeIdentifier (temp_decl.name));
                                
                                rhs = ccomma;
                        }
@@ -2344,7 +2387,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                cop = CCodeAssignmentOperator.SHIFT_RIGHT;
                        }
                
-                       a.ccodenode = new CCodeAssignment (left = (CCodeExpression) a.left.ccodenode, right = rhs, operator = cop);
+                       a.ccodenode = new CCodeAssignment ((CCodeExpression) a.left.ccodenode, rhs, cop);
                }
        }
 }
index fec5c82..81729bd 100644 (file)
@@ -60,8 +60,8 @@ public abstract class Vala.CodeNode {
                set {
                        if (source_reference != null) {
                                value.line = new CCodeLineDirective (
-                                       filename = source_reference.file.filename,
-                                       line = source_reference.first_line);
+                                       source_reference.file.filename,
+                                       source_reference.first_line);
                        }
 
                        _ccodenode = value;
index 6937edf..69d9c48 100644 (file)
@@ -49,8 +49,11 @@ public class Vala.ConditionalExpression : Expression {
         * @param false_expr expression to be evaluated if condition is false
         * @return           newly created conditional expression
         */
-       public static ref ConditionalExpression! new (Expression! cond, Expression! true_expr, Expression! false_expr, SourceReference source) {
-               return (new ConditionalExpression (condition = cond, true_expression = true_expr, false_expression = false_expr, source_reference = source));
+       public construct (Expression! cond, Expression! true_expr, Expression! false_expr, SourceReference source) {
+               condition = cond;
+               true_expression = true_expr;
+               false_expression = false_expr;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index df336cc..a8a1767 100644 (file)
@@ -52,8 +52,11 @@ public class Vala.Constant : CodeNode {
         * @param source reference to source code
         * @return       newly created constant
         */
-       public static ref Constant! new (string! name, TypeReference! type, Expression! init, SourceReference source) {
-               return (new Constant (name = name, type_reference = type, initializer = init, source_reference = source));
+       public construct (string! _name, TypeReference! type, Expression! init, SourceReference source) {
+               name = _name;
+               type_reference = type;
+               initializer = init;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 6632453..4c6c750 100644 (file)
@@ -51,8 +51,8 @@ public class Vala.Constructor : CodeNode {
         * @param source reference to source code
         * @return       newly created constructor
         */
-       public static ref Constructor! new (SourceReference source) {
-               return (new Constructor (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index a39edab..6ba6eee 100644 (file)
@@ -32,8 +32,8 @@ public class Vala.ContinueStatement : Statement {
         * @param source reference to source code
         * @return       newly created continue statement
         */
-       public static ref ContinueStatement! new (SourceReference source) {
-               return (new ContinueStatement (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 85fe194..ba84acb 100644 (file)
@@ -31,7 +31,7 @@ public abstract class Vala.DataType : CodeNode {
        /**
         * The symbol name of this data type.
         */
-       public string! name { get; set construct; }
+       public string name { get; set; }
        
        /**
         * Specifies the accessibility of the class. Public accessibility
@@ -202,11 +202,11 @@ public abstract class Vala.DataType : CodeNode {
         */
        public Array! get_array () {
                if (array_type == null) {
-                       array_type = new Array (element_type = this);
+                       array_type = new Array (this);
                }
                
                /* create a new Symbol */
-               array_type.symbol = new Symbol (node = array_type);
+               array_type.symbol = new Symbol (array_type);
                this.symbol.parent_symbol.add (array_type.name, array_type.symbol);
                /* link the array type to the same source as the container type */
                array_type.source_reference = this.source_reference;
index ffcb748..067d5bf 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.DeclarationStatement : Statement {
         * @param source reference to source code
         * @return       newly created declaration statement
         */
-       public static ref DeclarationStatement! new (LocalVariableDeclaration! decl, SourceReference source) {
-               return (new DeclarationStatement (declaration = decl, source_reference = source));
+       public construct (LocalVariableDeclaration! decl, SourceReference source) {
+               declaration = decl;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index dc19e3a..9547714 100644 (file)
@@ -51,8 +51,8 @@ public class Vala.Destructor : CodeNode {
         * @param source reference to source code
         * @return       newly created destructor
         */
-       public static ref Destructor! new (SourceReference source) {
-               return (new Destructor (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index ac7160e..3dc0723 100644 (file)
@@ -44,8 +44,10 @@ public class Vala.DoStatement : Statement {
         * @param source reference to source code
         * @return       newly created do statement
         */
-       public static ref DoStatement! new (Statement! body, Expression! cond, SourceReference source) {
-               return (new DoStatement (body = body, condition = cond, source_reference = source));
+       public construct (Statement! _body, Expression! cond, SourceReference source) {
+               body = _body;
+               condition = cond;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index cf741f7..e1f793e 100644 (file)
@@ -36,8 +36,10 @@ public class Vala.ElementAccess : Expression {
         */
        public Expression! index { get; set; }
        
-       public static ref ElementAccess new (Expression container, Expression index, SourceReference source) {
-               return new ElementAccess (container = container, index = index, source_reference = source);
+       public construct (Expression _container, Expression _index, SourceReference source) {
+               container = _container;
+               index = _index;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 1df17ca..e35d86b 100644 (file)
@@ -32,8 +32,8 @@ public class Vala.EmptyStatement : Statement {
         * @param source reference to source code
         * @return       newly created empty statement
         */
-       public static ref EmptyStatement! new (SourceReference source) {
-               return (new EmptyStatement (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 1e1dcef..855e12b 100644 (file)
@@ -37,8 +37,9 @@ public class Vala.Enum : DataType {
         * @param source reference to source code
         * @return       newly created enum
         */
-       public static ref Enum! new (string! name, SourceReference source) {
-               return (new Enum (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
        
        /**
index 156e468..60ce091 100644 (file)
@@ -44,8 +44,8 @@ public class Vala.EnumValue : CodeNode {
         * @param name enum value name
         * @return     newly created enum value
         */
-       public static ref EnumValue! new (string! name) {
-               return (new EnumValue (name = name));
+       public construct (string! _name) {
+               name = _name;
        }
 
        /**
@@ -55,8 +55,9 @@ public class Vala.EnumValue : CodeNode {
         * @param value numerical representation
         * @return      newly created enum value
         */
-       public static ref EnumValue! new_with_value (string! name, Expression value) {
-               return (new EnumValue (name = name, value = value));
+       public construct with_value (string! _name, Expression _value) {
+               name = _name;
+               value = _value;
        }
        
        public override void accept (CodeVisitor! visitor) {
index ff35a13..76d5b27 100644 (file)
@@ -39,8 +39,9 @@ public class Vala.ExpressionStatement : Statement {
         * @param source reference to source code
         * @return       newly created expression statement
         */
-       public static ref ExpressionStatement! new (Expression! expr, SourceReference source) {
-               return (new ExpressionStatement (expression = expr, source_reference = source));
+       public construct (Expression! expr, SourceReference source = null) {
+               expression = expr;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 8f03029..3c58710 100644 (file)
@@ -74,8 +74,11 @@ public class Vala.Field : CodeNode {
         * @param source reference to source code
         * @return       newly created field
         */
-       public static ref Field! new (string! name, TypeReference! type, Expression init, SourceReference source) {
-               return (new Field (name = name, type_reference = type, initializer = init, source_reference = source));
+       public construct (string! _name, TypeReference! type, Expression init, SourceReference source) {
+               name = _name;
+               type_reference = type;
+               initializer = init;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 70aab5e..4c9b3a6 100644 (file)
@@ -36,8 +36,9 @@ public class Vala.Flags : DataType {
         * @param source reference to source code
         * @return       newly created flags
         */
-       public static ref Flags! new (string! name, SourceReference source) {
-               return (new Flags (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
        
        /**
index cb3fcfa..117c44d 100644 (file)
@@ -44,8 +44,8 @@ public class Vala.FlagsValue : CodeNode {
         * @param name  flags value name
         * @return      newly created flags value
         */
-       public static ref FlagsValue! new (string! name) {
-               return (new FlagsValue (name = name));
+       public construct (string! _name) {
+               name = _name;
        }
 
        /**
@@ -56,8 +56,9 @@ public class Vala.FlagsValue : CodeNode {
         * @param value numerical representation
         * @return      newly created flags value
         */
-       public static ref FlagsValue! new_with_value (string! name, Expression value) {
-               return (new FlagsValue (name = name, value = value));
+       public construct with_value (string! _name, Expression _value) {
+               name = _name;
+               value = _value;
        }
        
        public override void accept (CodeVisitor! visitor) {
index e0a4d3c..9be1117 100644 (file)
@@ -61,8 +61,12 @@ public class Vala.ForeachStatement : Statement {
         * @param source reference to source code
         * @return       newly created foreach statement
         */
-       public static ref ForeachStatement! new (TypeReference! type, string! id, Expression! col, Statement body, SourceReference source) {
-               return (new ForeachStatement (type_reference = type, variable_name = id, collection = col, body = body, source_reference = source));
+       public construct (TypeReference! type, string! id, Expression! col, Statement _body, SourceReference source) {
+               type_reference = type;
+               variable_name = id;
+               collection = col;
+               body = _body;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index a252e34..bd8b8f1 100644 (file)
@@ -56,16 +56,19 @@ public class Vala.FormalParameter : CodeNode {
         * @param source reference to source code
         * @return       newly created formal parameter
         */
-       public static ref FormalParameter new (string! name, TypeReference type, SourceReference source) {
-               return (new FormalParameter (name = name, type_reference = type, source_reference = source));
+       public construct (string! _name, TypeReference type, SourceReference source = null) {
+               name = _name;
+               type_reference = type;
+               source_reference = source;
        }
        
        /**
         * Creates a new ellipsis parameter representing an indefinite number of
         * parameters.
         */
-       public static ref FormalParameter new_ellipsis (SourceReference source) {
-               return (new FormalParameter (ellipsis = true, source_reference = source));
+       public construct with_ellipsis (SourceReference source = null) {
+               ellipsis = true;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 54bab51..d00479c 100644 (file)
@@ -47,8 +47,10 @@ public class Vala.ForStatement : Statement {
         * @param source reference to source code
         * @return       newly created for statement
         */
-       public static ref ForStatement! new (Expression cond, Statement body, SourceReference source) {
-               return (new ForStatement (condition = cond, body = body, source_reference = source));
+       public construct (Expression cond, Statement _body, SourceReference source) {
+               condition = cond;
+               body = _body;
+               source_reference = source;
        }
        
        /**
index 2e09666..53f38d8 100644 (file)
@@ -49,8 +49,11 @@ public class Vala.IfStatement : Statement {
         * @param false_stmt statement to be evaluated if condition is false
         * @return           newly created if statement
         */
-       public static ref IfStatement! new (Expression! cond, Block! true_stmt, Block false_stmt, SourceReference source) {
-               return (new IfStatement (condition = cond, true_statement = true_stmt, false_statement = false_stmt, source_reference = source));
+       public construct (Expression! cond, Block! true_stmt, Block false_stmt, SourceReference source) {
+               condition = cond;
+               true_statement = true_stmt;
+               false_statement = false_stmt;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index f2ad16b..4df91b2 100644 (file)
@@ -52,8 +52,8 @@ public class Vala.InitializerList : Expression {
         * @param source reference to source code
         * @return       newly created initializer list
         */
-       public static ref InitializerList! new (SourceReference source) {
-               return (new InitializerList (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index a0c2f92..0c76417 100644 (file)
@@ -36,8 +36,20 @@ public class Vala.InstanceCast : CCodeFunctionCall {
         */
        public CCodeExpression! inner { get; set construct; }
        
+       /**
+        * Creates a new instance cast expression.
+        *
+        * @param expr an expression
+        * @param type the target type
+        * @return     newly created instance cast expression
+        */
+       public construct (CCodeExpression! expr, DataType! type) {
+               inner = expr;
+               type_reference = type;
+       }
+       
        InstanceCast () {
-               call = new CCodeIdentifier (name = type_reference.get_upper_case_cname (null));
+               call = new CCodeIdentifier (type_reference.get_upper_case_cname (null));
                add_argument ((CCodeExpression) inner);
        }
 }
index f96e666..ca21e35 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.IntegerLiteral : Literal {
         * @param source reference to source code
         * @return       newly created integer literal
         */
-       public static ref IntegerLiteral! new (string! i, SourceReference source) {
-               return (new IntegerLiteral (value = i, source_reference = source));
+       public construct (string! i, SourceReference source = null) {
+               value = i;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 3283455..d37fb95 100644 (file)
@@ -41,8 +41,9 @@ public class Vala.Interface : DataType {
         * @param source reference to source code
         * @return       newly created interface
         */
-       public static ref Interface! new (string! name, SourceReference source) {
-               return (new Interface (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
 
        /**
index a38f2f4..e4f330a 100644 (file)
@@ -29,7 +29,11 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
        /**
         * Specifies the interface to be registered.
         */
-       public Interface interface_reference { get; construct; }
+       public Interface! interface_reference { get; set construct; }
+       
+       public construct (Interface! iface) {
+               interface_reference = iface;
+       }
        
        public override DataType! get_type_declaration () {
                return interface_reference;
index 1bda220..75e8835 100644 (file)
@@ -40,8 +40,9 @@ public class Vala.InvocationExpression : Expression {
         * @param source reference to source code
         * @return       newly created invocation expression
         */
-       public static ref InvocationExpression! new (Expression! call, SourceReference source) {
-               return (new InvocationExpression (call = call, source_reference = source));
+       public construct (Expression! _call, SourceReference source = null) {
+               call = _call;
+               source_reference = source;
        }
        
        /**
index eaee3ad..c6ae334 100644 (file)
@@ -53,8 +53,9 @@ public class Vala.LambdaExpression : Expression {
         * @param source reference to source code
         * @return       newly created lambda expression
         */
-       public static ref LambdaExpression! new (Expression! body, SourceReference source) {
-               return new LambdaExpression (expression_body = body, source_reference = source);
+       public construct (Expression! body, SourceReference source) {
+               expression_body = body;
+               source_reference = source;
        }
        
        /**
@@ -64,8 +65,9 @@ public class Vala.LambdaExpression : Expression {
         * @param source reference to source code
         * @return       newly created lambda expression
         */
-       public static ref LambdaExpression! new_with_statement_body (Block! body, SourceReference source) {
-               return new LambdaExpression (statement_body = body, source_reference = source);
+       public construct with_statement_body (Block! body, SourceReference source) {
+               statement_body = body;
+               source_reference = source;
        }
        
        /**
index 6a29a03..0d8f935 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.LiteralExpression : Expression {
         * @param source  reference to source code
         * @return        newly created literal expression
         */
-       public static ref LiteralExpression! new (Literal! literal, SourceReference source) {
-               return (new LiteralExpression (literal = literal, source_reference = source));
+       public construct (Literal! _literal, SourceReference source = null) {
+               literal = _literal;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 31532ff..817aa39 100644 (file)
@@ -40,8 +40,9 @@ public class Vala.LocalVariableDeclaration : CodeNode {
         * @param source reference to source code
         * @return       newly created local variable declaration
         */
-       public static ref LocalVariableDeclaration! new (TypeReference type, SourceReference source) {
-               return (new LocalVariableDeclaration (type_reference = type, source_reference = source));
+       public construct (TypeReference type, SourceReference source) {
+               type_reference = type;
+               source_reference = source;
        }
        
        /**
@@ -52,8 +53,8 @@ public class Vala.LocalVariableDeclaration : CodeNode {
         * @param source reference to source code
         * @return       newly created local variable declaration
         */
-       public static ref LocalVariableDeclaration! new_var (SourceReference source) {
-               return (new LocalVariableDeclaration (source_reference = source));
+       public construct var_type (SourceReference source) {
+               source_reference = source;
        }
        
        /**
index c0bdde6..af49fd5 100644 (file)
@@ -46,8 +46,15 @@ public class Vala.MemberAccess : Expression {
         * @param source reference to source code
         * @return       newly created member access expression
         */
-       public static ref MemberAccess! new (Expression inner, string! member, SourceReference source) {
-               return new MemberAccess (inner = inner, member_name = member, source_reference = source);
+       public construct (Expression _inner, string! member, SourceReference source = null) {
+               inner = _inner;
+               member_name = member;
+               source_reference = source;
+       }
+
+       public construct simple (string! member, SourceReference source = null) {
+               member_name = member;
+               source_reference = source;
        }
        
        /**
index 2234ece..7be517a 100644 (file)
@@ -125,8 +125,10 @@ public class Vala.Method : CodeNode {
         * @param source      reference to source code
         * @return            newly created method
         */
-       public static ref Method! new (string name, TypeReference return_type, SourceReference source) {
-               return (new Method (name = name, return_type = return_type, source_reference = source));
+       public construct (string _name, TypeReference _return_type, SourceReference source = null) {
+               name = _name;
+               return_type = _return_type;
+               source_reference = source;
        }
        
        /**
index 4427b36..ad9118b 100644 (file)
@@ -45,8 +45,10 @@ public class Vala.NamedArgument : CodeNode {
         * @param source reference to source code
         * @return       newly created named argument
         */
-       public static ref NamedArgument! new (string! name, Expression! arg, SourceReference source) {
-               return (new NamedArgument (name = name, argument = arg, source_reference = source));
+       public construct (string! _name, Expression! arg, SourceReference source) {
+               name = _name;
+               argument = arg;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 9dd0db9..c242ec5 100644 (file)
@@ -52,8 +52,9 @@ public class Vala.Namespace : CodeNode {
         * @param source reference to source code
         * @return       newly created namespace
         */
-       public static ref Namespace! new (string! name, SourceReference source) {
-               return (new Namespace (name = name, source_reference = source));
+       public construct (string _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
        
        /**
@@ -197,7 +198,7 @@ public class Vala.Namespace : CodeNode {
         * @return           the specified string converted to lower case
         */
        public static ref string! camel_case_to_lower_case (string! camel_case) {
-               String result = String.new ("");
+               String result = new String ("");
                
                string i = camel_case;
                
index e0dbdf8..572f05a 100644 (file)
@@ -43,8 +43,9 @@ public class Vala.NamespaceReference : CodeNode {
         * @param source reference to source code
         * @return       newly created namespace reference
         */
-       public static ref NamespaceReference! new (string! name, SourceReference source) {
-               return (new NamespaceReference (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index f835b81..27e24c9 100644 (file)
@@ -32,8 +32,8 @@ public class Vala.NullLiteral : Literal {
         * @param source reference to source code
         * @return       newly created null literal
         */
-       public static ref NullLiteral! new (SourceReference source) {
-               return (new NullLiteral (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index a12a949..bbb1930 100644 (file)
@@ -52,8 +52,9 @@ public class Vala.ObjectCreationExpression : Expression {
         * @param source reference to source code
         * @return       newly created object creation expression
         */
-       public static ref ObjectCreationExpression! new (MemberAccess! name, SourceReference source) {
-               return (new ObjectCreationExpression (member_name = name, source_reference = source));
+       public construct (MemberAccess! name, SourceReference source) {
+               member_name = name;
+               source_reference = source;
        }
        
        /**
index 1d8f88c..b5edf4e 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class ParenthesizedExpression : Expression {
-               public Expression inner { get; construct; }
+/**
+ * Represents a parenthesized expression in the source code.
+ */
+public class Vala.ParenthesizedExpression : Expression {
+       /**
+        * The inner expression.
+        */
+       public Expression! inner { get; set construct; }
 
-               public static ref ParenthesizedExpression new (Expression inner, SourceReference source) {
-                       return (new ParenthesizedExpression (inner = inner, source_reference = source));
-               }
+       /**
+        * Creates a new parenthesized expression.
+        *
+        * @param inner  an expression
+        * @param source reference to source code
+        * @return       newly created parenthesized expression
+        */
+       public construct (Expression! _inner, SourceReference source) {
+               inner = _inner;
+               source_reference = source;
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               inner.accept (visitor);
                
-               public override void accept (CodeVisitor! visitor) {
-                       inner.accept (visitor);
-                       
-                       visitor.visit_parenthesized_expression (this);
-               }
+               visitor.visit_parenthesized_expression (this);
        }
 }
index 103b778..80836a3 100644 (file)
@@ -76,7 +76,7 @@ public class Vala.Parser : CodeVisitor {
                        return null;
                }
                
-               String result = String.new (comment);
+               String result = new String (comment);
                comment = null;
                
                string index;
index db7082a..c41afef 100644 (file)
@@ -44,8 +44,10 @@ public class Vala.PostfixExpression : Expression {
         * @param source reference to source code
         * @return newly created postfix expression
         */
-       public static ref PostfixExpression! new (Expression! inner, bool inc, SourceReference source) {
-               return (new PostfixExpression (inner = inner, increment = inc, source_reference = source));
+       public construct (Expression! _inner, bool inc, SourceReference source) {
+               inner = _inner;
+               increment = inc;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index b33ff70..811da79 100644 (file)
@@ -75,8 +75,12 @@ public class Vala.Property : CodeNode {
         * @param source       reference to source code
         * @return             newly created property
         */
-       public static ref Property! new (string! name, TypeReference! type, PropertyAccessor get_accessor, PropertyAccessor set_accessor, SourceReference source) {
-               return (new Property (name = name, type_reference = type, get_accessor = get_accessor, set_accessor = set_accessor, source_reference = source));
+       public construct (string! _name, TypeReference! type, PropertyAccessor _get_accessor, PropertyAccessor _set_accessor, SourceReference source) {
+               name = _name;
+               type_reference = type;
+               get_accessor = _get_accessor;
+               set_accessor = _set_accessor;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
@@ -111,7 +115,7 @@ public class Vala.Property : CodeNode {
         * @return string literal to be used in C code
         */
        public ref CCodeConstant! get_canonical_cconstant () {
-               var str = String.new ("\"");
+               var str = new String ("\"");
                
                string i = name;
                
@@ -128,7 +132,7 @@ public class Vala.Property : CodeNode {
                
                str.append_c ('"');
                
-               return new CCodeConstant (name = str.str);
+               return new CCodeConstant (str.str);
        }
        
        /**
index 5d33c7b..457aa2e 100644 (file)
@@ -62,8 +62,12 @@ public class Vala.PropertyAccessor : CodeNode {
         * @param source       reference to source code
         * @return             newly created property accessor
         */
-       public static ref PropertyAccessor! new (bool readable, bool writable, bool construction, Statement body, SourceReference source) {
-               return (new PropertyAccessor (readable = readable, writable = writable, construction = construction, body = body, source_reference = source));
+       public construct (bool _readable, bool _writable, bool _construction, Statement _body, SourceReference source) {
+               readable = _readable;
+               writable = _writable;
+               construction = _construction;
+               body = _body;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 1d09d15..00e440e 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class RealLiteral : Literal {
-               public string value { get; set; }
+/**
+ * Represents a real literal in the source code.
+ */
+public class Vala.RealLiteral : Literal {
+       /**
+        * The literal value.
+        */
+       public string value { get; set; }
 
-               public static ref RealLiteral! new (string r, SourceReference source) {
-                       return (new RealLiteral (value = r, source_reference = source));
-               }
-               
-               public override void accept (CodeVisitor! visitor) {
-                       visitor.visit_real_literal (this);
-               }
+       /**
+        * Creates a new real literal.
+        *
+        * @param r      literal value
+        * @param source reference to source code
+        * @return       newly created real literal
+        */
+       public construct (string r, SourceReference source) {
+               value = r;
+               source_reference = source;
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               visitor.visit_real_literal (this);
        }
 }
index 83a898c..8936fbb 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class Report {
-               static int warnings;
-               static int errors;
-               
-               public static int get_warnings () {
-                       return warnings;
-               }
-               
-               public static int get_errors () {
-                       return errors;
-               }
+/**
+ * Static class to centralize reporting warnings and errors.
+ */
+public class Vala.Report {
+       private static int warnings;
+       private static int errors;
+       
+       /**
+        * Returns the total number of warnings reported.
+        */
+       public static int get_warnings () {
+               return warnings;
+       }
        
-               public static void warning (SourceReference source, string message) {
-                       warnings++;
-                       if (source == null) {
-                               stderr.printf ("warning: %s\n", message);
-                       } else {
-                               stderr.printf ("%s: warning: %s\n", source.to_string (), message);
-                       }
+       /**
+        * Returns the total number of errors reported.
+        */
+       public static int get_errors () {
+               return errors;
+       }
+
+       /**
+        * Reports the specified message as warning.
+        *
+        * @param source  reference to source code
+        * @param message warning message
+        */
+       public static void warning (SourceReference source, string! message) {
+               warnings++;
+               if (source == null) {
+                       stderr.printf ("warning: %s\n", message);
+               } else {
+                       stderr.printf ("%s: warning: %s\n", source.to_string (), message);
                }
-               
-               public static void error (SourceReference source, string message) {
-                       errors++;
-                       if (source == null) {
-                               stderr.printf ("error: %s\n", message);
-                       } else {
-                               stderr.printf ("%s: error: %s\n", source.to_string (), message);
-                       }
+       }
+       
+       /**
+        * Reports the specified message as error.
+        *
+        * @param source  reference to source code
+        * @param message error message
+        */
+       public static void error (SourceReference source, string! message) {
+               errors++;
+               if (source == null) {
+                       stderr.printf ("error: %s\n", message);
+               } else {
+                       stderr.printf ("%s: error: %s\n", source.to_string (), message);
                }
        }
 }
index 5643249..a083d6f 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class ReturnStatement : Statement {
-               public Expression return_expression { get; construct; }
+/**
+ * Represents a return statement in the source code.
+ */
+public class Vala.ReturnStatement : Statement {
+       /**
+        * The optional expression to return.
+        */
+       public Expression return_expression { get; set; }
 
-               public static ref ReturnStatement new (Expression result, SourceReference source) {
-                       return (new ReturnStatement (return_expression = result, source_reference = source));
-               }
+       /**
+        * Creates a new return statement.
+        *
+        * @param result the return expression
+        * @param source reference to source code
+        * @return       newly created return statement
+        */
+       public construct (Expression result = null, SourceReference source = null) {
+               return_expression = result;
+               source_reference = source;
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               if (return_expression != null) {
+                       return_expression.accept (visitor);
                
-               public override void accept (CodeVisitor! visitor) {
-                       if (return_expression != null) {
-                               return_expression.accept (visitor);
-                       
-                               visitor.visit_end_full_expression (return_expression);
-                       }
-
-                       visitor.visit_return_statement (this);
+                       visitor.visit_end_full_expression (return_expression);
                }
+
+               visitor.visit_return_statement (this);
        }
 }
index fd12b6d..dd35f7d 100644 (file)
@@ -47,6 +47,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 
        private int next_lambda_id = 0;
        
+       public construct (bool manage_memory = true) {
+               memory_management = manage_memory;
+       }
+       
        /**
         * Analyze and check code in the specified context.
         *
@@ -344,7 +348,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        current_source_file.add_symbol_dependency (decl.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE);
                }
 
-               decl.symbol = new Symbol (node = decl);
+               decl.symbol = new Symbol (decl);
                current_symbol.add (decl.name, decl.symbol);
                
                var block = (Block) current_symbol.node;
@@ -396,10 +400,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        current_source_file.add_symbol_dependency (stmt.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE);
                }
                
-               stmt.variable_declarator = new VariableDeclarator (name = stmt.variable_name);
+               stmt.variable_declarator = new VariableDeclarator (stmt.variable_name);
                stmt.variable_declarator.type_reference = stmt.type_reference;
        
-               stmt.variable_declarator.symbol = new Symbol (node = stmt.variable_declarator);
+               stmt.variable_declarator.symbol = new Symbol (stmt.variable_declarator);
                current_symbol.add (stmt.variable_name, stmt.variable_declarator.symbol);
        }
 
@@ -1089,11 +1093,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                            && expr.right.static_type.data_type == string_type.data_type) {
                                /* string comparison: convert to a.collate (b) OP 0 */
                                
-                               var cmp_call = new InvocationExpression (call = new MemberAccess (inner = expr.left, member_name = "collate"));
+                               var cmp_call = new InvocationExpression (new MemberAccess (expr.left, "collate"));
                                cmp_call.add_argument (expr.right);
                                expr.left = cmp_call;
                                
-                               expr.right = new LiteralExpression (literal = new IntegerLiteral (value = "0"));
+                               expr.right = new LiteralExpression (new IntegerLiteral ("0"));
                                
                                expr.left.accept (this);
                        } else {
@@ -1121,11 +1125,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                            && expr.right.static_type.data_type == string_type.data_type) {
                                /* string comparison: convert to a.collate (b) OP 0 */
                                
-                               var cmp_call = new InvocationExpression (call = new MemberAccess (inner = expr.left, member_name = "collate"));
+                               var cmp_call = new InvocationExpression (new MemberAccess (expr.left, "collate"));
                                cmp_call.add_argument (expr.right);
                                expr.left = cmp_call;
                                
-                               expr.right = new LiteralExpression (literal = new IntegerLiteral (value = "0"));
+                               expr.right = new LiteralExpression (new IntegerLiteral ("0"));
                                
                                expr.left.accept (this);
                        }
@@ -1169,6 +1173,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                }
                
                /* FIXME: use greatest lower bound in the type hierarchy */
+               /* FIXME: support memory management */
                expr.static_type = expr.true_expression.static_type;
        }
        
@@ -1201,9 +1206,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                var current_method = find_current_method ();
                
                var cb = (Callback) l.expected_type.data_type;
-               l.method = new Method (name = get_lambda_name (), return_type = cb.return_type);
+               l.method = new Method (get_lambda_name (), cb.return_type);
                l.method.instance = cb.instance && current_method.instance;
-               l.method.symbol = new Symbol (node = l.method);
+               l.method.symbol = new Symbol (l.method);
                l.method.symbol.parent_symbol = current_symbol;
                
                var lambda_params = l.get_parameters ();
@@ -1216,9 +1221,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        
                        var lambda_param = (string) lambda_param_it.data;
                        
-                       var param = new FormalParameter (name = lambda_param);
-                       param.type_reference = cb_param.type_reference;
-                       param.symbol = new Symbol (node = param);
+                       var param = new FormalParameter (lambda_param, cb_param.type_reference);
+                       param.symbol = new Symbol (param);
                        l.method.symbol.add (param.name, param.symbol);
                        
                        l.method.add_parameter (param);
@@ -1235,13 +1239,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                
                if (l.expression_body != null) {
                        var block = new Block ();
-                       block.symbol = new Symbol (node = block);
+                       block.symbol = new Symbol (block);
                        block.symbol.parent_symbol = l.method.symbol;
 
                        if (l.method.return_type.data_type != null) {
-                               block.add_statement (new ReturnStatement (return_expression = l.expression_body));
+                               block.add_statement (new ReturnStatement (l.expression_body));
                        } else {
-                               block.add_statement (new ExpressionStatement (expression = l.expression_body));
+                               block.add_statement (new ExpressionStatement (l.expression_body));
                        }
                
                        l.method.body = block;
index c9f31a8..d1aa4a1 100644 (file)
@@ -53,8 +53,10 @@ public class Vala.Signal : CodeNode {
         * @param source      reference to source code
         * @return            newly created signal
         */
-       public static ref Signal! new (string! name, TypeReference! return_type, SourceReference source) {
-               return (new Signal (name = name, return_type = return_type, source_reference = source));
+       public construct (string! _name, TypeReference! _return_type, SourceReference source) {
+               name = _name;
+               return_type = _return_type;
+               source_reference = source;
        }
        
        /**
@@ -82,11 +84,12 @@ public class Vala.Signal : CodeNode {
         */
        public Callback! get_callback () {
                if (generated_callback == null) {
-                       generated_callback = new Callback (return_type = return_type, instance = true);
+                       generated_callback = new Callback (null, return_type);
+                       generated_callback.instance = true;
                        
-                       var sender_param = new FormalParameter (name = "sender");
-                       sender_param.type_reference = new TypeReference ();
-                       sender_param.type_reference.data_type = (DataType) symbol.parent_symbol.node;
+                       var sender_type = new TypeReference ();
+                       sender_type.data_type = (DataType) symbol.parent_symbol.node;
+                       var sender_param = new FormalParameter ("sender", sender_type);
                        generated_callback.add_parameter (sender_param);
                        
                        foreach (FormalParameter! param in parameters) {
index 9ca79a9..278d791 100644 (file)
@@ -79,8 +79,20 @@ public class Vala.SourceFile {
        private List<weak SourceFile> header_internal_full_dependencies;
        private List<weak SourceFile> header_internal_dependencies;
        
+       /**
+        * Creates a new source file.
+        *
+        * @param filename source file name
+        * @param pkg      true if this is a VAPI package file
+        * @return         newly created source file
+        */
+       public construct (string! _filename, bool _pkg =  false) {
+               filename = _filename;
+               pkg = _pkg;
+       }
+       
        SourceFile () {
-               global_namespace = new Namespace (source_reference = new SourceReference (file = this));
+               global_namespace = new Namespace (null, new SourceReference (this));
        }
        
        /**
index ead77a8..e77f6cd 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class SourceFileCycle {
-               public List<weak SourceFile> files;
-               public weak SourceFile head;
-       }
+/**
+ * Represents a dependency cycle of source files.
+ */
+public class Vala.SourceFileCycle {
+       /**
+        * The members of this source file cycle.
+        */
+       public List<weak SourceFile> files;
+       
+       /**
+        * The head of this source file cycle.
+        */
+       public weak SourceFile head;
 }
index 97aaf82..a65257b 100644 (file)
  *     Jürg Billeter <j@bitron.ch>
  */
 
-namespace Vala {
-       public class SourceReference {
-               public weak SourceFile file { get; construct; }
-               public int first_line { get; construct; }
-               public int first_column { get; construct; }
-               public int last_line { get; construct; }
-               public int last_column { get; construct; }
-               public string comment { get; construct; }
-               
-               public static ref SourceReference new (SourceFile file, int first_line, int first_column, int last_line, int last_column) {
-                       return (new SourceReference (file = file, first_line = first_line, first_column = first_column, last_line = last_line, last_column = last_column));
-               }
-               
-               public static ref SourceReference new_with_comment (SourceFile file, int first_line, int first_column, int last_line, int last_column, string comment) {
-                       return (new SourceReference (file = file, first_line = first_line, first_column = first_column, last_line = last_line, last_column = last_column, comment = comment));
-               }
-               
-               public ref string to_string () {
-                       return ("%s:%d.%d-%d.%d".printf (file.filename, first_line, first_column, last_line, last_column));
-               }
+/**
+ * Represents a reference to a location in a source file.
+ */
+public class Vala.SourceReference {
+       /**
+        * The source file to be referenced.
+        */
+       public weak SourceFile file { get; set; }
+
+       /**
+        * The first line number of the referenced source code.
+        */
+       public int first_line { get; set; }
+
+       /**
+        * The first column number of the referenced source code.
+        */
+       public int first_column { get; set; }
+
+       /**
+        * The last line number of the referenced source code.
+        */
+       public int last_line { get; set; }
+
+       /**
+        * The last column number of the referenced source code.
+        */
+       public int last_column { get; set; }
+
+       /**
+        * The text describing the referenced source code.
+        */
+       public string comment { get; set; }
+       
+       /**
+        * Creates a new source reference.
+        *
+        * @param file         a source file
+        * @param first_line   first line number
+        * @param first_column first column number
+        * @param last_line    last line number
+        * @param last_column  last column number
+        * @return             newly created source reference
+        */
+       public construct (SourceFile _file, int _first_line = 0, int _first_column = 0, int _last_line = 0, int _last_column = 0) {
+               file = _file;
+               first_line = _first_line;
+               first_column = _first_column;
+               last_line = _last_line;
+               last_column = _last_column;
+       }
+       
+       /**
+        * Creates a new commented source reference.
+        *
+        * @param file         a source file
+        * @param first_line   first line number
+        * @param first_column first column number
+        * @param last_line    last line number
+        * @param last_column  last column number
+        * @param comment      code comment
+        * @return             newly created source reference
+        */
+       public construct with_comment (SourceFile _file, int _first_line, int _first_column, int _last_line, int _last_column, string _comment) {
+               file = _file;
+               first_line = _first_line;
+               first_column = _first_column;
+               last_line = _last_line;
+               last_column = _last_column;
+               comment = _comment;
+       }
+       
+       /**
+        * Returns a string representation of this source reference.
+        *
+        * @return human-readable string
+        */
+       public ref string! to_string () {
+               return ("%s:%d.%d-%d.%d".printf (file.filename, first_line, first_column, last_line, last_column));
        }
 }
index 72e17b5..68588e9 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class StringLiteral : Literal {
-               public string value { get; set; }
+/**
+ * Represents a string literal in the source code.
+ */
+public class Vala.StringLiteral : Literal {
+       /**
+        * The literal value.
+        */
+       public string value { get; set; }
 
-               public static ref StringLiteral! new (string s, SourceReference source) {
-                       return (new StringLiteral (value = s, source_reference = source));
-               }
-               
-               public ref string eval () {
-                       if (value == null) {
-                               return null;
-                       }
-                       
-                       /* remove quotes */
-                       var noquotes = value.offset (1).ndup ((uint) (value.len () - 2));
-                       /* unescape string */
-                       return noquotes.compress ();
+       /**
+        * Creates a new string literal.
+        *
+        * @param s      the literal value
+        * @param source reference to source code
+        * @return       newly created string literal
+        */
+       public construct (string s, SourceReference source) {
+               value = s;
+               source_reference = source;
+       }
+
+       /**
+        * Evaluates the literal string value.
+        *
+        * @return the unescaped string
+        */     
+       public ref string eval () {
+               if (value == null) {
+                       return null;
                }
                
-               public override void accept (CodeVisitor! visitor) {
-                       visitor.visit_string_literal (this);
-               }
+               /* remove quotes */
+               var noquotes = value.offset (1).ndup ((uint) (value.len () - 2));
+               /* unescape string */
+               return noquotes.compress ();
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               visitor.visit_string_literal (this);
        }
 }
index bd8282a..2f1b805 100644 (file)
@@ -51,8 +51,9 @@ public class Vala.Struct : DataType {
         * @param source reference to source code
         * @return       newly created struct
         */
-       public static ref Struct! new (string! name, SourceReference source) {
-               return (new Struct (name = name, source_reference = source));
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
        }
 
        /**
index 5696f56..8a0141f 100644 (file)
@@ -38,8 +38,9 @@ public class Vala.SwitchLabel : CodeNode {
         * @param source reference to source code
         * @return       newly created switch case label
         */
-       public static ref SwitchLabel! new (Expression expr, SourceReference source) {
-               return (new SwitchLabel (expression = expr, source_reference = source));
+       public construct (Expression expr, SourceReference source = null) {
+               expression = expr;
+               source_reference = source;
        }
 
        /**
@@ -48,8 +49,8 @@ public class Vala.SwitchLabel : CodeNode {
         * @param source reference to source code
         * @return       newly created switch default label
         */
-       public static ref SwitchLabel! new_default (SourceReference source) {
-               return (new SwitchLabel (source_reference = source));
+       public construct with_default (SourceReference source = null) {
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 53090a4..84ba31a 100644 (file)
@@ -35,8 +35,8 @@ public class Vala.SwitchSection : CodeNode {
         * @param source reference to source code
         * @return       newly created switch section
         */
-       public static ref SwitchSection! new (SourceReference source) {
-               return (new SwitchSection (source_reference = source));
+       public construct (SourceReference source) {
+               source_reference = source;
        }
        
        /**
index 1aeaa12..dacaece 100644 (file)
@@ -40,8 +40,9 @@ public class Vala.SwitchStatement : Statement {
         * @param source reference to source code
         * @return       newly created switch statement
         */
-       public static ref SwitchStatement! new (Expression! expr, SourceReference source) {
-               return (new SwitchStatement (expression = expr, source_reference = source));
+       public construct (Expression! expr, SourceReference source) {
+               expression = expr;
+               source_reference = source;
        }
        
        /**
index 90cad1d..6d06366 100644 (file)
@@ -51,7 +51,17 @@ public class Vala.Symbol {
         */
        public bool active { get; set; }
        
-       private HashTable<string,Symbol> symbol_table = HashTable.new_full (str_hash, str_equal, g_free, g_object_unref);
+       private HashTable<string,Symbol> symbol_table = new HashTable.full (str_hash, str_equal, g_free, g_object_unref);
+       
+       /**
+        * Creates a new symbol.
+        *
+        * @param node the corresponding code node
+        * @return     newly created symbol
+        */
+       public construct (CodeNode _node = null)  {
+               node = _node;
+       }
        
        Symbol () {
                active = true;
index 3288891..501dda9 100644 (file)
@@ -54,7 +54,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
                        ns.symbol = root.lookup (ns.name);
                }
                if (ns.symbol == null) {
-                       ns.symbol = new Symbol (node = ns);
+                       ns.symbol = new Symbol (ns);
                        root.add (ns.name, ns.symbol);
                }
                
@@ -73,7 +73,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
                                return null;
                        }
                }
-               node.symbol = new Symbol (node = node);
+               node.symbol = new Symbol (node);
                if (name != null) {
                        current_symbol.add (name, node.symbol);
                } else {
@@ -152,7 +152,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
        }
 
        public override void visit_enum_value (EnumValue! ev) {
-               ev.symbol = new Symbol (node = ev);
+               ev.symbol = new Symbol (ev);
                current_symbol.add (ev.name, ev.symbol);
        }
        
@@ -210,9 +210,9 @@ public class Vala.SymbolBuilder : CodeVisitor {
                                return;
                        }
                
-                       m.this_parameter = new FormalParameter (name = "this", type_reference = new TypeReference ());
+                       m.this_parameter = new FormalParameter ("this", new TypeReference ());
                        m.this_parameter.type_reference.data_type = (DataType) m.symbol.parent_symbol.node;
-                       m.this_parameter.symbol = new Symbol (node = m.this_parameter);
+                       m.this_parameter.symbol = new Symbol (m.this_parameter);
                        current_symbol.add (m.this_parameter.name, m.this_parameter.symbol);
                }
                
@@ -241,9 +241,9 @@ public class Vala.SymbolBuilder : CodeVisitor {
                
                current_symbol = prop.symbol;
                
-               prop.this_parameter = new FormalParameter (name = "this", type_reference = new TypeReference ());
+               prop.this_parameter = new FormalParameter ("this", new TypeReference ());
                prop.this_parameter.type_reference.data_type = (DataType) prop.symbol.parent_symbol.node;
-               prop.this_parameter.symbol = new Symbol (node = prop.this_parameter);
+               prop.this_parameter.symbol = new Symbol (prop.this_parameter);
                current_symbol.add (prop.this_parameter.name, prop.this_parameter.symbol);
        }
        
@@ -257,7 +257,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
        }
        
        public override void visit_begin_property_accessor (PropertyAccessor! acc) {
-               acc.symbol = new Symbol (node = acc);
+               acc.symbol = new Symbol (acc);
                acc.symbol.parent_symbol = current_symbol;
                current_symbol = acc.symbol;
                
@@ -266,8 +266,8 @@ public class Vala.SymbolBuilder : CodeVisitor {
                }
 
                if (acc.writable || acc.construction) {
-                       acc.value_parameter = new FormalParameter (name = "value", type_reference = ((Property) current_symbol.parent_symbol.node).type_reference);
-                       acc.value_parameter.symbol = new Symbol (node = acc.value_parameter);
+                       acc.value_parameter = new FormalParameter ("value", ((Property) current_symbol.parent_symbol.node).type_reference);
+                       acc.value_parameter.symbol = new Symbol (acc.value_parameter);
                        
                        current_symbol.add (acc.value_parameter.name, acc.value_parameter.symbol);
                }
@@ -279,9 +279,9 @@ public class Vala.SymbolBuilder : CodeVisitor {
                        
                        var block = new Block ();
                        if (acc.readable) {
-                               block.add_statement (new ReturnStatement (return_expression = new MemberAccess (member_name = "_%s".printf (prop.name))));
+                               block.add_statement (new ReturnStatement (new MemberAccess.simple ("_%s".printf (prop.name))));
                        } else {
-                               block.add_statement (new ExpressionStatement (expression = new Assignment (left = new MemberAccess (member_name = "_%s".printf (prop.name)), right = new MemberAccess (member_name = "value"))));
+                               block.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("_%s".printf (prop.name)), new MemberAccess.simple ("value"))));
                        }
                        acc.body = block;
                }
@@ -309,7 +309,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
        }
 
        public override void visit_begin_constructor (Constructor! c) {
-               c.symbol = new Symbol (node = c);
+               c.symbol = new Symbol (c);
                c.symbol.parent_symbol = current_symbol;
                current_symbol = c.symbol;
        }
@@ -319,7 +319,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
        }
 
        public override void visit_begin_destructor (Destructor! d) {
-               d.symbol = new Symbol (node = d);
+               d.symbol = new Symbol (d);
                d.symbol.parent_symbol = current_symbol;
                current_symbol = d.symbol;
        }
@@ -329,7 +329,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
        }
 
        public override void visit_begin_block (Block! b) {
-               b.symbol = new Symbol (node = b);
+               b.symbol = new Symbol (b);
                b.symbol.parent_symbol = current_symbol;
                current_symbol = b.symbol;
        }
index 3ca4e11..558f9b9 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class TypeCheck : Expression {
-               public Expression expression { get; construct; }
-               public TypeReference type_reference { get; construct; }
-               
-               public static ref TypeCheck new (Expression expr, TypeReference type, SourceReference source) {
-                       return (new TypeCheck (expression = expr, type_reference = type, source_reference = source));
-               }
-               
-               public override void accept (CodeVisitor! visitor) {
-                       expression.accept (visitor);
-                       
-                       type_reference.accept (visitor);
+/**
+ * Represents a type check (`is') expression in the source code.
+ */
+public class Vala.TypeCheck : Expression {
+       /**
+        * The expression to be checked.
+        */
+       public Expression! expression { get; set construct; }
+       
+       /**
+        * The type to be matched against.
+        */
+       public TypeReference! type_reference { get; set construct; }
+
+       /**
+        * Creates a new type check expression.
+        *
+        * @param expr   an expression
+        * @param type   a data type
+        * @param source reference to source code
+        * @return       newly created type check expression
+        */     
+       public construct (Expression! expr, TypeReference! type, SourceReference source) {
+               expression = expr;
+               type_reference = type;
+               source_reference = source;
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               expression.accept (visitor);
                
-                       visitor.visit_type_check (this);
-               }
+               type_reference.accept (visitor);
+       
+               visitor.visit_type_check (this);
        }
 }
index 26f5c03..7151000 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class TypeofExpression : Expression {
-               public TypeReference type_reference { get; construct; }
+/**
+ * Represents a typeof expression in the source code.
+ */
+public class Vala.TypeofExpression : Expression {
+       /**
+        * The type to be retrieved.
+        */
+       public TypeReference! type_reference { get; set construct; }
 
-               public static ref TypeofExpression new (TypeReference type, SourceReference source) {
-                       return (new TypeofExpression (type_reference = type, source_reference = source));
-               }
-               
-               public override void accept (CodeVisitor! visitor) {
-                       type_reference.accept (visitor);
-               
-                       visitor.visit_typeof_expression (this);
-               }
+       /**
+        * Creates a new typeof expression.
+        *
+        * @param type   a data type
+        * @param source reference to source code
+        * @return       newly created typeof expression
+        */
+       public construct (TypeReference! type, SourceReference source) {
+               type_reference = type;
+               source_reference = source;
+       }
+       
+       public override void accept (CodeVisitor! visitor) {
+               type_reference.accept (visitor);
+       
+               visitor.visit_typeof_expression (this);
        }
 }
index 86adaf3..e92d0ad 100644 (file)
 
 using GLib;
 
-namespace Vala {
-       public class TypeParameter : CodeNode {
-               public string name { get; construct; }
-               public weak DataType type;
-               
-               public static ref TypeParameter new (string name, SourceReference source) {
-                       return (new TypeParameter (name = name, source_reference = source));
-               }
+/**
+ * Represents a generic type parameter in the source code.
+ */
+public class Vala.TypeParameter : CodeNode {
+       /**
+        * The parameter name.
+        */
+       public string! name { get; set construct; }
+       
+       /**
+        * The generic type declaring this parameter.
+        */
+       public weak DataType type;
+
+       /**
+        * Creates a new generic type parameter.
+        *
+        * @param name   parameter name
+        * @param source reference to source code
+        * @return       newly created generic type parameter
+        */     
+       public construct (string! _name, SourceReference source) {
+               name = _name;
+               source_reference = source;
+       }
 
-               public override void accept (CodeVisitor! visitor) {
-                       visitor.visit_type_parameter (this);
-               }
+       public override void accept (CodeVisitor! visitor) {
+               visitor.visit_type_parameter (this);
        }
 }
index 708ef1f..94b183d 100644 (file)
@@ -102,6 +102,9 @@ public class Vala.TypeReference : CodeNode {
        public bool is_weak { get; set; }
 
        private List<TypeReference> type_argument_list;
+       
+       public construct () {
+       }
 
        /**
         * Creates a new type reference.
@@ -111,8 +114,10 @@ public class Vala.TypeReference : CodeNode {
         * @param source    reference to source code
         * @return          newly created type reference
         */
-       public static ref TypeReference! new (string ns, string! type_name, SourceReference source) {
-               return (new TypeReference (namespace_name = ns, type_name = type_name, source_reference = source));
+       public construct from_name (string ns, string! type, SourceReference source) {
+               namespace_name = ns;
+               type_name = type;
+               source_reference = source;
        }
 
        /**
@@ -132,10 +137,10 @@ public class Vala.TypeReference : CodeNode {
                        if (ma.inner != null) {
                                if (ma.inner is MemberAccess) {
                                        var simple = (MemberAccess) ma.inner;
-                                       type_ref = new TypeReference (namespace_name = simple.member_name, type_name = ma.member_name, source_reference = source);
+                                       type_ref = new TypeReference.from_name (simple.member_name, ma.member_name, source);
                                }
                        } else {
-                               type_ref = new TypeReference (type_name = ma.member_name, source_reference = source);
+                               type_ref = new TypeReference.from_name (null, ma.member_name, source);
                        }
                        
                        if (type_ref != null) {
index 3e946c8..333ec0d 100644 (file)
@@ -34,30 +34,30 @@ public abstract class Vala.TypeRegisterFunction : CCodeFunction {
                return_type = "GType";
 
                var type_block = new CCodeBlock ();
-               var cdecl = new CCodeDeclaration (type_name = "GType");
-               cdecl.add_declarator (new CCodeVariableDeclarator (name = "g_define_type_id", initializer = new CCodeConstant (name = "0")));
+               var cdecl = new CCodeDeclaration ("GType");
+               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("g_define_type_id", new CCodeConstant ("0")));
                cdecl.modifiers = CCodeModifiers.STATIC;
                type_block.add_statement (cdecl);
                
-               var cond = new CCodeFunctionCall (call = new CCodeIdentifier (name = "G_UNLIKELY"));
-               cond.add_argument (new CCodeBinaryExpression (operator = CCodeBinaryOperator.EQUALITY, left = new CCodeIdentifier (name = "g_define_type_id"), right = new CCodeConstant (name = "0")));
+               var cond = new CCodeFunctionCall (new CCodeIdentifier ("G_UNLIKELY"));
+               cond.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new CCodeIdentifier ("g_define_type_id"), new CCodeConstant ("0")));
                var type_init = new CCodeBlock ();
-               var ctypedecl = new CCodeDeclaration (type_name = "const GTypeInfo");
+               var ctypedecl = new CCodeDeclaration ("const GTypeInfo");
                ctypedecl.modifiers = CCodeModifiers.STATIC;
-               ctypedecl.add_declarator (new CCodeVariableDeclarator (name = "g_define_type_info", initializer = new CCodeConstant (name = "{ sizeof (%s), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) %s, (GClassFinalizeFunc) NULL, NULL, %s, 0, (GInstanceInitFunc) %s }".printf (get_type_struct_name (), get_class_init_func_name (), get_instance_struct_size (), get_instance_init_func_name ()))));
+               ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("g_define_type_info", new CCodeConstant ("{ sizeof (%s), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) %s, (GClassFinalizeFunc) NULL, NULL, %s, 0, (GInstanceInitFunc) %s }".printf (get_type_struct_name (), get_class_init_func_name (), get_instance_struct_size (), get_instance_init_func_name ()))));
                type_init.add_statement (ctypedecl);
-               var reg_call = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_type_register_static"));
-               reg_call.add_argument (new CCodeIdentifier (name = get_parent_type_name ()));
-               reg_call.add_argument (new CCodeConstant (name = "\"%s\"".printf (get_type_declaration ().get_cname ())));
-               reg_call.add_argument (new CCodeIdentifier (name = "&g_define_type_info"));
-               reg_call.add_argument (new CCodeConstant (name = get_type_flags ()));
-               type_init.add_statement (new CCodeExpressionStatement (expression = new CCodeAssignment (left = new CCodeIdentifier (name = "g_define_type_id"), right = reg_call)));
+               var reg_call = new CCodeFunctionCall (new CCodeIdentifier ("g_type_register_static"));
+               reg_call.add_argument (new CCodeIdentifier (get_parent_type_name ()));
+               reg_call.add_argument (new CCodeConstant ("\"%s\"".printf (get_type_declaration ().get_cname ())));
+               reg_call.add_argument (new CCodeIdentifier ("&g_define_type_info"));
+               reg_call.add_argument (new CCodeConstant (get_type_flags ()));
+               type_init.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("g_define_type_id"), reg_call)));
                
                type_init.add_statement (get_type_interface_init_statements ());
                
-               var cif = new CCodeIfStatement (condition = cond, true_statement = type_init);
+               var cif = new CCodeIfStatement (cond, type_init);
                type_block.add_statement (cif);
-               type_block.add_statement (new CCodeReturnStatement (return_expression = new CCodeIdentifier (name = "g_define_type_id")));
+               type_block.add_statement (new CCodeReturnStatement (new CCodeIdentifier ("g_define_type_id")));
 
                block = type_block;
        }
@@ -126,6 +126,6 @@ public abstract class Vala.TypeRegisterFunction : CCodeFunction {
         * @return C function declaration
         */
        public ref CCodeFunction! get_declaration () {
-               return new CCodeFunction (name = name, return_type = return_type);
+               return new CCodeFunction (name, return_type);
        }
 }
index 11301a6..b31ea42 100644 (file)
@@ -46,8 +46,10 @@ public class Vala.UnaryExpression : Expression {
         * @param source reference to source code
         * @return       newly created binary expression
         */
-       public static ref UnaryExpression! new (UnaryOperator op, Expression! inner, SourceReference source) {
-               return (new UnaryExpression (operator = op, inner = inner, source_reference = source));
+       public construct (UnaryOperator op, Expression! _inner, SourceReference source) {
+               operator = op;
+               inner = _inner;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index e118cc7..811af5e 100644 (file)
@@ -49,8 +49,10 @@ public class Vala.VariableDeclarator : CodeNode {
         * @param source reference to source code
         * @return       newly created variable declarator
         */
-       public static ref VariableDeclarator! new (string! name, Expression init, SourceReference source) {
-               return (new VariableDeclarator (name = name, initializer = init, source_reference = source));
+       public construct (string! _name, Expression init = null, SourceReference source = null) {
+               name = _name;
+               initializer = init;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 4f12b3c..7bd4ff5 100644 (file)
@@ -44,8 +44,10 @@ public class Vala.WhileStatement : Statement {
         * @param source reference to source code
         * @return       newly created while statement
         */
-       public static ref WhileStatement! new (Expression! cond, Statement! body, SourceReference source) {
-               return (new WhileStatement (condition = cond, body = body, source_reference = source));
+       public construct (Expression! cond, Statement! _body, SourceReference source) {
+               condition = cond;
+               body = _body;
+               source_reference = source;
        }
        
        public override void accept (CodeVisitor! visitor) {
index 81a974e..0a8f403 100644 (file)
@@ -221,7 +221,7 @@ namespace GLib {
        
        [ReferenceType (dup_function = "g_main_loop_ref", free_function = "g_main_loop_unref")]
        public struct MainLoop {
-               public static ref MainLoop new (MainContext context, bool is_running);
+               public construct (MainContext context, bool is_running);
                public void run ();
                public void quit ();
                public bool is_running ();
@@ -230,7 +230,7 @@ namespace GLib {
        
        [ReferenceType (dup_function = "g_main_context_ref", free_function = "g_main_context_unref")]
        public struct MainContext {
-               public static ref MainContext new ();
+               public construct ();
                public static MainContext @default ();
                public bool iteration (bool may_block);
                public bool pending ();
@@ -242,13 +242,13 @@ namespace GLib {
        
        [ReferenceType ()]
        public struct IdleSource {
-               public static Source new ();
+               public construct ();
                public static uint add (SourceFunc function, pointer data);
        }
        
        [ReferenceType (dup_function = "g_source_ref", free_function = "g_source_unref")]
        public struct Source {
-               public static ref Source new (SourceFuncs source_funcs, uint struct_size);
+               public construct (SourceFuncs source_funcs, uint struct_size);
                public uint attach (MainContext context);
                public void set_callback (SourceFunc func, pointer data, DestroyNotify notify);
        }
@@ -377,7 +377,7 @@ namespace GLib {
        
        [ReferenceType (free_function = "g_mapped_file_free")]
        public struct MappedFile {
-               public static ref MappedFile new (string filename, bool writable, out Error error);
+               public construct (string filename, bool writable, out Error error);
                public void free ();
                public long get_length ();
                public char[] get_contents ();
@@ -398,7 +398,7 @@ namespace GLib {
 
        [ReferenceType (free_function = "g_option_context_free")]
        public struct OptionContext {
-               public static ref OptionContext new (string parameter_string);
+               public construct (string parameter_string);
                public bool parse (ref int argc, out string[] argv, out Error error);
                public void set_help_enabled (bool help_enabled);
                public void add_main_entries (OptionEntry[] entries, string translation_domain);
@@ -530,8 +530,8 @@ namespace GLib {
        
        [ReferenceType (dup_function = "g_hash_table_ref", free_function = "g_hash_table_unref", ref_function = "g_hash_table_ref")]
        public struct HashTable<K,V> {
-               public static ref HashTable new (HashFunc hash_func, EqualFunc key_equal_func);
-               public static ref HashTable new_full (HashFunc hash_func, EqualFunc key_equal_func, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func);
+               public construct (HashFunc hash_func, EqualFunc key_equal_func);
+               public construct full (HashFunc hash_func, EqualFunc key_equal_func, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func);
                public void insert (ref K key, ref V value);
                public void replace (ref K key, ref V value);
                public V lookup (K key);
@@ -557,8 +557,9 @@ namespace GLib {
        
        [ReferenceType (free_function = "g_string_free")]
        public struct String {
-               public static ref String! new (string init = "");
-               public static ref String! sized_new (ulong dfl_size);
+               public construct (string init = "");
+               [CCode (cname = "g_string_sized_new")]
+               public construct sized (ulong dfl_size);
                public String assign (string! rval);
                public String append (string! val);
                public String append_c (char c);