[vala] Replace static modifier for delegates by attribute
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Replace static modifier for delegates by attribute
- Date: Tue, 14 Apr 2009 12:36:30 -0400 (EDT)
commit 1505848107f297e58e3c650777c4475f90a149b9
Author: Jürg Billeter <j bitron ch>
Date: Tue Apr 14 18:33:44 2009 +0200
Replace static modifier for delegates by attribute
Replace `static' modifier for delegates without a user_data parameter
by [CCode (has_target = false)] as we only support this for bindings,
it is not considered a language feature. Fixes bug 526549.
---
vala/valacodewriter.vala | 11 +++++++----
vala/valadelegate.vala | 3 +++
vala/valaparser.vala | 7 ++++++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 03def58..047e1ed 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -760,14 +760,17 @@ public class Vala.CodeWriter : CodeVisitor {
write_indent ();
- write_string ("[CCode (cheader_filename = \"%s\")]".printf (get_cheaders(cb)));
+ write_string ("[CCode (cheader_filename = \"%s\"".printf (get_cheaders(cb)));
+
+ if (!cb.has_target) {
+ write_string (", has_target = false");
+ }
+
+ write_string (")]");
write_indent ();
write_accessibility (cb);
- if (!cb.has_target) {
- write_string ("static ");
- }
write_string ("delegate ");
write_return_type (cb.return_type);
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 173fe04..c283b6d 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -233,6 +233,9 @@ public class Vala.Delegate : TypeSymbol {
if (a.has_argument ("cname")) {
set_cname (a.get_string ("cname"));
}
+ if (a.has_argument ("has_target")) {
+ has_target = a.get_bool ("has_target");
+ }
if (a.has_argument ("instance_pos")) {
cinstance_parameter_position = a.get_double ("instance_pos");
}
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index ab11ad1..ba28b62 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2833,7 +2833,12 @@ public class Vala.Parser : CodeVisitor {
var d = new Delegate (sym.name, type, get_src_com (begin));
d.access = access;
set_attributes (d, attrs);
- if (!(ModifierFlags.STATIC in flags)) {
+ if (ModifierFlags.STATIC in flags) {
+ if (!context.deprecated) {
+ // TODO enable warning in future releases
+ // Report.warning (get_last_src (), "deprecated syntax, use [CCode (has_target = false)]");
+ }
+ } else {
d.has_target = true;
}
if (ModifierFlags.EXTERN in flags || scanner.source_file.external_package) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]