[valadoc] driver/0.12.x: Add support for attributes
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] driver/0.12.x: Add support for attributes
- Date: Fri, 12 Aug 2011 22:40:55 +0000 (UTC)
commit 8a96307a3e4851e914e5fd6cbe698534f81e664b
Author: Florian Brosch <flo brosch gmail com>
Date: Fri Aug 12 23:24:28 2011 +0200
driver/0.12.x: Add support for attributes
src/driver/0.12.x/treebuilder.vala | 63 ++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/src/driver/0.12.x/treebuilder.vala b/src/driver/0.12.x/treebuilder.vala
index d64c2c9..3099ceb 100644
--- a/src/driver/0.12.x/treebuilder.vala
+++ b/src/driver/0.12.x/treebuilder.vala
@@ -184,6 +184,55 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
// Translation helpers:
//
+ private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
+ // attributes wihtout arguments:
+ string[] attributes = {
+ "ReturnsModifiedPointer",
+ "DestroysInstance",
+ "NoAccessorMethod",
+ "NoArrayLength",
+ "Experimental",
+ "Diagnostics",
+ "PrintfFormat",
+ "PointerType",
+ "ScanfFormat",
+ "ThreadLocal",
+ "SimpleType",
+ "HasEmitter",
+ "ModuleInit",
+ "NoWrapper",
+ "Immutable",
+ "ErrorBase",
+ "NoReturn",
+ "NoThrow",
+ "Assert",
+ "Flags"
+ };
+
+ string? tmp = "";
+
+ foreach (Vala.Attribute att in lst) {
+ if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
+ Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
+ new_attribute.add_boolean ("has_target", false, att);
+ parent.add_attribute (new_attribute);
+ } else if (att.name == "Deprecated") {
+ Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
+ parent.add_attribute (new_attribute);
+ if ((tmp = att.args.get ("since")) != null) {
+ new_attribute.add_string ("since", tmp, att);
+ }
+
+ if ((tmp = att.args.get ("replacement")) != null) {
+ new_attribute.add_string ("replacement", tmp, att);
+ }
+ } else if (att.name in attributes) {
+ Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
+ parent.add_attribute (new_attribute);
+ }
+ }
+ }
+
private SourceComment? create_comment (Vala.Comment? comment) {
if (comment != null) {
Vala.SourceReference pos = comment.source_reference;
@@ -700,6 +749,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
+ process_attributes (node, element.attributes);
process_children (node, element);
// save GLib.Error
@@ -730,6 +780,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -753,6 +804,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
node.base_type = create_type_reference (basetype, node, node);
}
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -769,6 +821,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -796,6 +849,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
node.setter = new PropertyAccessor (node, file, element.name, get_access_modifier(element), accessor.get_cname(), get_property_accessor_type (accessor), get_property_ownership (accessor), accessor);
}
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -812,6 +866,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -828,6 +883,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -844,6 +900,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -860,6 +917,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -875,6 +933,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -890,6 +949,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -906,6 +966,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -921,6 +982,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
@@ -936,6 +998,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
symbol_map.set (element, node);
parent.add_child (node);
+ process_attributes (node, element.attributes);
process_children (node, element);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]