@@ -44,12 +44,8 @@ impl<'a> Parser<'a> {
44
44
let id = self . parse_ident ( ) ?;
45
45
let ( module, mut inner_attrs) = if self . eat ( & token:: Semi ) {
46
46
if in_cfg && self . recurse_into_file_modules {
47
- // This mod is in an external file. Let's go get it!
48
47
let dir = & self . directory ;
49
- submod_path ( self . sess , id, & attrs, dir. ownership , & dir. path )
50
- . and_then ( |r| eval_src_mod ( self . sess , self . cfg_mods , r. path , r. ownership , id) )
51
- . map_err ( |mut err| err. emit ( ) )
52
- . unwrap_or_default ( )
48
+ parse_external_module ( self . sess , self . cfg_mods , id, dir. ownership , & dir. path , attrs)
53
49
} else {
54
50
Default :: default ( )
55
51
}
@@ -99,6 +95,20 @@ impl<'a> Parser<'a> {
99
95
}
100
96
}
101
97
98
+ fn parse_external_module (
99
+ sess : & ParseSess ,
100
+ cfg_mods : bool ,
101
+ id : ast:: Ident ,
102
+ ownership : DirectoryOwnership ,
103
+ dir_path : & Path ,
104
+ attrs : & [ Attribute ] ,
105
+ ) -> ( Mod , Vec < Attribute > ) {
106
+ submod_path ( sess, id, & attrs, ownership, dir_path)
107
+ . and_then ( |r| eval_src_mod ( sess, cfg_mods, r. path , r. ownership , id) )
108
+ . map_err ( |mut err| err. emit ( ) )
109
+ . unwrap_or_default ( )
110
+ }
111
+
102
112
/// Reads a module from a source file.
103
113
fn eval_src_mod < ' a > (
104
114
sess : & ' a ParseSess ,
0 commit comments