[vala] girparser: Map vala symbols to gir symbols when GIR attribute is available
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Map vala symbols to gir symbols when GIR attribute is available
- Date: Thu, 4 Aug 2011 07:54:13 +0000 (UTC)
commit 57de67d35a6af01e145eba55fd9191fef1d5e991
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Aug 4 01:22:35 2011 +0200
girparser: Map vala symbols to gir symbols when GIR attribute is available
vala/valagirparser.vala | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index c8a7446..38f091b 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1051,18 +1051,32 @@ public class Vala.GirParser : CodeVisitor {
void map_vala_to_gir () {
foreach (var source_file in context.get_source_files ()) {
- foreach (var node in source_file.get_nodes ()) {
- if (node is Namespace) {
- var ns = (Namespace) node;
- var gir_namespace = source_file.gir_namespace;
- if (gir_namespace == null) {
+ string gir_namespace = source_file.gir_namespace;
+ Namespace ns = null;
+ if (gir_namespace == null) {
+ foreach (var node in source_file.get_nodes ()) {
+ if (node is Namespace) {
+ ns = (Namespace) node;
gir_namespace = ns.get_attribute_string ("CCode", "gir_namespace");
+ if (gir_namespace != null) {
+ break;
+ }
}
- if (gir_namespace != null && gir_namespace != ns.name) {
- var map_from = new UnresolvedSymbol (null, gir_namespace);
- set_symbol_mapping (map_from, ns);
- break;
- }
+ }
+ }
+ if (gir_namespace == null) {
+ continue;
+ }
+
+ var gir_symbol = new UnresolvedSymbol (null, gir_namespace);
+ if (gir_namespace != ns.name) {
+ set_symbol_mapping (gir_symbol, ns);
+ }
+
+ foreach (var node in source_file.get_nodes ()) {
+ if (node.has_attribute_argument ("GIR", "name")) {
+ var map_from = new UnresolvedSymbol (gir_symbol, node.get_attribute_string ("GIR", "name"));
+ set_symbol_mapping (map_from, (Symbol) node);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]