From ed40c85af5c6eec82746696d3ce2d0e7ae22c1d4 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 2 May 2011 20:29:39 -0400 Subject: Extract ast.is_exported from the resolve module --- src/comp/front/ast.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/comp/front') 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(_, _, _)) { -- cgit v1.2.3