Skip to content

Commit 82a8968

Browse files
committed
save-analysis: handle types in turbofish
fixes rust-dev-tools/rls-analysis#52
1 parent c1d3e44 commit 82a8968

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/librustc_save_analysis/dump_visitor.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
775775
}
776776

777777
fn process_path(&mut self, id: NodeId, path: &'l ast::Path) {
778+
debug!("process_path {:?}", path);
778779
let path_data = self.save_ctxt.get_path_data(id, path);
779780
if generated_code(path.span) && path_data.is_none() {
780781
return;
@@ -862,14 +863,26 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
862863
walk_list!(self, visit_expr, base);
863864
}
864865

865-
fn process_method_call(&mut self, ex: &'l ast::Expr, args: &'l [P<ast::Expr>]) {
866+
fn process_method_call(&mut self,
867+
ex: &'l ast::Expr,
868+
seg: &'l ast::PathSegment,
869+
args: &'l [P<ast::Expr>]) {
866870
if let Some(mcd) = self.save_ctxt.get_expr_data(ex) {
867871
down_cast_data!(mcd, RefData, ex.span);
868872
if !generated_code(ex.span) {
869873
self.dumper.dump_ref(mcd);
870874
}
871875
}
872876

877+
// Explicit types in the turbo-fish.
878+
if let Some(ref params) = seg.parameters {
879+
if let ast::PathParameters::AngleBracketed(ref data) = **params {
880+
for t in &data.types {
881+
self.visit_ty(t);
882+
}
883+
}
884+
}
885+
873886
// walk receiver and args
874887
walk_list!(self, visit_expr, args);
875888
}
@@ -1330,7 +1343,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
13301343
let def = self.save_ctxt.get_path_def(hir_expr.id);
13311344
self.process_struct_lit(ex, path, fields, adt.variant_of_def(def), base)
13321345
}
1333-
ast::ExprKind::MethodCall(.., ref args) => self.process_method_call(ex, args),
1346+
ast::ExprKind::MethodCall(ref seg, ref args) => self.process_method_call(ex, seg, args),
13341347
ast::ExprKind::Field(ref sub_ex, _) => {
13351348
self.visit_expr(&sub_ex);
13361349

0 commit comments

Comments
 (0)