aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-05-02 20:29:39 -0400
committerBrian Anderson <[email protected]>2011-05-02 22:07:36 -0400
commited40c85af5c6eec82746696d3ce2d0e7ae22c1d4 (patch)
tree787c5ee833fe2604c7914a60e6b5b2f43abf382b /src/comp/front
parentAdd some tests of tag-export interaction (diff)
downloadrust-ed40c85af5c6eec82746696d3ce2d0e7ae22c1d4.tar.xz
rust-ed40c85af5c6eec82746696d3ce2d0e7ae22c1d4.zip
Extract ast.is_exported from the resolve module
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/ast.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 13b5739e..82b6d813 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -1,6 +1,7 @@
import std.map.hashmap;
import std.option;
+import std._str;
import std._vec;
import util.common.span;
import util.common.spanned;
@@ -529,6 +530,27 @@ fn index_stmt(block_index index, @stmt s) {
}
}
+fn is_exported(ident i, _mod m) -> bool {
+ auto count = 0;
+ for (@ast.view_item vi in m.view_items) {
+ alt (vi.node) {
+ case (ast.view_item_export(?id)) {
+ if (_str.eq(i, id)) {
+ ret true;
+ }
+ count += 1;
+ }
+ case (_) { /* fall through */ }
+ }
+ }
+ // If there are no declared exports then everything is exported
+ if (count == 0) {
+ ret true;
+ } else {
+ ret false;
+ }
+}
+
fn is_call_expr(@expr e) -> bool {
alt (e.node) {
case (expr_call(_, _, _)) {