[vala/wip/attributes: 93/119] Drop delegate_target
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 93/119] Drop delegate_target
- Date: Mon, 4 Jul 2011 10:29:54 +0000 (UTC)
commit f18add8ff32d90bea26e53cd666f41f000c51cd1
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Jul 2 10:40:44 2011 +0200
Drop delegate_target
codegen/valaccodeassignmentmodule.vala | 2 +-
codegen/valaccodebasemodule.vala | 8 ++++++++
codegen/valaccodememberaccessmodule.vala | 6 +++---
vala/valaparameter.vala | 1 -
vala/valavariable.vala | 17 -----------------
vapigen/valagidlparser.vala | 2 +-
6 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index d4b7628..96a9b79 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -42,7 +42,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
} else if (assignment.left.value_type is DelegateType) {
var delegate_type = (DelegateType) assignment.left.value_type;
if (delegate_type.delegate_symbol.has_target) {
- instance_delegate = !(variable is Field) || !variable.no_delegate_target;
+ instance_delegate = !(variable is Field) || !get_ccode_no_delegate_target (variable);
}
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 35e020a..f98921c 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5792,6 +5792,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
}
+ public static bool get_ccode_no_delegate_target (CodeNode node) {
+ return get_ccode_attribute(node).no_delegate_target;
+ }
+
public static double get_ccode_pos (Parameter param) {
return get_ccode_attribute(param).pos;
}
@@ -6483,6 +6487,7 @@ public class Vala.CCodeAttribute : AttributeCache {
public bool array_null_terminated { get; private set; }
public string? array_length_name { get; private set; }
public string? array_length_expr { get; private set; }
+ public bool no_delegate_target { get; private set; }
private string _name;
private string _const_name;
@@ -6565,6 +6570,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is CreationMethod) {
_real_name = attr.get_string ("construct_function");
}
+ if (attr.has_argument ("delegate_target")) {
+ no_delegate_target = !attr.get_bool ("delegate_target");
+ }
}
if (node.get_attribute ("NoArrayLength") != null) {
Report.deprecated (node.source_reference, "NoArrayLength attribute is deprecated, use [CCode (array_length = false)] instead.");
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 35bd4e4..c8b3190 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -581,7 +581,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
set_array_size_cvalue (result, new CCodeMemberAccess (inst, size_cname));
}
}
- } else if (delegate_type != null && delegate_type.delegate_symbol.has_target && !field.no_delegate_target) {
+ } else if (delegate_type != null && delegate_type.delegate_symbol.has_target && !get_ccode_no_delegate_target (field)) {
string target_cname = get_delegate_target_cname (get_ccode_name (field));
string target_destroy_notify_cname = get_delegate_target_destroy_notify_cname (get_ccode_name (field));
@@ -647,7 +647,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
if (array_type.rank == 1 && field.is_internal_symbol ()) {
set_array_size_cvalue (result, new CCodeIdentifier (get_array_size_cname (get_ccode_name (field))));
}
- } else if (delegate_type != null && delegate_type.delegate_symbol.has_target && !field.no_delegate_target) {
+ } else if (delegate_type != null && delegate_type.delegate_symbol.has_target && !get_ccode_no_delegate_target (field)) {
result.delegate_target_cvalue = new CCodeIdentifier (get_delegate_target_cname (get_ccode_name (field)));
if (result.value_type.value_owned) {
result.delegate_target_destroy_notify_cvalue = new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_ccode_name (field)));
@@ -690,7 +690,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
}
} else if (delegate_type != null) {
- if (!delegate_type.delegate_symbol.has_target || variable.no_delegate_target) {
+ if (!delegate_type.delegate_symbol.has_target || get_ccode_no_delegate_target (variable)) {
result.delegate_target_cvalue = new CCodeConstant ("NULL");
}
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 4f42ca2..7ad3891 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -102,7 +102,6 @@ public class Vala.Parameter : Variable {
result.direction = this.direction;
result.initializer = this.initializer;
result.attributes = this.attributes.copy ();
- result.no_delegate_target = this.no_delegate_target;
result.attributes = attributes.copy ();
return result;
} else {
diff --git a/vala/valavariable.vala b/vala/valavariable.vala
index 43c525a..cb8b6b4 100644
--- a/vala/valavariable.vala
+++ b/vala/valavariable.vala
@@ -49,12 +49,6 @@ public class Vala.Variable : Symbol {
}
}
- /**
- * Specifies whether a delegate target field should implicitly be created
- * if the field type is a delegate.
- */
- public bool no_delegate_target { get; set; }
-
Expression? _initializer;
DataType? _variable_type;
@@ -64,20 +58,9 @@ public class Vala.Variable : Symbol {
this.initializer = initializer;
}
- void process_ccode_attribute (Attribute a) {
- if (a.has_argument ("delegate_target")) {
- no_delegate_target = !a.get_bool ("delegate_target");
- }
- }
-
/**
* Process all associated attributes.
*/
public virtual void process_attributes () {
- foreach (Attribute a in attributes) {
- if (a.name == "CCode") {
- process_ccode_attribute (a);
- }
- }
}
}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 14245c8..c93a38a 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -2802,7 +2802,7 @@ public class Vala.GIdlParser : CodeVisitor {
}
if (no_delegate_target) {
- field.no_delegate_target = true;
+ field.set_attribute_bool ("CCode", "delegate_target", false);
}
return field;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]