diff options
author | Nick Cameron <ncameron@mozilla.com> | 2017-11-02 09:22:44 +1300 |
---|---|---|
committer | Nick Cameron <ncameron@mozilla.com> | 2017-11-02 09:22:44 +1300 |
commit | 82a8968ce09f1fd15291f2b3e51a89178a6d0674 (patch) | |
tree | 647f33218c86590ad9f2990850258a9b898972d2 | |
parent | c1d3e441a8c6d24bc61d3deb22a0909401767ada (diff) | |
download | rust-82a8968ce09f1fd15291f2b3e51a89178a6d0674.tar.gz |
save-analysis: handle types in turbofish
fixes https://github.com/nrc/rls-analysis/issues/52
-rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 11f62b4bd80..9a91feb8ebb 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -775,6 +775,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } fn process_path(&mut self, id: NodeId, path: &'l ast::Path) { + debug!("process_path {:?}", path); let path_data = self.save_ctxt.get_path_data(id, path); if generated_code(path.span) && path_data.is_none() { return; @@ -862,7 +863,10 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { walk_list!(self, visit_expr, base); } - fn process_method_call(&mut self, ex: &'l ast::Expr, args: &'l [P<ast::Expr>]) { + fn process_method_call(&mut self, + ex: &'l ast::Expr, + seg: &'l ast::PathSegment, + args: &'l [P<ast::Expr>]) { if let Some(mcd) = self.save_ctxt.get_expr_data(ex) { down_cast_data!(mcd, RefData, ex.span); if !generated_code(ex.span) { @@ -870,6 +874,15 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } } + // Explicit types in the turbo-fish. + if let Some(ref params) = seg.parameters { + if let ast::PathParameters::AngleBracketed(ref data) = **params { + for t in &data.types { + self.visit_ty(t); + } + } + } + // walk receiver and args walk_list!(self, visit_expr, args); } @@ -1330,7 +1343,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc let def = self.save_ctxt.get_path_def(hir_expr.id); self.process_struct_lit(ex, path, fields, adt.variant_of_def(def), base) } - ast::ExprKind::MethodCall(.., ref args) => self.process_method_call(ex, args), + ast::ExprKind::MethodCall(ref seg, ref args) => self.process_method_call(ex, seg, args), ast::ExprKind::Field(ref sub_ex, _) => { self.visit_expr(&sub_ex); |