Remove redisue of unused fields from 'ann'.
This commit is contained in:
parent
2561b01211
commit
9f95538462
4 changed files with 6 additions and 52 deletions
|
|
@ -20,10 +20,7 @@ type def_id = tup(crate_num, def_num);
|
|||
|
||||
type ty_param = ident;
|
||||
|
||||
// Annotations added during successive passes.
|
||||
type ann = rec(uint id,
|
||||
middle::ty::t ty,
|
||||
option::t[vec[middle::ty::t]] tps);
|
||||
type ann = rec(uint id);
|
||||
|
||||
tag def {
|
||||
def_fn(def_id);
|
||||
|
|
|
|||
|
|
@ -146,10 +146,7 @@ fn new_parser(session::session sess,
|
|||
fn get_chpos() -> uint {ret rdr.get_chpos();}
|
||||
|
||||
fn get_ann() -> ast::ann {
|
||||
// TODO: Remove ty and tps, which should be unused
|
||||
// by now.
|
||||
auto rv = rec(id=next_ann_var, ty=0u,
|
||||
tps=none[vec[middle::ty::t]]);
|
||||
auto rv = rec(id=next_ann_var);
|
||||
next_ann_var += 1u;
|
||||
ret rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1572,28 +1572,6 @@ fn ann_to_monotype(&ctxt cx, ast::ann a) -> t {
|
|||
}
|
||||
|
||||
|
||||
// Turns a type and optional type parameters into an annotation, using
|
||||
// defaults for other fields.
|
||||
fn mk_ann_type(uint node_id, t typ, option::t[vec[t]] tps) -> ast::ann {
|
||||
ret rec(id=node_id, ty=typ, tps=tps);
|
||||
}
|
||||
|
||||
// Turns a type into an annotation, using defaults for other fields.
|
||||
fn triv_ann(uint node_id, t typ) -> ast::ann {
|
||||
ret mk_ann_type(node_id, typ, none[vec[t]]);
|
||||
}
|
||||
|
||||
// Creates a nil type annotation.
|
||||
fn plain_ann(uint node_id, ctxt tcx) -> ast::ann {
|
||||
ret triv_ann(node_id, mk_nil(tcx));
|
||||
}
|
||||
|
||||
// Creates a _|_ type annotation.
|
||||
fn bot_ann(uint node_id, ctxt tcx) -> ast::ann {
|
||||
ret triv_ann(node_id, mk_bot(tcx));
|
||||
}
|
||||
|
||||
|
||||
// Returns the number of distinct type parameters in the given type.
|
||||
fn count_ty_params(&ctxt cx, t ty) -> uint {
|
||||
fn counter(&ctxt cx, @mutable vec[uint] param_indices, t ty) {
|
||||
|
|
|
|||
|
|
@ -16,17 +16,13 @@ import middle::ty::block_ty;
|
|||
import middle::ty::expr_ty;
|
||||
import middle::ty::field;
|
||||
import middle::ty::method;
|
||||
import middle::ty::mk_ann_type;
|
||||
import middle::ty::mo_val;
|
||||
import middle::ty::mo_alias;
|
||||
import middle::ty::mo_either;
|
||||
import middle::ty::node_type_table;
|
||||
import middle::ty::pat_ty;
|
||||
import middle::ty::path_to_str;
|
||||
import middle::ty::plain_ann;
|
||||
import middle::ty::bot_ann;
|
||||
import middle::ty::struct;
|
||||
import middle::ty::triv_ann;
|
||||
import middle::ty::ty_param_substs_opt_and_ty;
|
||||
import middle::ty::ty_to_str;
|
||||
import middle::ty::type_is_integral;
|
||||
|
|
@ -645,9 +641,7 @@ mod collect {
|
|||
|
||||
fn get_tag_variant_types(&@ctxt cx, &ast::def_id tag_id,
|
||||
&vec[ast::variant] variants,
|
||||
&vec[ast::ty_param] ty_params)
|
||||
-> vec[ast::variant] {
|
||||
let vec[ast::variant] result = [];
|
||||
&vec[ast::ty_param] ty_params) {
|
||||
|
||||
// Create a set of parameter types shared among all the variants.
|
||||
let vec[ty::t] ty_param_tys = [];
|
||||
|
|
@ -682,17 +676,10 @@ mod collect {
|
|||
|
||||
auto tpt = tup(ty_param_count, result_ty);
|
||||
cx.tcx.tcache.insert(variant.node.id, tpt);
|
||||
auto variant_t = rec(
|
||||
ann=triv_ann(variant.node.ann.id, result_ty)
|
||||
with variant.node
|
||||
);
|
||||
write::ty_only(cx.tcx, variant.node.ann.id, result_ty);
|
||||
result += [common::respan(variant.span, variant_t)];
|
||||
}
|
||||
|
||||
ret result;
|
||||
}
|
||||
|
||||
|
||||
fn get_obj_method_types(&@ctxt cx, &ast::_obj object) -> vec[ty::method] {
|
||||
ret vec::map[@ast::method,method](bind ty_of_method(cx, _),
|
||||
object.methods);
|
||||
|
|
@ -1184,13 +1171,10 @@ mod pushdown {
|
|||
let ty_param_substs_and_ty res_t = demand::full(scx, pat.span,
|
||||
expected, tt, tps, NO_AUTODEREF);
|
||||
|
||||
auto a_1 = mk_ann_type(ann.id, res_t._1,
|
||||
some[vec[ty::t]](res_t._0));
|
||||
|
||||
// TODO: push down type from "expected".
|
||||
write::ty_fixup(scx, ann.id,
|
||||
ty::ann_to_ty_param_substs_opt_and_ty
|
||||
(scx.fcx.ccx.tcx.node_types, a_1));
|
||||
(scx.fcx.ccx.tcx.node_types, ann));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1691,8 +1675,7 @@ fn check_pat(&@stmt_ctxt scx, &@ast::pat pat) {
|
|||
}
|
||||
case (ast::pat_bind(?id, ?def_id, ?a)) {
|
||||
auto typ = next_ty_var(scx);
|
||||
auto ann = triv_ann(a.id, typ);
|
||||
write::ty_only_fixup(scx, ann.id, typ);
|
||||
write::ty_only_fixup(scx, a.id, typ);
|
||||
}
|
||||
case (ast::pat_tag(?p, ?subpats, ?old_ann)) {
|
||||
auto vdef = ast::variant_def_ids
|
||||
|
|
@ -1882,7 +1865,6 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
pushdown::pushdown_expr(scx, lhs_t1, rhs);
|
||||
auto rhs_t1 = expr_ty(scx.fcx.ccx.tcx, rhs);
|
||||
|
||||
auto ann = triv_ann(a.id, rhs_t1);
|
||||
write::ty_only_fixup(scx, a.id, rhs_t1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue