mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Remove some essentially dead code in method handling.
This commit is contained in:
parent
5e26808141
commit
13e5f0ebdf
@ -2110,7 +2110,7 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
|
|||||||
}
|
}
|
||||||
ast::item_impl(ref generics, _, _, ref ms) => {
|
ast::item_impl(ref generics, _, _, ref ms) => {
|
||||||
meth::trans_impl(ccx, /*bad*/copy *path, item.ident, *ms,
|
meth::trans_impl(ccx, /*bad*/copy *path, item.ident, *ms,
|
||||||
generics, None, item.id);
|
generics, item.id);
|
||||||
}
|
}
|
||||||
ast::item_mod(ref m) => {
|
ast::item_mod(ref m) => {
|
||||||
trans_mod(ccx, m);
|
trans_mod(ccx, m);
|
||||||
|
@ -49,13 +49,12 @@ pub fn trans_impl(ccx: @mut CrateContext,
|
|||||||
name: ast::ident,
|
name: ast::ident,
|
||||||
methods: &[@ast::method],
|
methods: &[@ast::method],
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
self_ty: Option<ty::t>,
|
|
||||||
id: ast::node_id) {
|
id: ast::node_id) {
|
||||||
let _icx = push_ctxt("impl::trans_impl");
|
let _icx = push_ctxt("impl::trans_impl");
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
|
|
||||||
debug!("trans_impl(path=%s, name=%s, self_ty=%s, id=%?)",
|
debug!("trans_impl(path=%s, name=%s, id=%?)",
|
||||||
path.repr(tcx), name.repr(tcx), self_ty.repr(tcx), id);
|
path.repr(tcx), name.repr(tcx), id);
|
||||||
|
|
||||||
if !generics.ty_params.is_empty() { return; }
|
if !generics.ty_params.is_empty() { return; }
|
||||||
let sub_path = vec::append_one(path, path_name(name));
|
let sub_path = vec::append_one(path, path_name(name));
|
||||||
@ -65,24 +64,10 @@ pub fn trans_impl(ccx: @mut CrateContext,
|
|||||||
let path = vec::append_one(/*bad*/copy sub_path,
|
let path = vec::append_one(/*bad*/copy sub_path,
|
||||||
path_name(method.ident));
|
path_name(method.ident));
|
||||||
|
|
||||||
let param_substs_opt;
|
|
||||||
match self_ty {
|
|
||||||
None => param_substs_opt = None,
|
|
||||||
Some(self_ty) => {
|
|
||||||
param_substs_opt = Some(@param_substs {
|
|
||||||
tys: ~[],
|
|
||||||
vtables: None,
|
|
||||||
type_param_defs: @~[],
|
|
||||||
self_ty: Some(self_ty)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trans_method(ccx,
|
trans_method(ccx,
|
||||||
path,
|
path,
|
||||||
*method,
|
*method,
|
||||||
param_substs_opt,
|
None,
|
||||||
self_ty,
|
|
||||||
llfn,
|
llfn,
|
||||||
ast_util::local_def(id));
|
ast_util::local_def(id));
|
||||||
}
|
}
|
||||||
@ -98,9 +83,6 @@ Translates a (possibly monomorphized) method body.
|
|||||||
- `method`: the AST node for the method
|
- `method`: the AST node for the method
|
||||||
- `param_substs`: if this is a generic method, the current values for
|
- `param_substs`: if this is a generic method, the current values for
|
||||||
type parameters and so forth, else none
|
type parameters and so forth, else none
|
||||||
- `base_self_ty`: optionally, the explicit self type for this method. This
|
|
||||||
will be none if this is not a default method and must always be present
|
|
||||||
if this is a default method.
|
|
||||||
- `llfn`: the LLVM ValueRef for the method
|
- `llfn`: the LLVM ValueRef for the method
|
||||||
- `impl_id`: the node ID of the impl this method is inside
|
- `impl_id`: the node ID of the impl this method is inside
|
||||||
*/
|
*/
|
||||||
@ -108,7 +90,6 @@ pub fn trans_method(ccx: @mut CrateContext,
|
|||||||
path: path,
|
path: path,
|
||||||
method: &ast::method,
|
method: &ast::method,
|
||||||
param_substs: Option<@param_substs>,
|
param_substs: Option<@param_substs>,
|
||||||
base_self_ty: Option<ty::t>,
|
|
||||||
llfn: ValueRef,
|
llfn: ValueRef,
|
||||||
impl_id: ast::def_id) {
|
impl_id: ast::def_id) {
|
||||||
// figure out how self is being passed
|
// figure out how self is being passed
|
||||||
@ -119,18 +100,14 @@ pub fn trans_method(ccx: @mut CrateContext,
|
|||||||
_ => {
|
_ => {
|
||||||
// determine the (monomorphized) type that `self` maps to for
|
// determine the (monomorphized) type that `self` maps to for
|
||||||
// this method
|
// this method
|
||||||
let self_ty = match base_self_ty {
|
let self_ty = ty::node_id_to_type(ccx.tcx, method.self_id);
|
||||||
None => ty::node_id_to_type(ccx.tcx, method.self_id),
|
|
||||||
Some(provided_self_ty) => provided_self_ty,
|
|
||||||
};
|
|
||||||
let self_ty = match param_substs {
|
let self_ty = match param_substs {
|
||||||
None => self_ty,
|
None => self_ty,
|
||||||
Some(@param_substs {tys: ref tys, _}) => {
|
Some(@param_substs {tys: ref tys, _}) => {
|
||||||
ty::subst_tps(ccx.tcx, *tys, None, self_ty)
|
ty::subst_tps(ccx.tcx, *tys, None, self_ty)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
debug!("calling trans_fn with base_self_ty %s, self_ty %s",
|
debug!("calling trans_fn with self_ty %s",
|
||||||
base_self_ty.repr(ccx.tcx),
|
|
||||||
self_ty.repr(ccx.tcx));
|
self_ty.repr(ccx.tcx));
|
||||||
match method.explicit_self.node {
|
match method.explicit_self.node {
|
||||||
ast::sty_value => {
|
ast::sty_value => {
|
||||||
|
@ -233,14 +233,14 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
|
|||||||
Some(override_impl_did) => impl_did = override_impl_did
|
Some(override_impl_did) => impl_did = override_impl_did
|
||||||
}
|
}
|
||||||
|
|
||||||
meth::trans_method(ccx, pt, mth, psubsts, None, d, impl_did);
|
meth::trans_method(ccx, pt, mth, psubsts, d, impl_did);
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
ast_map::node_trait_method(@ast::provided(mth), _, pt) => {
|
ast_map::node_trait_method(@ast::provided(mth), _, pt) => {
|
||||||
let d = mk_lldecl();
|
let d = mk_lldecl();
|
||||||
set_inline_hint_if_appr(/*bad*/copy mth.attrs, d);
|
set_inline_hint_if_appr(/*bad*/copy mth.attrs, d);
|
||||||
debug!("monomorphic_fn impl_did_opt is %?", impl_did_opt);
|
debug!("monomorphic_fn impl_did_opt is %?", impl_did_opt);
|
||||||
meth::trans_method(ccx, /*bad*/copy *pt, mth, psubsts, None, d,
|
meth::trans_method(ccx, /*bad*/copy *pt, mth, psubsts, d,
|
||||||
impl_did_opt.get());
|
impl_did_opt.get());
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user