Skip to content

Commit 773a640

Browse files
committed
support autoderef on method calls
1 parent 514e8de commit 773a640

File tree

5 files changed

+241
-170
lines changed

5 files changed

+241
-170
lines changed

src/rustc/middle/typeck/check.rs

+7-28
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ type parameter).
6868

6969
import astconv::{ast_conv, ast_ty_to_ty};
7070
import collect::{methods}; // ccx.to_ty()
71-
import method::{methods}; // methods for method::lookup
7271
import middle::ty::{tv_vid, vid};
7372
import regionmanip::{replace_bound_regions_in_fn_ty, region_of};
7473
import rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope};
@@ -905,15 +904,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
905904
opname: str, args: [option<@ast::expr>])
906905
-> option<(ty::t, bool)> {
907906
let callee_id = ast_util::op_expr_callee_id(op_ex);
908-
let lkup = method::lookup({fcx: fcx,
909-
expr: op_ex,
910-
self_expr: self_ex,
911-
borrow_scope: op_ex.id,
912-
node_id: callee_id,
913-
m_name: @opname,
914-
self_ty: self_t,
915-
supplied_tps: [],
916-
include_private: false});
907+
let lkup = method::lookup(fcx, op_ex, self_ex, op_ex.id,
908+
callee_id, @opname, self_t, [], false);
917909
alt lkup.method() {
918910
some(origin) {
919911
let {fty: method_ty, bot: bot} = {
@@ -1629,15 +1621,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
16291621
// encloses the method call
16301622
let borrow_scope = fcx.tcx().region_map.get(expr.id);
16311623

1632-
let lkup = method::lookup({fcx: fcx,
1633-
expr: expr,
1634-
self_expr: base,
1635-
borrow_scope: borrow_scope,
1636-
node_id: expr.id,
1637-
m_name: field,
1638-
self_ty: expr_t,
1639-
supplied_tps: tps,
1640-
include_private: is_self_ref});
1624+
let lkup = method::lookup(fcx, expr, base, borrow_scope,
1625+
expr.id, field, expr_t, tps,
1626+
is_self_ref);
16411627
alt lkup.method() {
16421628
some(entry) {
16431629
fcx.ccx.method_map.insert(id, entry);
@@ -1686,15 +1672,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
16861672

16871673
let p_ty = fcx.expr_ty(p);
16881674

1689-
let lkup = method::lookup({fcx: fcx,
1690-
expr: p,
1691-
self_expr: p,
1692-
borrow_scope: expr.id,
1693-
node_id: alloc_id,
1694-
m_name: @"alloc",
1695-
self_ty: p_ty,
1696-
supplied_tps: [],
1697-
include_private: false});
1675+
let lkup = method::lookup(fcx, p, p, expr.id, alloc_id,
1676+
@"alloc", p_ty, [], false);
16981677
alt lkup.method() {
16991678
some(entry) {
17001679
fcx.ccx.method_map.insert(alloc_id, entry);

0 commit comments

Comments
 (0)