update for 0.0.2 release check for floating reference in construction VALA_0_0_2
authorJürg Billeter <j@bitron.ch>
Wed, 2 Aug 2006 19:20:57 +0000 (19:20 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 2 Aug 2006 19:20:57 +0000 (19:20 +0000)
2006-08-02  Jürg Billeter  <j@bitron.ch>

* NEWS: update for 0.0.2 release
* vala/valasemanticanalyzer.vala: check for floating reference in
  construction methods
* vala/valasourcefile.vala, vala/valacodegenerator.vala,
  ccode/valaccodeincludedirective.vala: differentiate between
  package-internal and external includes
* vapi/gtk+-2.0.vala: port to construction methods

svn path=/trunk/; revision=90

vala/ChangeLog
vala/NEWS
vala/ccode/valaccodeincludedirective.vala
vala/vala/valacodegenerator.vala
vala/vala/valasemanticanalyzer.vala
vala/vala/valasourcefile.vala
vala/vapi/gtk+-2.0.vala

index d90c612..93b518f 100644 (file)
@@ -1,5 +1,15 @@
 2006-08-02  Jürg Billeter  <j@bitron.ch>
 
+       * NEWS: update for 0.0.2 release
+       * vala/valasemanticanalyzer.vala: check for floating reference in
+         construction methods
+       * vala/valasourcefile.vala, vala/valacodegenerator.vala,
+         ccode/valaccodeincludedirective.vala: differentiate between
+         package-internal and external includes
+       * vapi/gtk+-2.0.vala: port to construction methods
+
+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,
index 2233f15..55ac10f 100644 (file)
--- a/vala/NEWS
+++ b/vala/NEWS
@@ -1,3 +1,12 @@
+Vala 0.0.2
+==========
+
+ * Support named construction methods.
+ * Basic interface support.
+ * Improve error handling.
+ * Many bug fixes.
+
+
 Vala 0.0.1
 ==========
 
index 4630658..2289674 100644 (file)
@@ -31,15 +31,31 @@ public class Vala.CCodeIncludeDirective : CCodeNode {
         */
        public string! filename { get; set construct; }
        
-       public construct (string! _filename) {
+       /**
+        * Specifies whether the specified file should be searched in the local
+        * directory.
+        */
+       public bool local { get; set; }
+       
+       public construct (string! _filename, bool _local = false) {
                filename = _filename;
+               local = _local;
        }
        
        public override void write (CCodeWriter! writer) {
                writer.write_indent ();
-               writer.write_string ("#include <");
+               writer.write_string ("#include ");
+               if (local) {
+                       writer.write_string ("\"");
+               } else {
+                       writer.write_string ("<");
+               }
                writer.write_string (filename);
-               writer.write_string (">");
+               if (local) {
+                       writer.write_string ("\"");
+               } else {
+                       writer.write_string (">");
+               }
                writer.write_newline ();
        }
 }
index 5647610..c996f92 100644 (file)
@@ -109,7 +109,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                next_temp_var_id = 0;
                
                header_begin.append (new CCodeIncludeDirective ("glib.h"));
-               source_include_directives.append (new CCodeIncludeDirective (source_file.get_cheader_filename ()));
+               source_include_directives.append (new CCodeIncludeDirective (source_file.get_cheader_filename (), true));
                
                ref List<string> used_includes = null;
                used_includes.append ("glib.h");
@@ -123,16 +123,22 @@ public class Vala.CodeGenerator : CodeVisitor {
                }
                foreach (string filename2 in source_file.get_header_internal_includes ()) {
                        if (used_includes.find_custom (filename2, strcmp) == null) {
-                               header_begin.append (new CCodeIncludeDirective (filename2));
+                               header_begin.append (new CCodeIncludeDirective (filename2, true));
                                used_includes.append (filename2);
                        }
                }
-               foreach (string filename3 in source_file.get_source_includes ()) {
+               foreach (string filename3 in source_file.get_source_external_includes ()) {
                        if (used_includes.find_custom (filename3, strcmp) == null) {
                                source_include_directives.append (new CCodeIncludeDirective (filename3));
                                used_includes.append (filename3);
                        }
                }
+               foreach (string filename4 in source_file.get_source_internal_includes ()) {
+                       if (used_includes.find_custom (filename4, strcmp) == null) {
+                               source_include_directives.append (new CCodeIncludeDirective (filename4, true));
+                               used_includes.append (filename4);
+                       }
+               }
                if (source_file.is_cycle_head) {
                        foreach (SourceFile cycle_file in source_file.cycle.files) {
                                var namespaces = cycle_file.get_namespaces ();
index dd35f7d..5a6f39d 100644 (file)
@@ -137,6 +137,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        m.return_type.data_type = (DataType) current_symbol.node;
                        m.return_type.transfers_ownership = true;
                        
+                       if (current_symbol.node is Class) {
+                               // check for floating reference
+                               var cl = (Class) current_symbol.node;
+                               while (cl != null) {
+                                       if (cl == initially_unowned_type) {
+                                               m.return_type.floating_reference = true;
+                                               break;
+                                       }
+                               
+                                       cl = cl.base_class;
+                               }
+                       }
+                       
                        if (m.body != null) {
                                m.body.construction = true;
                        }
index 278d791..5d1e5eb 100644 (file)
@@ -74,7 +74,8 @@ public class Vala.SourceFile {
        
        private List<weak string> header_external_includes;
        private List<weak string> header_internal_includes;
-       private List<weak string> source_includes;
+       private List<weak string> source_external_includes;
+       private List<weak string> source_internal_includes;
        
        private List<weak SourceFile> header_internal_full_dependencies;
        private List<weak SourceFile> header_internal_dependencies;
@@ -220,7 +221,11 @@ public class Vala.SourceFile {
                }
                
                if (dep_type == SourceFileDependencyType.SOURCE) {
-                       source_includes.concat (t.get_cheader_filenames ());
+                       if (t.source_reference.file.pkg) {
+                               source_external_includes.concat (t.get_cheader_filenames ());
+                       } else {
+                               source_internal_includes.concat (t.get_cheader_filenames ());
+                       }
                        return;
                }
 
@@ -239,7 +244,7 @@ public class Vala.SourceFile {
        }
 
        /**
-        * Returns the list of externel includes the generated C header file
+        * Returns the list of external includes the generated C header file
         * requires.
         *
         * @return external include list for C header file
@@ -259,8 +264,8 @@ public class Vala.SourceFile {
        }
        
        /**
-        * Returns the list of package-internal includes the generated C header file
-        * requires.
+        * Returns the list of package-internal includes the generated C header
+        * file requires.
         *
         * @return internal include list for C header file
         */
@@ -269,12 +274,23 @@ public class Vala.SourceFile {
        }
        
        /**
-        * Returns the list of includes the generated C source file requires.
+        * Returns the list of external includes the generated C source file
+        * requires.
+        *
+        * @return include list for C source file
+        */
+       public List<string> get_source_external_includes () {
+               return source_external_includes;
+       }
+       
+       /**
+        * Returns the list of package-internal includes the generated C source
+        * file requires.
         *
         * @return include list for C source file
         */
-       public List<string> get_source_includes () {
-               return source_includes;
+       public List<string> get_source_internal_includes () {
+               return source_internal_includes;
        }
        
        /**
index 3cf68a5..2c38492 100644 (file)
@@ -38,10 +38,8 @@ namespace Gtk {
        }
        
        public class Dialog : Window {
-               [FloatingReference ()]
-               public static ref Widget new ();
-               [FloatingReference ()]
-               public static ref Widget new_with_buttons (string title, Window parent, DialogFlags @flags, string first_button_text, ...);
+               public construct ();
+               public construct with_buttons (string title, Window parent, DialogFlags _flags, string first_button_text, ...);
                public int run ();
                public void response (int response_id);
                public Widget add_button (string button_text, int response_id);
@@ -55,8 +53,7 @@ namespace Gtk {
        }
        
        public class MessageDialog : Dialog {
-               [FloatingReference ()]
-               public static ref Widget new (Window parent, DialogFlags @flags, MessageType type, ButtonsType buttons, string message_format, ...);
+               public construct (Window parent, DialogFlags _flags, MessageType type, ButtonsType buttons, string message_format, ...);
        }
 
        public enum MessageType {
@@ -92,7 +89,7 @@ namespace Gtk {
        }
        
        public class StatusIcon {
-               public static ref StatusIcon! new_from_stock (string! stock_id);
+               public construct from_stock (string! stock_id);
                
                public bool blinking { get; set; }
                public bool visible { get; set; }
@@ -103,10 +100,9 @@ namespace Gtk {
        }
        
        public class Button : Container {
-               [FloatingReference ()]
-               public static ref Button new_with_label (string label);
+               public construct with_label (string label);
                
-               public string label { get; construct; }
+               public string label { get; set construct; }
                
                public signal void activate ();
                public signal void clicked ();
@@ -114,8 +110,7 @@ namespace Gtk {
        }
        
        public class Entry : Widget {
-               [FloatingReference ()]
-               public static ref Entry new ();
+               public construct ();
        }
        
        public class TextBuffer {
@@ -147,8 +142,7 @@ namespace Gtk {
        }
        
        public class TreeViewColumn : Object {
-               [FloatingReference ()]
-               public static ref TreeViewColumn new_with_attributes (string title, CellRenderer cell, ...);
+               public construct with_attributes (string title, CellRenderer cell, ...);
                
                public int fixed_width { get; set; }
                public TreeViewColumnSizing sizing { get; set; }
@@ -170,24 +164,21 @@ namespace Gtk {
        }
        
        public class TreeStore : TreeModel {
-               public static ref TreeStore new (int n_columns, ...);
+               public construct (int n_columns, ...);
                public void @set (ref TreeIter iter, ...);
                public void append (ref TreeIter iter, ref TreeIter parent);
        }
        
        public class Menu : MenuShell {
-               [FloatingReference ()]
-               public static ref Menu new ();
+               public construct ();
        }
        
        public class MenuBar : MenuShell {
-               [FloatingReference ()]
-               public static ref MenuBar new ();
+               public construct ();
        }
        
        public class MenuItem : Item {
-               [FloatingReference ()]
-               public static ref MenuItem new_with_label (string label);
+               public construct with_label (string label);
                public void set_submenu (Menu submenu);
        }
        
@@ -196,18 +187,15 @@ namespace Gtk {
        }
        
        public class Toolbar : Container {
-               [FloatingReference ()]
-               public static ref Toolbar new ();
+               public construct ();
        }
        
        public class HBox : Box {
-               [FloatingReference ()]
-               public static ref HBox new (bool homogeneous, int spacing);
+               public construct (bool homogeneous, int spacing);
        }
        
        public class VBox : Box {
-               [FloatingReference ()]
-               public static ref VBox new (bool homogeneous, int spacing);
+               public construct (bool homogeneous, int spacing);
        }
        
        public class VPaned : Paned {