[vala/wip/attributes: 52/121] Drop Property.no_accessor_method which is C-specific
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 52/121] Drop Property.no_accessor_method which is C-specific
- Date: Mon, 4 Jul 2011 17:13:08 +0000 (UTC)
commit b9377667971828dc9ec50b581cd07a7eefe96d38
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Jun 29 15:24:43 2011 +0200
Drop Property.no_accessor_method which is C-specific
codegen/valaccodebasemodule.vala | 10 +++++++---
codegen/valaccodememberaccessmodule.vala | 2 +-
vala/valacodewriter.vala | 2 +-
vala/valagirparser.vala | 16 ++++++++--------
vala/valaproperty.vala | 8 --------
vapigen/valagidlparser.vala | 8 ++++----
6 files changed, 21 insertions(+), 25 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 2072327..36a0c5f 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5309,7 +5309,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var set_func = "g_object_set";
var base_property = prop;
- if (!prop.no_accessor_method) {
+ if (!get_ccode_no_accessor_method (prop)) {
if (prop.base_property != null) {
base_property = prop.base_property;
} else if (prop.base_interface_property != null) {
@@ -5361,7 +5361,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccall.add_argument (cinstance);
}
- if (prop.no_accessor_method) {
+ if (get_ccode_no_accessor_method (prop)) {
/* property name is second argument of g_object_set */
ccall.add_argument (prop.get_canonical_cconstant ());
}
@@ -5397,7 +5397,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
}
- if (prop.no_accessor_method) {
+ if (get_ccode_no_accessor_method (prop)) {
ccall.add_argument (new CCodeConstant ("NULL"));
}
@@ -5783,6 +5783,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return get_ccode_attribute(m).finish_name;
}
+ public static bool get_ccode_no_accessor_method (Property p) {
+ return p.get_attribute ("NoAccessorMethod") != null;
+ }
+
public override void visit_class (Class cl) {
}
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 6e787e0..af9cd8d 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -207,7 +207,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
CCodeExpression inst;
inst = new CCodeMemberAccess.pointer (pub_inst, "priv");
set_cvalue (expr, new CCodeMemberAccess.pointer (inst, get_ccode_name (prop.field)));
- } else if (!prop.no_accessor_method) {
+ } else if (!get_ccode_no_accessor_method (prop)) {
var base_property = prop;
if (prop.base_property != null) {
base_property = prop.base_property;
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index ff02a7e..370a62b 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1259,7 +1259,7 @@ public class Vala.CodeWriter : CodeVisitor {
emit_deprecated_attribute (prop);
emit_experimental_attribute (prop);
- if (prop.no_accessor_method) {
+ if (prop.get_attribute ("NoAccessorMethod")) {
write_indent ();
write_string ("[NoAccessorMethod]");
}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 82186ea..2a6a0e5 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -732,15 +732,15 @@ public class Vala.GirParser : CodeVisitor {
setter = null;
}
var prop = (Property) symbol;
- if (prop.no_accessor_method) {
+ if (prop.add_attribute ("NoAccessorMethod")) {
// property getter and setter must both match, otherwise it's NoAccessorMethod
- prop.no_accessor_method = false;
+ prop.remove_attribute ("NoAccessorMethod");
if (prop.get_accessor != null) {
var m = getter != null ? getter.symbol as Method : null;
if (m != null) {
getter.process (parser);
if (m.return_type is VoidType || m.get_parameters().size != 0) {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
} else {
if (getter.name == name) {
foreach (var node in colliding) {
@@ -752,18 +752,18 @@ public class Vala.GirParser : CodeVisitor {
prop.get_accessor.value_type.value_owned = m.return_type.value_owned;
}
} else {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
}
- if (!prop.no_accessor_method && prop.set_accessor != null && prop.set_accessor.writable) {
+ 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) {
setter.process (parser);
if (!(m.return_type is VoidType) || m.get_parameters().size != 1) {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
} else {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
}
}
@@ -2360,7 +2360,7 @@ public class Vala.GirParser : CodeVisitor {
var prop = new Property (current.name, type, null, null, current.source_reference);
prop.access = SymbolAccessibility.PUBLIC;
prop.external = true;
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
prop.no_array_length = no_array_length;
prop.array_null_terminated = array_null_terminated;
if (readable != "0") {
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 467cdf8..80315d1 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -78,12 +78,6 @@ public class Vala.Property : Symbol, Lockable {
public bool notify { get; set; default = true; }
/**
- * Specifies whether the implementation of this property does not
- * provide getter/setter methods.
- */
- public bool no_accessor_method { get; set; }
-
- /**
* Specifies whether automatic accessor code generation should be
* disabled.
*/
@@ -283,8 +277,6 @@ public class Vala.Property : Symbol, Lockable {
foreach (Attribute a in attributes) {
if (a.name == "CCode") {
process_ccode_attribute (a);
- } else if (a.name == "NoAccessorMethod") {
- no_accessor_method = true;
} else if (a.name == "Description") {
if (a.has_argument ("nick")) {
nick = a.get_string ("nick");
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index e25bb3e..cc433ef 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -1556,17 +1556,17 @@ public class Vala.GIdlParser : CodeVisitor {
var getter = "get_%s".printf (prop.name);
if (prop.get_accessor != null && !current_type_symbol_set.contains (getter)) {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
var setter = "set_%s".printf (prop.name);
if (prop.set_accessor != null && prop.set_accessor.writable
&& !current_type_symbol_set.contains (setter)) {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
- if (prop.no_accessor_method && prop.get_accessor != null) {
+ if (prop.get_attribute ("NoAccessorMethod") != null && prop.get_accessor != null) {
prop.get_accessor.value_type.value_owned = true;
}
}
@@ -2596,7 +2596,7 @@ public class Vala.GIdlParser : CodeVisitor {
prop.deprecated_since = eval (nv[1]);
} else if (nv[0] == "accessor_method") {
if (eval (nv[1]) == "0") {
- prop.no_accessor_method = true;
+ prop.add_attribute ("NoAccessorMethod");
}
} else if (nv[0] == "owned_get") {
if (eval (nv[1]) == "1") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]