From: Jürg Billeter Date: Wed, 2 Aug 2006 19:20:57 +0000 (+0000) Subject: update for 0.0.2 release check for floating reference in construction X-Git-Tag: VALA_0_0_2^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=958c4a4b615f1824be331d8601d82d49bdc93009;p=thirdparty%2Fvala.git update for 0.0.2 release check for floating reference in construction 2006-08-02 Jürg Billeter * 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 --- diff --git a/vala/ChangeLog b/vala/ChangeLog index d90c61224..93b518f76 100644 --- a/vala/ChangeLog +++ b/vala/ChangeLog @@ -1,3 +1,13 @@ +2006-08-02 Jürg Billeter + + * 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 * port to construction methods diff --git a/vala/NEWS b/vala/NEWS index 2233f1521..55ac10f20 100644 --- 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 ========== diff --git a/vala/ccode/valaccodeincludedirective.vala b/vala/ccode/valaccodeincludedirective.vala index 46306580b..228967455 100644 --- a/vala/ccode/valaccodeincludedirective.vala +++ b/vala/ccode/valaccodeincludedirective.vala @@ -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 (); } } diff --git a/vala/vala/valacodegenerator.vala b/vala/vala/valacodegenerator.vala index 5647610a6..c996f92bd 100644 --- a/vala/vala/valacodegenerator.vala +++ b/vala/vala/valacodegenerator.vala @@ -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 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 (); diff --git a/vala/vala/valasemanticanalyzer.vala b/vala/vala/valasemanticanalyzer.vala index dd35f7dbb..5a6f39dc6 100644 --- a/vala/vala/valasemanticanalyzer.vala +++ b/vala/vala/valasemanticanalyzer.vala @@ -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; } diff --git a/vala/vala/valasourcefile.vala b/vala/vala/valasourcefile.vala index 278d7913a..5d1e5ebc6 100644 --- a/vala/vala/valasourcefile.vala +++ b/vala/vala/valasourcefile.vala @@ -74,7 +74,8 @@ public class Vala.SourceFile { private List header_external_includes; private List header_internal_includes; - private List source_includes; + private List source_external_includes; + private List source_internal_includes; private List header_internal_full_dependencies; private List 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 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 get_source_includes () { - return source_includes; + public List get_source_internal_includes () { + return source_internal_includes; } /** diff --git a/vala/vapi/gtk+-2.0.vala b/vala/vapi/gtk+-2.0.vala index 3cf68a5b0..2c3849267 100644 --- a/vala/vapi/gtk+-2.0.vala +++ b/vala/vapi/gtk+-2.0.vala @@ -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 {