File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 681e5beac438c9c273b0bc434d4ccd17791c52a9
2
+ refs/heads/master: f053f06973afde6400528e409d6332ea2171fda2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
16
16
} ;
17
17
let fold = fold:: fold ( {
18
18
fold_item: fold_item,
19
- fold_mod: fold_mod
19
+ fold_mod: fold_mod,
20
+ fold_nmod: fold_nmod
20
21
with * fold:: default_any_fold ( ctxt)
21
22
} ) ;
22
23
fold. fold_crate ( fold, doc)
@@ -42,6 +43,13 @@ fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
42
43
}
43
44
}
44
45
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
+
45
53
#[ test]
46
54
fn should_record_mod_paths ( ) {
47
55
let source = "mod a { mod b { mod c { } } mod d { mod e { } } }" ;
@@ -61,4 +69,14 @@ fn should_record_fn_paths() {
61
69
let doc = run ( srv, doc) ;
62
70
assert doc. topmod . mods ( ) [ 0 ] . fns ( ) [ 0 ] . path ( ) == [ "a" ] ;
63
71
}
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
+ }
64
82
}
You can’t perform that action at this time.
0 commit comments