[vala/wip/attributes: 98/119] Drop returns_modified_pointer
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 98/119] Drop returns_modified_pointer
- Date: Mon, 4 Jul 2011 10:30:19 +0000 (UTC)
commit 2d03346f5a38892c33ce4f549054f898ad322a39
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Jul 2 14:08:20 2011 +0200
Drop returns_modified_pointer
codegen/valaccodebasemodule.vala | 4 ++++
codegen/valaccodemethodcallmodule.vala | 2 +-
vala/valaarraytype.vala | 2 +-
vala/valacodewriter.vala | 4 ----
vala/valamethod.vala | 11 +----------
5 files changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4e7feb5..f4a2a78 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5861,6 +5861,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return get_ccode_attribute(m).sentinel;
}
+ public static bool get_ccode_returns_modified_pointer (Method m) {
+ return m.get_attribute ("ReturnsModifiedPointer") != null;
+ }
+
public CCodeConstant get_signal_canonical_constant (Signal sig, string? detail = null) {
var str = new StringBuilder ("\"");
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index ed044f1..d9361ed 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -687,7 +687,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
ccall_expr = out_param_ref;
}
- if (m != null && m.binding == MemberBinding.INSTANCE && m.returns_modified_pointer) {
+ if (m != null && m.binding == MemberBinding.INSTANCE && get_ccode_returns_modified_pointer (m)) {
if (ma != null && ma.inner.symbol_reference is Property && ma.inner is MemberAccess) {
var prop = (Property) ma.inner.symbol_reference;
store_property (prop, ((MemberAccess) ma.inner).inner, new GLibValue (expr.value_type, ccall_expr));
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 6929aee..9c4dc86 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -109,7 +109,7 @@ public class Vala.ArrayType : ReferenceType {
resize_method.add_parameter (new Parameter ("length", int_type));
- resize_method.returns_modified_pointer = true;
+ resize_method.add_attribute ("ReturnsModifiedPointer", source_reference);
}
return resize_method;
}
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 4de4b92..819a5b7 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -796,10 +796,6 @@ public class Vala.CodeWriter : CodeVisitor {
write_indent ();
write_string ("[NoThrow]");
}
- if (m.returns_modified_pointer) {
- write_indent ();
- write_string ("[ReturnsModifiedPointer]");
- }
if (m.get_attribute ("DestroysInstance") != null) {
write_indent ();
write_string ("[DestroysInstance]");
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 953601f..0500d4c 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -82,13 +82,6 @@ public class Vala.Method : Subroutine {
}
/**
- * Specifies whether the C method returns a new instance pointer which
- * may be different from the previous instance pointer. Only valid for
- * imported methods.
- */
- public bool returns_modified_pointer { get; set; }
-
- /**
* Specifies the virtual or abstract method this method overrides.
* Reference must be weak as virtual and abstract methods set
* base_method to themselves.
@@ -260,9 +253,7 @@ public class Vala.Method : Subroutine {
*/
public void process_attributes () {
foreach (Attribute a in attributes) {
- if (a.name == "ReturnsModifiedPointer") {
- returns_modified_pointer = true;
- } else if (a.name == "PrintfFormat") {
+ if (a.name == "PrintfFormat") {
printf_format = true;
} else if (a.name == "ScanfFormat") {
scanf_format = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]