Skip to content

Commit 6aba671

Browse files
committed
---
yaml --- r: 3727 b: refs/heads/master c: 51e60b6 h: refs/heads/master i: 3725: 109dbb3 3723: 0b49a22 3719: d923278 3711: 326c19d v: v3
1 parent cc88d01 commit 6aba671

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 639cf1a8ff1c61e1169c43e5a506efc01725397b
2+
refs/heads/master: 51e60b65658c02eb3ca7fdcb3ffb40f0141bd76f

trunk/src/comp/metadata/creader.rs

+29-28
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,35 @@ import common::*;
2828
export read_crates;
2929
export list_file_metadata;
3030

31+
// Traverses an AST, reading all the information about use'd crates and native
32+
// libraries necessary for later resolving, typechecking, linking, etc.
33+
fn read_crates(session::session sess, resolve::crate_map crate_map,
34+
&ast::crate crate) {
35+
auto e =
36+
@rec(sess=sess,
37+
crate_map=crate_map,
38+
crate_cache=@std::map::new_str_hash[int](),
39+
library_search_paths=sess.get_opts().library_search_paths,
40+
mutable next_crate_num=1);
41+
auto v =
42+
rec(visit_view_item_pre=bind visit_view_item(e, _),
43+
visit_item_pre=bind visit_item(e, _)
44+
with walk::default_visitor());
45+
walk::walk_crate(v, crate);
46+
}
47+
48+
// A diagnostic function for dumping crate metadata to an output stream
49+
fn list_file_metadata(str path, io::writer out) {
50+
alt (get_metadata_section(path)) {
51+
case (option::some(?bytes)) {
52+
decoder::list_crate_metadata(bytes, out);
53+
}
54+
case (option::none) {
55+
out.write_str("Could not find metadata in " + path + ".\n");
56+
}
57+
}
58+
}
59+
3160
fn metadata_matches(&vec[u8] crate_data,
3261
&(@ast::meta_item)[] metas) -> bool {
3362
auto attrs = decoder::get_crate_attributes(crate_data);
@@ -199,34 +228,6 @@ fn visit_item(env e, &@ast::item i) {
199228
}
200229
}
201230

202-
// Reads external crates referenced by "use" directives.
203-
fn read_crates(session::session sess, resolve::crate_map crate_map,
204-
&ast::crate crate) {
205-
auto e =
206-
@rec(sess=sess,
207-
crate_map=crate_map,
208-
crate_cache=@std::map::new_str_hash[int](),
209-
library_search_paths=sess.get_opts().library_search_paths,
210-
mutable next_crate_num=1);
211-
auto v =
212-
rec(visit_view_item_pre=bind visit_view_item(e, _),
213-
visit_item_pre=bind visit_item(e, _)
214-
with walk::default_visitor());
215-
walk::walk_crate(v, crate);
216-
}
217-
218-
219-
fn list_file_metadata(str path, io::writer out) {
220-
alt (get_metadata_section(path)) {
221-
case (option::some(?bytes)) {
222-
decoder::list_crate_metadata(bytes, out);
223-
}
224-
case (option::none) {
225-
out.write_str("Could not find metadata in " + path + ".\n");
226-
}
227-
}
228-
}
229-
230231

231232
// Local Variables:
232233
// mode: rust

0 commit comments

Comments
 (0)