1
Fork 0

use is_method_call rather than directly accessing the method_map

This commit is contained in:
Ariel Ben-Yehuda 2015-07-07 18:45:21 +03:00
parent 26f0cd5de7
commit 445824b29f
4 changed files with 13 additions and 17 deletions

View file

@ -332,7 +332,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}
ast::ExprIndex(ref l, ref r) |
ast::ExprBinary(_, ref l, ref r) if self.is_method_call(expr) => {
ast::ExprBinary(_, ref l, ref r) if self.tcx.is_method_call(expr.id) => {
self.call(expr, pred, &**l, Some(&**r).into_iter())
}
@ -342,7 +342,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.straightline(expr, pred, fields)
}
ast::ExprUnary(_, ref e) if self.is_method_call(expr) => {
ast::ExprUnary(_, ref e) if self.tcx.is_method_call(expr.id) => {
self.call(expr, pred, &**e, None::<ast::Expr>.iter())
}
@ -631,9 +631,4 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}
}
}
fn is_method_call(&self, expr: &ast::Expr) -> bool {
let method_call = ty::MethodCall::expr(expr.id);
self.tcx.tables.borrow().method_map.contains_key(&method_call)
}
}