[vala/wip/attributes: 2/13] codegen: Add CCodeAttribute cache
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 2/13] codegen: Add CCodeAttribute cache
- Date: Sun, 26 Jun 2011 15:09:08 +0000 (UTC)
commit 36a4932b43c2881c279133000c344d3eb326ffc1
Author: Luca Bruno <lucabru src gnome org>
Date: Sun Jun 26 17:02:08 2011 +0200
codegen: Add CCodeAttribute cache
codegen/valaccodebasemodule.vala | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 9f4a13a..4fd0373 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -305,6 +305,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public Map<string,string> variable_name_map { get { return emit_context.variable_name_map; } }
+ public static int ccode_attribute_hash = CodeNode.get_attribute_hash ();
+
public CCodeBaseModule () {
predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
predefined_marshal_set.add ("VOID:VOID");
@@ -5551,6 +5553,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return get_cvalue (node);
}
+ public static CCodeAttribute get_ccode_attribute (CodeNode node) {
+ var attr = node.get_attribute_cache (ccode_attribute_hash);
+ if (attr == null) {
+ attr = new CCodeAttribute (node);
+ node.set_attribute_cache (ccode_attribute_hash, attr);
+ }
+ return (CCodeAttribute) attr;
+ }
+
public override void visit_class (Class cl) {
}
@@ -5878,3 +5889,11 @@ public class Vala.GLibValue : TargetValue {
return result;
}
}
+
+public class Vala.CCodeAttribute : AttributeCache {
+ public weak CodeNode node;
+
+ public CCodeAttribute (CodeNode node) {
+ this.node = node;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]