Port the compiler to foo<T> decl syntax.

This commit is contained in:
Erick Tryzelaar 2011-08-12 06:36:51 -07:00 committed by Graydon Hoare
parent 4c9049c50c
commit 4abc471390
20 changed files with 77 additions and 77 deletions

View file

@ -48,7 +48,7 @@ fn map_expr(map: &map, ex: &@expr, e: &(), v: &vt<()>) {
visit::visit_expr(ex, e, v);
}
fn new_smallintmap_int_adapter[@V]() -> std::map::hashmap<int, V> {
fn new_smallintmap_int_adapter<@V>() -> std::map::hashmap<int, V> {
let key_idx = fn (key: &int) -> uint { key as uint };
let idx_key = fn (idx: &uint) -> int { idx as int };
ret new_smallintmap_adapter(key_idx, idx_key);
@ -59,13 +59,13 @@ fn new_smallintmap_int_adapter[@V]() -> std::map::hashmap<int, V> {
// the entire codebase adapting all the callsites to the different
// interface.
// FIXME: hashmap and smallintmap should support the same interface.
fn new_smallintmap_adapter[@K,
@V](key_idx: fn(&K) -> uint ,
fn new_smallintmap_adapter<@K,
@V>(key_idx: fn(&K) -> uint ,
idx_key: fn(&uint) -> K ) ->
std::map::hashmap<K, V> {
obj adapter[@K,
@V](map: smallintmap::smallintmap<V>,
obj adapter<@K,
@V>(map: smallintmap::smallintmap<V>,
key_idx: fn(&K) -> uint ,
idx_key: fn(&uint) -> K ) {

View file

@ -1392,7 +1392,7 @@ fn add_name(ch: &checker, sp: &span, name: &ident) {
fn ident_id(i: &ident) -> ident { ret i; }
fn ensure_unique[T](e: &env, sp: &span, elts: &[T], id: fn(&T) -> ident ,
fn ensure_unique<T>(e: &env, sp: &span, elts: &[T], id: fn(&T) -> ident ,
kind: &str) {
let ch = checker(e, kind);
for elt: T in elts { add_name(ch, sp, id(elt)); }

View file

@ -1012,13 +1012,13 @@ fn non_init_constraint_mentions(fcx: &fn_ctxt, c: &norm_constraint,
};
}
fn args_mention[T](args: &[@constr_arg_use], q: fn(&[T], node_id) -> bool ,
fn args_mention<T>(args: &[@constr_arg_use], q: fn(&[T], node_id) -> bool ,
s: &[T]) -> bool {
/*
FIXME
The following version causes an assertion in trans to fail
(something about type_is_tup_like)
fn mentions[T](&[T] s, &fn(&[T], def_id) -> bool q,
fn mentions<T>(&[T] s, &fn(&[T], def_id) -> bool q,
&@constr_arg_use a) -> bool {
alt (a.node) {
case (carg_ident(?p1)) {
@ -1051,7 +1051,7 @@ fn op_to_oper_ty(io: init_op) -> oper_type {
}
// default function visitor
fn do_nothing[T](f: &_fn, tp: &[ty_param], sp: &span, i: &fn_ident,
fn do_nothing<T>(f: &_fn, tp: &[ty_param], sp: &span, i: &fn_ident,
iid: node_id, cx: &T, v: &visit::vt<T>) {
}

View file

@ -284,7 +284,7 @@ tag sty {
// In the middle end, constraints have a def_id attached, referring
// to the definition of the operator in the constraint.
type constr_general[ARG] = spanned<constr_general_<ARG, def_id>>;
type constr_general<ARG> = spanned<constr_general_<ARG, def_id>>;
type type_constr = constr_general<path>;
type constr = constr_general<uint>;
@ -1554,7 +1554,7 @@ fn hash_ty(typ: &t) -> uint { ret typ; }
// users should use `eq_ty()` instead.
fn eq_int(x: &uint, y: &uint) -> bool { ret x == y; }
fn arg_eq[T](eq: &fn(&T, &T) -> bool , a: @sp_constr_arg<T>,
fn arg_eq<T>(eq: &fn(&T, &T) -> bool , a: @sp_constr_arg<T>,
b: @sp_constr_arg<T>) -> bool {
alt a.node {
ast::carg_base. {
@ -1569,7 +1569,7 @@ fn arg_eq[T](eq: &fn(&T, &T) -> bool , a: @sp_constr_arg<T>,
}
}
fn args_eq[T](eq: fn(&T, &T) -> bool , a: &[@sp_constr_arg<T>],
fn args_eq<T>(eq: fn(&T, &T) -> bool , a: &[@sp_constr_arg<T>],
b: &[@sp_constr_arg<T>]) -> bool {
let i: uint = 0u;
for arg: @sp_constr_arg<T> in a {
@ -3090,7 +3090,7 @@ fn is_binopable(cx: &ctxt, ty: t, op: ast::binop) -> bool {
ret tbl.(tycat(cx, ty)).(opcat(op));
}
fn ast_constr_to_constr[T](tcx: ty::ctxt, c: &@ast::constr_general<T>) ->
fn ast_constr_to_constr<T>(tcx: ty::ctxt, c: &@ast::constr_general<T>) ->
@ty::constr_general<T> {
alt tcx.def_map.find(c.node.id) {
some(ast::def_fn(pred_id, ast::pure_fn.)) {

View file

@ -1281,10 +1281,10 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
};
// Don't descend into fns and items
fn visit_fn[E](f: &ast::_fn, tp: &[ast::ty_param], sp: &span,
fn visit_fn<E>(f: &ast::_fn, tp: &[ast::ty_param], sp: &span,
i: &ast::fn_ident, id: ast::node_id, e: &E,
v: &visit::vt<E>) { }
fn visit_item[E](i: &@ast::item, e: &E, v: &visit::vt<E>) { }
fn visit_item<E>(i: &@ast::item, e: &E, v: &visit::vt<E>) { }
let visit =
@{visit_local: visit_local,