Skip to content

Commit b4cfb78

Browse files
committed
---
yaml --- r: 11465 b: refs/heads/master c: f053f06 h: refs/heads/master i: 11463: 52c8d02 v: v3
1 parent 89a2c41 commit b4cfb78

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 681e5beac438c9c273b0bc434d4ccd17791c52a9
2+
refs/heads/master: f053f06973afde6400528e409d6332ea2171fda2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustdoc/path_pass.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
1616
};
1717
let fold = fold::fold({
1818
fold_item: fold_item,
19-
fold_mod: fold_mod
19+
fold_mod: fold_mod,
20+
fold_nmod: fold_nmod
2021
with *fold::default_any_fold(ctxt)
2122
});
2223
fold.fold_crate(fold, doc)
@@ -42,6 +43,13 @@ fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
4243
}
4344
}
4445

46+
fn fold_nmod(fold: fold::fold<ctxt>, doc: doc::nmoddoc) -> doc::nmoddoc {
47+
vec::push(fold.ctxt.path, doc.name());
48+
let doc = fold::default_seq_fold_nmod(fold, doc);
49+
vec::pop(fold.ctxt.path);
50+
ret doc;
51+
}
52+
4553
#[test]
4654
fn should_record_mod_paths() {
4755
let source = "mod a { mod b { mod c { } } mod d { mod e { } } }";
@@ -61,4 +69,14 @@ fn should_record_fn_paths() {
6169
let doc = run(srv, doc);
6270
assert doc.topmod.mods()[0].fns()[0].path() == ["a"];
6371
}
72+
}
73+
74+
#[test]
75+
fn should_record_native_fn_paths() {
76+
let source = "native mod a { fn b(); }";
77+
astsrv::from_str(source) {|srv|
78+
let doc = extract::from_srv(srv, "");
79+
let doc = run(srv, doc);
80+
assert doc.topmod.nmods()[0].fns[0].path() == ["a"];
81+
}
6482
}

0 commit comments

Comments
 (0)