summaryrefslogtreecommitdiff
path: root/vala/valanamespace.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2009-09-26 00:38:08 +0200
committerJürg Billeter <j@bitron.ch>2009-09-26 13:51:16 +0200
commit8ca6708517e07c3d9a25c9352b0b26792ed49e6c (patch)
tree62fd3eafd1127f486d6ac41e0819aa75b5f1d4e5 /vala/valanamespace.vala
parent08f7f39bb67f6e03a983b3908460245690f4a13a (diff)
downloadvala-8ca6708517e07c3d9a25c9352b0b26792ed49e6c.tar.gz
Support using directives inside namespaces
Diffstat (limited to 'vala/valanamespace.vala')
-rw-r--r--vala/valanamespace.vala20
1 files changed, 19 insertions, 1 deletions
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index b7e16aa34..aebac8972 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -46,6 +46,8 @@ public class Vala.Namespace : Symbol {
private Gee.List<Namespace> namespaces = new ArrayList<Namespace> ();
+ private Gee.List<UsingDirective> using_directives = new ArrayList<UsingDirective> ();
+
/**
* Creates a new namespace.
*
@@ -57,7 +59,16 @@ public class Vala.Namespace : Symbol {
base (name, source_reference);
access = SymbolAccessibility.PUBLIC;
}
-
+
+ /**
+ * Adds a new using directive with the specified namespace.
+ *
+ * @param ns reference to namespace
+ */
+ public void add_using_directive (UsingDirective ns) {
+ using_directives.add (ns);
+ }
+
public void add_comment (Comment comment) {
comments.add (comment);
}
@@ -84,6 +95,9 @@ public class Vala.Namespace : Symbol {
old_ns.source_reference = ns.source_reference;
}
+ foreach (var using_directive in ns.using_directives) {
+ old_ns.add_using_directive (using_directive);
+ }
foreach (Namespace sub_ns in ns.get_namespaces ()) {
old_ns.add_namespace (sub_ns);
}
@@ -392,6 +406,10 @@ public class Vala.Namespace : Symbol {
}
public override void accept_children (CodeVisitor visitor) {
+ foreach (UsingDirective ns_ref in using_directives) {
+ ns_ref.accept (visitor);
+ }
+
foreach (Namespace ns in namespaces) {
ns.accept (visitor);
}