- let sub_paths = self.process_path_prefixes(path);
- let len = sub_paths.len();
- if len <= 1 {
- return;
- }
-
- for (span, _) in sub_paths.into_iter().take(len - 1) {
- let span = self.span_from_span(span);
- self.dumper.dump_ref(Ref {
- kind: RefKind::Mod,
- span,
- ref_id: ::null_id(),
- });
- }
- }
-
- // As write_sub_paths, but expects a path of the form module_path::trait::method
- // Where trait could actually be a struct too.
- fn write_sub_path_trait_truncated(&mut self, path: &ast::Path) {
- let sub_paths = self.process_path_prefixes(path);
- let len = sub_paths.len();
- if len <= 1 {
- return;
- }
- let sub_paths = &sub_paths[..(len - 1)];
-
- // write the trait part of the sub-path
- let (ref span, _) = sub_paths[len - 2];
- let span = self.span_from_span(*span);
- self.dumper.dump_ref(Ref {
- kind: RefKind::Type,
- ref_id: ::null_id(),
- span,
- });
-
- // write the other sub-paths
- if len <= 2 {
- return;
- }
- let sub_paths = &sub_paths[..len - 2];
- for &(ref span, _) in sub_paths {
- let span = self.span_from_span(*span);
- self.dumper.dump_ref(Ref {
- kind: RefKind::Mod,
- span,
- ref_id: ::null_id(),
- });
+ for seg in &path.segments[..path.segments.len() - 1] {
+ if let Some(data) = self.save_ctxt.get_path_segment_data(seg) {
+ self.dumper.dump_ref(data);
+ }