+ fn mod_data(&mut self, data: ModData) {
+ let id: Id = From::from(data.id);
+ let mut def = Def {
+ kind: DefKind::Mod,
+ id: id,
+ span: data.span,
+ name: data.name,
+ qualname: data.qualname,
+ value: data.filename,
+ children: data.items.into_iter().map(|id| From::from(id)).collect(),
+ decl_id: None,
+ docs: data.docs,
+ };
+ if def.span.file_name != def.value {
+ // If the module is an out-of-line defintion, then we'll make the
+ // defintion the first character in the module's file and turn the
+ // the declaration into a reference to it.
+ let rf = Ref {
+ kind: RefKind::Mod,
+ span: def.span,
+ ref_id: id,
+ };
+ self.result.refs.push(rf);
+ def.span = SpanData {
+ file_name: def.value.clone(),
+ byte_start: 0,
+ byte_end: 0,
+ line_start: 1,
+ line_end: 1,
+ column_start: 1,
+ column_end: 1,
+ }
+ }
+
+ self.result.defs.push(def);
+ }
+