[vala] gobject-2.0: Add constructor to GLib.Object class
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] gobject-2.0: Add constructor to GLib.Object class
- Date: Mon, 31 Aug 2009 18:49:56 +0000 (UTC)
commit d6dfe51542d920e714be7d9f29a070d04a3ed79e
Author: Jürg Billeter <j bitron ch>
Date: Mon Aug 31 20:40:01 2009 +0200
gobject-2.0: Add constructor to GLib.Object class
compiler/valacompiler.vala | 1 +
vala/valaclass.vala | 2 +-
vala/valacodewriter.vala | 2 +-
vala/valacreationmethod.vala | 4 ++--
vala/valastruct.vala | 2 +-
vapi/gobject-2.0.vapi | 5 +++++
6 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 3ea847b..75a46f8 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -212,6 +212,7 @@ class Vala.Compiler {
// default profile
context.profile = Profile.GOBJECT;
context.add_define ("GOBJECT");
+ context.add_define ("VALA_0_7_6_NEW_METHODS");
} else {
Report.error (null, "Unknown profile %s".printf (profile));
}
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 68862a7..63b93e1 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -343,7 +343,7 @@ public class Vala.Class : ObjectTypeSymbol {
if (m is CreationMethod) {
if (m.name == null) {
default_construction_method = m;
- m.name = "new";
+ m.name = ".new";
}
var cm = (CreationMethod) m;
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 55dd513..7d082bf 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -890,7 +890,7 @@ public class Vala.CodeWriter : CodeVisitor {
if (m is CreationMethod) {
var datatype = (TypeSymbol) m.parent_symbol;
write_identifier (datatype.name);
- if (m.name != "new") {
+ if (m.name != ".new") {
write_string (".");
write_identifier (m.name);
}
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 6a57805..06f6610 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -93,7 +93,7 @@ public class Vala.CreationMethod : Method {
infix = "init";
}
- if (name == "new") {
+ if (name == ".new") {
return "%s%s".printf (parent.get_lower_case_cprefix (), infix);
} else {
return "%s%s_%s".printf (parent.get_lower_case_cprefix (), infix, name);
@@ -109,7 +109,7 @@ public class Vala.CreationMethod : Method {
string infix = "construct";
- if (name == "new") {
+ if (name == ".new") {
return "%s%s".printf (parent.get_lower_case_cprefix (), infix);
} else {
return "%s%s_%s".printf (parent.get_lower_case_cprefix (), infix, name);
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 33956d7..15c84a2 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -182,7 +182,7 @@ public class Vala.Struct : TypeSymbol {
if (m is CreationMethod) {
if (m.name == null) {
default_construction_method = m;
- m.name = "new";
+ m.name = ".new";
}
var cm = (CreationMethod) m;
diff --git a/vapi/gobject-2.0.vapi b/vapi/gobject-2.0.vapi
index 09b0e96..f1cd487 100644
--- a/vapi/gobject-2.0.vapi
+++ b/vapi/gobject-2.0.vapi
@@ -175,7 +175,12 @@ namespace GLib {
public class Object {
public uint ref_count;
+ [CCode (has_construct_function = false)]
+ public Object (Type type = typeof (Object), ...);
+
+#if VALA_0_7_6_NEW_METHODS
public static Object @new (Type type, ...);
+#endif
[CCode (cname = "G_TYPE_FROM_INSTANCE")]
public Type get_type ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]