Skip to content

Commit ac02b43

Browse files
committed
---
yaml --- r: 2318 b: refs/heads/master c: ed40c85 h: refs/heads/master v: v3
1 parent ffa95d7 commit ac02b43

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3014a5887d4785285a3f42e19f2de24e141e3eb8
2+
refs/heads/master: ed40c85af5c6eec82746696d3ce2d0e7ae22c1d4

trunk/src/comp/front/ast.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
import std.map.hashmap;
33
import std.option;
4+
import std._str;
45
import std._vec;
56
import util.common.span;
67
import util.common.spanned;
@@ -529,6 +530,27 @@ fn index_stmt(block_index index, @stmt s) {
529530
}
530531
}
531532
533+
fn is_exported(ident i, _mod m) -> bool {
534+
auto count = 0;
535+
for (@ast.view_item vi in m.view_items) {
536+
alt (vi.node) {
537+
case (ast.view_item_export(?id)) {
538+
if (_str.eq(i, id)) {
539+
ret true;
540+
}
541+
count += 1;
542+
}
543+
case (_) { /* fall through */ }
544+
}
545+
}
546+
// If there are no declared exports then everything is exported
547+
if (count == 0) {
548+
ret true;
549+
} else {
550+
ret false;
551+
}
552+
}
553+
532554
fn is_call_expr(@expr e) -> bool {
533555
alt (e.node) {
534556
case (expr_call(_, _, _)) {

trunk/src/comp/middle/resolve.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -370,24 +370,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
370370
}
371371
}
372372

373-
auto count = 0;
374-
for (@ast.view_item vi in m.view_items) {
375-
alt (vi.node) {
376-
case (ast.view_item_export(?id)) {
377-
if (_str.eq(i, id)) {
378-
ret true;
379-
}
380-
count += 1;
381-
}
382-
case (_) { /* fall through */ }
383-
}
384-
}
385-
// If there are no declared exports then everything is exported
386-
if (count == 0) {
387-
ret true;
388-
} else {
389-
ret false;
390-
}
373+
ret ast.is_exported(i, m);
391374
}
392375

393376
alt (m.index.find(i)) {

0 commit comments

Comments
 (0)