[vala] girparser: Set NoAccessorMethod properly for abstract properties
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Set NoAccessorMethod properly for abstract properties
- Date: Thu, 1 Sep 2011 09:43:53 +0000 (UTC)
commit 3eeb232514875360fa3214c050106a14bb862688
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Sep 1 10:36:55 2011 +0200
girparser: Set NoAccessorMethod properly for abstract properties
vala/valagirparser.vala | 31 +++++++++++++++++++++++--------
vapi/clutter-1.0.vapi | 9 +++++++++
vapi/mx-1.0.vapi | 5 ++++-
3 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index fc269d9..773c9a1 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -814,19 +814,33 @@ public class Vala.GirParser : CodeVisitor {
prop.set_accessor = new PropertyAccessor (false, (construct_only != "1") && (writable == "1"), (construct_only == "1") || (construct_ == "1"), prop.property_type.copy (), null, null);
}
- var getter = parent.lookup ("get_%s".printf (name));
- if (getter != null && getter.get_cname () != parent.get_lower_case_cprefix() + "get_" + name) {
- getter = null;
+ // find virtual/abstract accessors to handle abstract properties properly
+
+ Node getter = null;
+ var getters = parent.lookup_all ("get_%s".printf (name));
+ if (getters != null) {
+ foreach (var g in getters) {
+ if ((getter == null || !g.merged) && g.get_cname () == parent.get_lower_case_cprefix() + "get_" + name) {
+ getter = g;
+ }
+ }
}
- var setter = parent.lookup ("set_%s".printf (name));
- if (setter != null && setter.get_cname () != parent.get_lower_case_cprefix() + "set_" + name) {
- setter = null;
+
+ Node setter = null;
+ var setters = parent.lookup_all ("set_%s".printf (name));
+ if (setters != null) {
+ foreach (var s in setters) {
+ if ((setter == null || !s.merged) && s.get_cname () == parent.get_lower_case_cprefix() + "set_" + name) {
+ setter = s;
+ }
+ }
}
prop.set_attribute ("NoAccessorMethod", false);
if (prop.get_accessor != null) {
var m = getter != null ? getter.symbol as Method : null;
- if (m != null) {
+ // ensure getter vfunc if the property is abstract
+ if (m != null && (m.is_abstract || m.is_virtual || !prop.is_abstract)) {
getter.process (parser);
if (m.return_type is VoidType || m.get_parameters().size != 0) {
prop.set_attribute ("NoAccessorMethod", true);
@@ -846,7 +860,8 @@ public class Vala.GirParser : CodeVisitor {
}
if (prop.get_attribute ("NoAccessorMethod") == null && prop.set_accessor != null && prop.set_accessor.writable) {
var m = setter != null ? setter.symbol as Method : null;
- if (m != null) {
+ // ensure setter vfunc if the property is abstract
+ if (m != null && (m.is_abstract || m.is_virtual || !prop.is_abstract)) {
setter.process (parser);
if (!(m.return_type is VoidType) || m.get_parameters().size != 1) {
prop.set_attribute ("NoAccessorMethod", true);
diff --git a/vapi/clutter-1.0.vapi b/vapi/clutter-1.0.vapi
index 333f945..0ca8f1a 100644
--- a/vapi/clutter-1.0.vapi
+++ b/vapi/clutter-1.0.vapi
@@ -1879,14 +1879,23 @@ namespace Clutter {
public void set_subtitle_font_name (string font_name);
public void set_subtitle_uri (string uri);
public void set_uri (string uri);
+ [NoAccessorMethod]
public abstract double audio_volume { get; set; }
+ [NoAccessorMethod]
public abstract double buffer_fill { get; }
+ [NoAccessorMethod]
public abstract bool can_seek { get; }
+ [NoAccessorMethod]
public abstract double duration { get; }
+ [NoAccessorMethod]
public abstract bool playing { get; set; }
+ [NoAccessorMethod]
public abstract double progress { get; set; }
+ [NoAccessorMethod]
public abstract string subtitle_font_name { owned get; set; }
+ [NoAccessorMethod]
public abstract string subtitle_uri { owned get; set; }
+ [NoAccessorMethod]
public abstract string uri { owned get; set; }
public virtual signal void eos ();
public virtual signal void error (GLib.Error error);
diff --git a/vapi/mx-1.0.vapi b/vapi/mx-1.0.vapi
index a1e45dd..72989de 100644
--- a/vapi/mx-1.0.vapi
+++ b/vapi/mx-1.0.vapi
@@ -1038,10 +1038,13 @@ namespace Mx {
public void set_axis (Mx.DragAxis axis);
public void set_drag_actor (Clutter.Actor actor);
public void set_drag_threshold (uint threshold);
+ [NoAccessorMethod]
public abstract Mx.DragAxis axis { get; set; }
- public abstract Clutter.Actor drag_actor { get; set; }
+ [NoAccessorMethod]
+ public abstract Clutter.Actor drag_actor { owned get; set; }
[NoAccessorMethod]
public abstract bool drag_enabled { get; set; }
+ [NoAccessorMethod]
public abstract uint drag_threshold { get; set; }
public virtual signal void drag_begin (float event_x, float event_y, int event_button, Clutter.ModifierType modifiers);
public virtual signal void drag_end (float event_x, float event_y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]