Skip to content

Commit e840a37

Browse files
committed
rustc: Remove typeck::check_item_fn(); it's entirely superfluous!
1 parent 87288a1 commit e840a37

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/comp/middle/typeck.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,29 +2717,6 @@ fn check_fn(&@crate_ctxt ccx, &ast::fn_decl decl, ast::proto proto,
27172717
ret rec(decl=decl, proto=proto, body=body);
27182718
}
27192719

2720-
fn check_item_fn(&@crate_ctxt ccx, &span sp, &ast::ident ident, &ast::_fn f,
2721-
&vec[ast::ty_param] ty_params, &ast::def_id id,
2722-
&ast::ann ann) -> @ast::item {
2723-
2724-
// FIXME: duplicate work: the item annotation already has the arg types
2725-
// and return type translated to typeck::ty values. We don't need do to it
2726-
// again here, we can extract them.
2727-
2728-
let vec[arg] inputs = [];
2729-
for (ast::arg arg in f.decl.inputs) {
2730-
auto input_ty = ast_ty_to_ty_crate(ccx, arg.ty);
2731-
inputs += [rec(mode=ast_mode_to_mode(arg.mode), ty=input_ty)];
2732-
}
2733-
2734-
auto output_ty = ast_ty_to_ty_crate(ccx, f.decl.output);
2735-
auto typ = ty::mk_fn(ccx.tcx, f.proto, inputs, output_ty);
2736-
auto fn_ann = triv_ann(ann.id, typ);
2737-
write_type_only(ccx.node_types, ann.id, typ);
2738-
2739-
auto item = ast::item_fn(ident, f, ty_params, id, fn_ann);
2740-
ret @fold::respan[ast::item_](sp, item);
2741-
}
2742-
27432720
fn update_obj_fields(&@crate_ctxt ccx, &@ast::item i) -> @crate_ctxt {
27442721
alt (i.node) {
27452722
case (ast::item_obj(_, ?ob, _, ?obj_def_ids, _)) {
@@ -2839,8 +2816,7 @@ fn check_crate(&ty::ctxt tcx, &@ast::crate crate) -> typecheck_result {
28392816
auto fld = fold::new_identity_fold[@crate_ctxt]();
28402817

28412818
fld = @rec(update_env_for_item = bind update_obj_fields(_, _),
2842-
fold_fn = bind check_fn(_,_,_,_),
2843-
fold_item_fn = bind check_item_fn(_,_,_,_,_,_,_)
2819+
fold_fn = bind check_fn(_,_,_,_)
28442820
with *fld);
28452821

28462822
auto crate_1 = fold::fold_crate[@crate_ctxt](ccx, fld, crate);

0 commit comments

Comments
 (0)