Port the compiler to the typaram foo<T> syntax.
This commit is contained in:
parent
f764f9a8cf
commit
e4a0f997fb
51 changed files with 568 additions and 568 deletions
|
|
@ -36,7 +36,7 @@ type scope = @[restrict];
|
|||
|
||||
tag local_info { arg(ast::mode); objfield(ast::mutability); }
|
||||
|
||||
type ctx = {tcx: ty::ctxt, local_map: std::map::hashmap[node_id, local_info]};
|
||||
type ctx = {tcx: ty::ctxt, local_map: std::map::hashmap<node_id, local_info>};
|
||||
|
||||
fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) {
|
||||
// Stores information about object fields and function
|
||||
|
|
@ -52,7 +52,7 @@ fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) {
|
|||
}
|
||||
|
||||
fn visit_fn(cx: &@ctx, f: &ast::_fn, tp: &[ast::ty_param], sp: &span,
|
||||
name: &fn_ident, id: ast::node_id, sc: &scope, v: &vt[scope]) {
|
||||
name: &fn_ident, id: ast::node_id, sc: &scope, v: &vt<scope>) {
|
||||
visit::visit_fn_decl(f.decl, sc, v);
|
||||
for arg_: ast::arg in f.decl.inputs {
|
||||
cx.local_map.insert(arg_.id, arg(arg_.mode));
|
||||
|
|
@ -82,7 +82,7 @@ fn visit_fn(cx: &@ctx, f: &ast::_fn, tp: &[ast::ty_param], sp: &span,
|
|||
v.visit_block(f.body, scope, v);
|
||||
}
|
||||
|
||||
fn visit_item(cx: &@ctx, i: &@ast::item, sc: &scope, v: &vt[scope]) {
|
||||
fn visit_item(cx: &@ctx, i: &@ast::item, sc: &scope, v: &vt<scope>) {
|
||||
alt i.node {
|
||||
ast::item_obj(o, _, _) {
|
||||
for f: ast::obj_field in o.fields {
|
||||
|
|
@ -94,7 +94,7 @@ fn visit_item(cx: &@ctx, i: &@ast::item, sc: &scope, v: &vt[scope]) {
|
|||
visit::visit_item(i, sc, v);
|
||||
}
|
||||
|
||||
fn visit_expr(cx: &@ctx, ex: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
||||
fn visit_expr(cx: &@ctx, ex: &@ast::expr, sc: &scope, v: &vt<scope>) {
|
||||
let handled = true;
|
||||
alt ex.node {
|
||||
ast::expr_call(f, args) {
|
||||
|
|
@ -145,7 +145,7 @@ fn visit_expr(cx: &@ctx, ex: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
|||
if !handled { visit::visit_expr(ex, sc, v); }
|
||||
}
|
||||
|
||||
fn visit_decl(cx: &@ctx, d: &@ast::decl, sc: &scope, v: &vt[scope]) {
|
||||
fn visit_decl(cx: &@ctx, d: &@ast::decl, sc: &scope, v: &vt<scope>) {
|
||||
visit::visit_decl(d, sc, v);
|
||||
alt d.node {
|
||||
ast::decl_local(locs) {
|
||||
|
|
@ -309,7 +309,7 @@ fn check_tail_call(cx: &ctx, call: &@ast::expr) {
|
|||
}
|
||||
|
||||
fn check_alt(cx: &ctx, input: &@ast::expr, arms: &[ast::arm], sc: &scope,
|
||||
v: &vt[scope]) {
|
||||
v: &vt<scope>) {
|
||||
visit::visit_expr(input, sc, v);
|
||||
let root = expr_root(cx, input, true);
|
||||
let roots =
|
||||
|
|
@ -336,7 +336,7 @@ fn arm_defnums(arm: &ast::arm) -> [node_id] {
|
|||
}
|
||||
|
||||
fn check_for_each(cx: &ctx, local: &@ast::local, call: &@ast::expr,
|
||||
blk: &ast::blk, sc: &scope, v: &vt[scope]) {
|
||||
blk: &ast::blk, sc: &scope, v: &vt<scope>) {
|
||||
visit::visit_expr(call, sc, v);
|
||||
alt call.node {
|
||||
ast::expr_call(f, args) {
|
||||
|
|
@ -354,7 +354,7 @@ fn check_for_each(cx: &ctx, local: &@ast::local, call: &@ast::expr,
|
|||
}
|
||||
|
||||
fn check_for(cx: &ctx, local: &@ast::local, seq: &@ast::expr, blk: &ast::blk,
|
||||
sc: &scope, v: &vt[scope]) {
|
||||
sc: &scope, v: &vt<scope>) {
|
||||
visit::visit_expr(seq, sc, v);
|
||||
let root = expr_root(cx, seq, false);
|
||||
let root_def =
|
||||
|
|
@ -405,7 +405,7 @@ fn check_var(cx: &ctx, ex: &@ast::expr, p: &ast::path, id: ast::node_id,
|
|||
}
|
||||
}
|
||||
|
||||
fn check_lval(cx: &@ctx, dest: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
||||
fn check_lval(cx: &@ctx, dest: &@ast::expr, sc: &scope, v: &vt<scope>) {
|
||||
alt dest.node {
|
||||
ast::expr_path(p) {
|
||||
let dnum = ast::def_id_of_def(cx.tcx.def_map.get(dest.id)).node;
|
||||
|
|
@ -440,7 +440,7 @@ fn check_lval(cx: &@ctx, dest: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_move_rhs(cx: &@ctx, src: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
||||
fn check_move_rhs(cx: &@ctx, src: &@ast::expr, sc: &scope, v: &vt<scope>) {
|
||||
alt src.node {
|
||||
ast::expr_path(p) {
|
||||
alt cx.tcx.def_map.get(src.id) {
|
||||
|
|
@ -464,7 +464,7 @@ fn check_move_rhs(cx: &@ctx, src: &@ast::expr, sc: &scope, v: &vt[scope]) {
|
|||
}
|
||||
|
||||
fn check_assign(cx: &@ctx, dest: &@ast::expr, src: &@ast::expr, sc: &scope,
|
||||
v: &vt[scope]) {
|
||||
v: &vt<scope>) {
|
||||
visit_expr(cx, src, sc, v);
|
||||
check_lval(cx, dest, sc, v);
|
||||
}
|
||||
|
|
@ -630,19 +630,19 @@ fn mut_field(ds: &@[deref]) -> bool {
|
|||
ret false;
|
||||
}
|
||||
|
||||
fn inner_mut(ds: &@[deref]) -> option::t[ty::t] {
|
||||
fn inner_mut(ds: &@[deref]) -> option::t<ty::t> {
|
||||
for d: deref in *ds { if d.mut { ret some(d.outer_t); } }
|
||||
ret none;
|
||||
}
|
||||
|
||||
fn path_def(cx: &ctx, ex: &@ast::expr) -> option::t[ast::def] {
|
||||
fn path_def(cx: &ctx, ex: &@ast::expr) -> option::t<ast::def> {
|
||||
ret alt ex.node {
|
||||
ast::expr_path(_) { some(cx.tcx.def_map.get(ex.id)) }
|
||||
_ { none }
|
||||
}
|
||||
}
|
||||
|
||||
fn path_def_id(cx: &ctx, ex: &@ast::expr) -> option::t[ast::def_id] {
|
||||
fn path_def_id(cx: &ctx, ex: &@ast::expr) -> option::t<ast::def_id> {
|
||||
alt ex.node {
|
||||
ast::expr_path(_) {
|
||||
ret some(ast::def_id_of_def(cx.tcx.def_map.get(ex.id)));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ tag ast_node {
|
|||
node_expr(@expr);
|
||||
}
|
||||
|
||||
type map = std::map::hashmap[node_id, ast_node];
|
||||
type map = std::map::hashmap<node_id, ast_node>;
|
||||
|
||||
fn map_crate(c: &crate) -> map {
|
||||
// FIXME: This is using an adapter to convert the smallintmap
|
||||
|
|
@ -29,7 +29,7 @@ fn map_crate(c: &crate) -> map {
|
|||
ret map;
|
||||
}
|
||||
|
||||
fn map_item(map: &map, i: &@item, e: &(), v: &vt[()]) {
|
||||
fn map_item(map: &map, i: &@item, e: &(), v: &vt<()>) {
|
||||
map.insert(i.id, node_item(i));
|
||||
alt i.node {
|
||||
item_obj(_, _, ctor_id) { map.insert(ctor_id, node_obj_ctor(i)); }
|
||||
|
|
@ -38,17 +38,17 @@ fn map_item(map: &map, i: &@item, e: &(), v: &vt[()]) {
|
|||
visit::visit_item(i, e, v);
|
||||
}
|
||||
|
||||
fn map_native_item(map: &map, i: &@native_item, e: &(), v: &vt[()]) {
|
||||
fn map_native_item(map: &map, i: &@native_item, e: &(), v: &vt<()>) {
|
||||
map.insert(i.id, node_native_item(i));
|
||||
visit::visit_native_item(i, e, v);
|
||||
}
|
||||
|
||||
fn map_expr(map: &map, ex: &@expr, e: &(), v: &vt[()]) {
|
||||
fn map_expr(map: &map, ex: &@expr, e: &(), v: &vt<()>) {
|
||||
map.insert(ex.id, node_expr(ex));
|
||||
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);
|
||||
|
|
@ -62,10 +62,10 @@ fn new_smallintmap_int_adapter[@V]() -> std::map::hashmap[int, V] {
|
|||
fn new_smallintmap_adapter[@K,
|
||||
@V](key_idx: fn(&K) -> uint ,
|
||||
idx_key: fn(&uint) -> K ) ->
|
||||
std::map::hashmap[K, V] {
|
||||
std::map::hashmap<K, V> {
|
||||
|
||||
obj adapter[@K,
|
||||
@V](map: smallintmap::smallintmap[V],
|
||||
@V](map: smallintmap::smallintmap<V>,
|
||||
key_idx: fn(&K) -> uint ,
|
||||
idx_key: fn(&uint) -> K ) {
|
||||
|
||||
|
|
@ -83,17 +83,17 @@ fn new_smallintmap_adapter[@K,
|
|||
|
||||
fn get(key: &K) -> V { ret smallintmap::get(map, key_idx(key)); }
|
||||
|
||||
fn find(key: &K) -> option::t[V] {
|
||||
fn find(key: &K) -> option::t<V> {
|
||||
ret smallintmap::find(map, key_idx(key));
|
||||
}
|
||||
|
||||
fn remove(key: &K) -> option::t[V] { fail }
|
||||
fn remove(key: &K) -> option::t<V> { fail }
|
||||
|
||||
fn rehash() { fail }
|
||||
|
||||
iter items() -> @{key: K, val: V} {
|
||||
let idx = 0u;
|
||||
for item: option::t[V] in map.v {
|
||||
for item: option::t<V> in map.v {
|
||||
alt item {
|
||||
option::some(elt) {
|
||||
let value = elt;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ fn check_crate(tcx: &ty::ctxt, crate: &@crate) {
|
|||
tcx.sess.abort_if_errors();
|
||||
}
|
||||
|
||||
fn check_expr(tcx: &ty::ctxt, ex: &@expr, s: &(), v: &visit::vt[()]) {
|
||||
fn check_expr(tcx: &ty::ctxt, ex: &@expr, s: &(), v: &visit::vt<()>) {
|
||||
visit::visit_expr(ex, s, v);
|
||||
alt ex.node { expr_alt(_, arms) { check_arms(tcx, arms); } _ { } }
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ fn pattern_supersedes(tcx: &ty::ctxt, a: &@pat, b: &@pat) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_local(tcx: &ty::ctxt, loc: &@local, s: &(), v: &visit::vt[()]) {
|
||||
fn check_local(tcx: &ty::ctxt, loc: &@local, s: &(), v: &visit::vt<()>) {
|
||||
visit::visit_local(loc, s, v);
|
||||
if is_refutable(tcx, loc.node.pat) {
|
||||
tcx.sess.span_err(loc.node.pat.span,
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ export def_lookup;
|
|||
// "canonical" referencing node_id per free variable. The set is useful for
|
||||
// testing membership, the list of referencing sites is what you want for most
|
||||
// other things.
|
||||
type freevar_set = hashset[ast::node_id];
|
||||
type freevar_set = hashset<ast::node_id>;
|
||||
type freevar_info = {defs: freevar_set, refs: @[ast::node_id]};
|
||||
type freevar_map = hashmap[ast::node_id, freevar_info];
|
||||
type freevar_map = hashmap<ast::node_id, freevar_info>;
|
||||
|
||||
// Searches through part of the AST for all references to locals or
|
||||
// upvars in this frame and returns the list of definition IDs thus found.
|
||||
|
|
@ -38,7 +38,7 @@ type freevar_map = hashmap[ast::node_id, freevar_info];
|
|||
// of the AST, we take a walker function that we invoke with a visitor
|
||||
// in order to start the search.
|
||||
fn collect_freevars(def_map: &resolve::def_map, sess: &session::session,
|
||||
walker: &fn(&visit::vt[()]) ,
|
||||
walker: &fn(&visit::vt<()>) ,
|
||||
initial_decls: [ast::node_id]) -> freevar_info {
|
||||
let decls = new_int_hash();
|
||||
for decl: ast::node_id in initial_decls { set_add(decls, decl); }
|
||||
|
|
@ -108,7 +108,7 @@ fn annotate_freevars(sess: &session::session, def_map: &resolve::def_map,
|
|||
|
||||
let walk_fn = lambda(f: &ast::_fn, tps: &[ast::ty_param], sp: &span,
|
||||
i: &ast::fn_ident, nid: ast::node_id) {
|
||||
let start_walk = lambda(v: &visit::vt[()]) {
|
||||
let start_walk = lambda(v: &visit::vt<()>) {
|
||||
v.visit_fn(f, tps, sp, i, nid, (), v);
|
||||
};
|
||||
let vars = collect_freevars(def_map, sess, start_walk, ~[]);
|
||||
|
|
@ -117,7 +117,7 @@ fn annotate_freevars(sess: &session::session, def_map: &resolve::def_map,
|
|||
let walk_expr = lambda(expr: &@ast::expr) {
|
||||
alt expr.node {
|
||||
ast::expr_for_each(local, _, body) {
|
||||
let start_walk = lambda(v: &visit::vt[()]) {
|
||||
let start_walk = lambda(v: &visit::vt<()>) {
|
||||
v.visit_block(body, (), v);
|
||||
};
|
||||
let bound = ast::pat_binding_ids(local.node.pat);
|
||||
|
|
@ -157,7 +157,7 @@ fn is_freevar_of(tcx: &ty::ctxt, def: ast::node_id, f: ast::node_id) -> bool {
|
|||
ret get_freevar_defs(tcx, f).contains_key(def);
|
||||
}
|
||||
fn def_lookup(tcx: &ty::ctxt, f: ast::node_id, id: ast::node_id) ->
|
||||
option::t[ast::def] {
|
||||
option::t<ast::def> {
|
||||
alt tcx.def_map.find(id) {
|
||||
none. { ret none; }
|
||||
some(d) {
|
||||
|
|
|
|||
|
|
@ -57,20 +57,20 @@ tag scope {
|
|||
scope_arm(ast::arm);
|
||||
}
|
||||
|
||||
type scopes = list[scope];
|
||||
type scopes = list<scope>;
|
||||
|
||||
tag import_state {
|
||||
todo(@ast::view_item, scopes); // only used for explicit imports
|
||||
|
||||
resolving(span);
|
||||
resolved(option::t[def],
|
||||
resolved(option::t<def>,
|
||||
/* value */
|
||||
option::t[def],
|
||||
option::t<def>,
|
||||
/* type */
|
||||
option::t[def]); /* module */
|
||||
option::t<def>); /* module */
|
||||
}
|
||||
|
||||
type ext_hash = hashmap[{did: def_id, ident: str, ns: namespace}, def];
|
||||
type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>;
|
||||
|
||||
fn new_ext_hash() -> ext_hash {
|
||||
type key = {did: def_id, ident: str, ns: namespace};
|
||||
|
|
@ -96,30 +96,30 @@ tag mod_index_entry {
|
|||
mie_tag_variant(/* tag item */@ast::item, /* variant index */uint);
|
||||
}
|
||||
|
||||
type mod_index = hashmap[ident, list[mod_index_entry]];
|
||||
type mod_index = hashmap<ident, list<mod_index_entry>>;
|
||||
|
||||
// A tuple of an imported def and the import stmt that brung it
|
||||
type glob_imp_def = {def: def, item: @ast::view_item};
|
||||
|
||||
type indexed_mod =
|
||||
{m: option::t[ast::_mod],
|
||||
{m: option::t<ast::_mod>,
|
||||
index: mod_index,
|
||||
mutable glob_imports: [glob_imp_def],
|
||||
glob_imported_names: hashmap[str, import_state]};
|
||||
glob_imported_names: hashmap<str, import_state>};
|
||||
|
||||
|
||||
/* native modules can't contain tags, and we don't store their ASTs because we
|
||||
only need to look at them to determine exports, which they can't control.*/
|
||||
|
||||
type def_map = hashmap[node_id, def];
|
||||
type def_map = hashmap<node_id, def>;
|
||||
|
||||
type env =
|
||||
{cstore: cstore::cstore,
|
||||
def_map: def_map,
|
||||
ast_map: ast_map::map,
|
||||
imports: hashmap[ast::node_id, import_state],
|
||||
mod_map: hashmap[ast::node_id, @indexed_mod],
|
||||
ext_map: hashmap[def_id, [ident]],
|
||||
imports: hashmap<ast::node_id, import_state>,
|
||||
mod_map: hashmap<ast::node_id, @indexed_mod>,
|
||||
ext_map: hashmap<def_id, [ident]>,
|
||||
ext_cache: ext_hash,
|
||||
mutable reported: [{ident: str, sc: scope}],
|
||||
sess: session};
|
||||
|
|
@ -168,7 +168,7 @@ fn map_crate(e: &@env, c: &@ast::crate) {
|
|||
index: index_mod(c.node.module),
|
||||
mutable glob_imports: ~[],
|
||||
glob_imported_names: new_str_hash[import_state]()});
|
||||
fn index_vi(e: @env, i: &@ast::view_item, sc: &scopes, v: &vt[scopes]) {
|
||||
fn index_vi(e: @env, i: &@ast::view_item, sc: &scopes, v: &vt<scopes>) {
|
||||
alt i.node {
|
||||
ast::view_item_import(_, ids, id) {
|
||||
e.imports.insert(id, todo(i, sc));
|
||||
|
|
@ -176,7 +176,7 @@ fn map_crate(e: &@env, c: &@ast::crate) {
|
|||
_ { }
|
||||
}
|
||||
}
|
||||
fn index_i(e: @env, i: &@ast::item, sc: &scopes, v: &vt[scopes]) {
|
||||
fn index_i(e: @env, i: &@ast::item, sc: &scopes, v: &vt<scopes>) {
|
||||
visit_item_with_scope(i, sc, v);
|
||||
alt i.node {
|
||||
ast::item_mod(md) {
|
||||
|
|
@ -206,7 +206,7 @@ fn map_crate(e: &@env, c: &@ast::crate) {
|
|||
with *visit::default_visitor[scopes]()};
|
||||
visit::visit_crate(*c, cons(scope_crate, @nil),
|
||||
visit::mk_vt(v_link_glob));
|
||||
fn link_glob(e: @env, vi: &@ast::view_item, sc: &scopes, v: &vt[scopes]) {
|
||||
fn link_glob(e: @env, vi: &@ast::view_item, sc: &scopes, v: &vt<scopes>) {
|
||||
fn find_mod(e: @env, sc: scopes) -> @indexed_mod {
|
||||
alt sc {
|
||||
cons(scope_item(i), tl) {
|
||||
|
|
@ -265,7 +265,7 @@ fn resolve_names(e: &@env, c: &@ast::crate) {
|
|||
visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v));
|
||||
e.sess.abort_if_errors();
|
||||
|
||||
fn walk_expr(e: @env, exp: &@ast::expr, sc: &scopes, v: &vt[scopes]) {
|
||||
fn walk_expr(e: @env, exp: &@ast::expr, sc: &scopes, v: &vt<scopes>) {
|
||||
visit_expr_with_scope(exp, sc, v);
|
||||
alt exp.node {
|
||||
ast::expr_path(p) {
|
||||
|
|
@ -276,7 +276,7 @@ fn resolve_names(e: &@env, c: &@ast::crate) {
|
|||
_ { }
|
||||
}
|
||||
}
|
||||
fn walk_ty(e: @env, t: &@ast::ty, sc: &scopes, v: &vt[scopes]) {
|
||||
fn walk_ty(e: @env, t: &@ast::ty, sc: &scopes, v: &vt<scopes>) {
|
||||
visit::visit_ty(t, sc, v);
|
||||
alt t.node {
|
||||
ast::ty_path(p, id) {
|
||||
|
|
@ -287,13 +287,13 @@ fn resolve_names(e: &@env, c: &@ast::crate) {
|
|||
}
|
||||
}
|
||||
fn walk_constr(e: @env, p: &ast::path, sp: &span, id: node_id,
|
||||
sc: &scopes, v: &vt[scopes]) {
|
||||
sc: &scopes, v: &vt<scopes>) {
|
||||
maybe_insert(e, id, lookup_path_strict(*e, sc, sp, p.node, ns_value));
|
||||
}
|
||||
fn walk_arm(e: @env, a: &ast::arm, sc: &scopes, v: &vt[scopes]) {
|
||||
fn walk_arm(e: @env, a: &ast::arm, sc: &scopes, v: &vt<scopes>) {
|
||||
visit_arm_with_scope(a, sc, v);
|
||||
}
|
||||
fn walk_pat(e: &@env, pat: &@ast::pat, sc: &scopes, v: &vt[scopes]) {
|
||||
fn walk_pat(e: &@env, pat: &@ast::pat, sc: &scopes, v: &vt<scopes>) {
|
||||
visit::visit_pat(pat, sc, v);
|
||||
alt pat.node {
|
||||
ast::pat_tag(p, _) {
|
||||
|
|
@ -312,25 +312,25 @@ fn resolve_names(e: &@env, c: &@ast::crate) {
|
|||
}
|
||||
}
|
||||
|
||||
fn maybe_insert(e: @env, id: node_id, def: option::t[def]) {
|
||||
fn maybe_insert(e: @env, id: node_id, def: option::t<def>) {
|
||||
if option::is_some(def) { e.def_map.insert(id, option::get(def)); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Visit helper functions
|
||||
fn visit_item_with_scope(i: &@ast::item, sc: &scopes, v: &vt[scopes]) {
|
||||
fn visit_item_with_scope(i: &@ast::item, sc: &scopes, v: &vt<scopes>) {
|
||||
visit::visit_item(i, cons(scope_item(i), @sc), v);
|
||||
}
|
||||
|
||||
fn visit_native_item_with_scope(ni: &@ast::native_item, sc: &scopes,
|
||||
v: &vt[scopes]) {
|
||||
v: &vt<scopes>) {
|
||||
visit::visit_native_item(ni, cons(scope_native_item(ni), @sc), v);
|
||||
}
|
||||
|
||||
fn visit_fn_with_scope(e: &@env, f: &ast::_fn, tp: &[ast::ty_param],
|
||||
sp: &span, name: &fn_ident, id: node_id, sc: &scopes,
|
||||
v: &vt[scopes]) {
|
||||
v: &vt<scopes>) {
|
||||
// is this a main fn declaration?
|
||||
alt name {
|
||||
some(nm) {
|
||||
|
|
@ -353,7 +353,7 @@ fn visit_fn_with_scope(e: &@env, f: &ast::_fn, tp: &[ast::ty_param],
|
|||
cons(scope_fn(f.decl, f.proto, tp), @sc), v);
|
||||
}
|
||||
|
||||
fn visit_block_with_scope(b: &ast::blk, sc: &scopes, v: &vt[scopes]) {
|
||||
fn visit_block_with_scope(b: &ast::blk, sc: &scopes, v: &vt<scopes>) {
|
||||
let pos = @mutable 0u, loc = @mutable 0u;
|
||||
let block_sc = cons(scope_block(b, pos, loc), @sc);
|
||||
for stmt in b.node.stmts {
|
||||
|
|
@ -364,7 +364,7 @@ fn visit_block_with_scope(b: &ast::blk, sc: &scopes, v: &vt[scopes]) {
|
|||
visit::visit_expr_opt(b.node.expr, block_sc, v);
|
||||
}
|
||||
|
||||
fn visit_decl_with_scope(d: &@decl, sc: &scopes, v: &vt[scopes]) {
|
||||
fn visit_decl_with_scope(d: &@decl, sc: &scopes, v: &vt<scopes>) {
|
||||
let loc_pos = alt list::car(sc) {
|
||||
scope_block(_, _, pos) { pos }
|
||||
_ { @mutable 0u }
|
||||
|
|
@ -380,11 +380,11 @@ fn visit_decl_with_scope(d: &@decl, sc: &scopes, v: &vt[scopes]) {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_arm_with_scope(a: &ast::arm, sc: &scopes, v: &vt[scopes]) {
|
||||
fn visit_arm_with_scope(a: &ast::arm, sc: &scopes, v: &vt<scopes>) {
|
||||
visit::visit_arm(a, cons(scope_arm(a), @sc), v);
|
||||
}
|
||||
|
||||
fn visit_expr_with_scope(x: &@ast::expr, sc: &scopes, v: &vt[scopes]) {
|
||||
fn visit_expr_with_scope(x: &@ast::expr, sc: &scopes, v: &vt<scopes>) {
|
||||
alt x.node {
|
||||
ast::expr_for(decl, coll, blk) | ast::expr_for_each(decl, coll, blk) {
|
||||
let new_sc = cons[scope](scope_loop(decl), @sc);
|
||||
|
|
@ -400,7 +400,7 @@ fn visit_expr_with_scope(x: &@ast::expr, sc: &scopes, v: &vt[scopes]) {
|
|||
}
|
||||
|
||||
fn follow_import(e: &env, sc: &scopes, path: &[ident], sp: &span) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
let path_len = vec::len(path);
|
||||
let dcur = lookup_in_scope_strict(e, sc, sp, path.(0), ns_module);
|
||||
let i = 1u;
|
||||
|
|
@ -425,7 +425,7 @@ fn follow_import(e: &env, sc: &scopes, path: &[ident], sp: &span) ->
|
|||
}
|
||||
|
||||
fn resolve_constr(e: @env, id: node_id, c: &@ast::constr, sc: &scopes,
|
||||
v: &vt[scopes]) {
|
||||
v: &vt<scopes>) {
|
||||
let new_def =
|
||||
lookup_path_strict(*e, sc, c.span, c.node.path.node, ns_value);
|
||||
if option::is_some(new_def) {
|
||||
|
|
@ -506,13 +506,13 @@ fn resolve_import(e: &env, it: &@ast::view_item, sc_in: &scopes) {
|
|||
}
|
||||
}
|
||||
fn register(e: &env, defid: def_id, sp: &span, name: &ident, sc: &scopes,
|
||||
val: &option::t[def], typ: &option::t[def],
|
||||
md: &option::t[def]) {
|
||||
val: &option::t<def>, typ: &option::t<def>,
|
||||
md: &option::t<def>) {
|
||||
if is_none(val) && is_none(typ) && is_none(md) {
|
||||
unresolved_err(e, sc, sp, name, "import");
|
||||
} else { e.imports.insert(defid.node, resolved(val, typ, md)); }
|
||||
}
|
||||
fn remove_if_unresolved(imports: hashmap[ast::node_id, import_state],
|
||||
fn remove_if_unresolved(imports: hashmap<ast::node_id, import_state>,
|
||||
node_id: ast::node_id) {
|
||||
|
||||
// If we couldn't resolve the import, don't leave it in a partially
|
||||
|
|
@ -572,7 +572,7 @@ fn mk_unresolved_msg(id: &ident, kind: &str) -> str {
|
|||
|
||||
// Lookup helpers
|
||||
fn lookup_path_strict(e: &env, sc: &scopes, sp: &span, pth: &ast::path_,
|
||||
ns: namespace) -> option::t[def] {
|
||||
ns: namespace) -> option::t<def> {
|
||||
let n_idents = vec::len(pth.idents);
|
||||
let headns = if n_idents == 1u { ns } else { ns_module };
|
||||
|
||||
|
|
@ -596,7 +596,7 @@ fn lookup_path_strict(e: &env, sc: &scopes, sp: &span, pth: &ast::path_,
|
|||
}
|
||||
|
||||
fn lookup_in_scope_strict(e: &env, sc: scopes, sp: &span, name: &ident,
|
||||
ns: namespace) -> option::t[def] {
|
||||
ns: namespace) -> option::t<def> {
|
||||
alt lookup_in_scope(e, sc, sp, name, ns) {
|
||||
none. { unresolved_err(e, sc, sp, name, ns_name(ns)); ret none; }
|
||||
some(d) { ret some(d); }
|
||||
|
|
@ -629,9 +629,9 @@ fn def_is_ty_arg(d: &def) -> bool {
|
|||
}
|
||||
|
||||
fn lookup_in_scope(e: &env, sc: scopes, sp: &span, name: &ident,
|
||||
ns: namespace) -> option::t[def] {
|
||||
ns: namespace) -> option::t<def> {
|
||||
fn in_scope(e: &env, sp: &span, name: &ident, s: &scope, ns: namespace) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
alt s {
|
||||
scope_crate. {
|
||||
ret lookup_in_local_mod(e, -1, sp, name, ns, inside);
|
||||
|
|
@ -728,7 +728,7 @@ fn lookup_in_scope(e: &env, sc: scopes, sp: &span, name: &ident,
|
|||
}
|
||||
|
||||
fn lookup_in_ty_params(name: &ident, ty_params: &[ast::ty_param]) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
let i = 0u;
|
||||
for tp: ast::ty_param in ty_params {
|
||||
if str::eq(tp.ident, name) { ret some(ast::def_ty_arg(i,tp.kind)); }
|
||||
|
|
@ -737,7 +737,7 @@ fn lookup_in_ty_params(name: &ident, ty_params: &[ast::ty_param]) ->
|
|||
ret none[def];
|
||||
}
|
||||
|
||||
fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t[def_id] {
|
||||
fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t<def_id> {
|
||||
let found = none;
|
||||
for each bound in ast::pat_bindings(pat) {
|
||||
let p_name = alt bound.node { ast::pat_bind(n) { n } };
|
||||
|
|
@ -750,7 +750,7 @@ fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t[def_id] {
|
|||
|
||||
fn lookup_in_fn(name: &ident, decl: &ast::fn_decl,
|
||||
ty_params: &[ast::ty_param], ns: namespace) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
alt ns {
|
||||
ns_value. {
|
||||
for a: ast::arg in decl.inputs {
|
||||
|
|
@ -766,7 +766,7 @@ fn lookup_in_fn(name: &ident, decl: &ast::fn_decl,
|
|||
}
|
||||
|
||||
fn lookup_in_obj(name: &ident, ob: &ast::_obj, ty_params: &[ast::ty_param],
|
||||
ns: namespace) -> option::t[def] {
|
||||
ns: namespace) -> option::t<def> {
|
||||
alt ns {
|
||||
ns_value. {
|
||||
for f: ast::obj_field in ob.fields {
|
||||
|
|
@ -782,7 +782,7 @@ fn lookup_in_obj(name: &ident, ob: &ast::_obj, ty_params: &[ast::ty_param],
|
|||
}
|
||||
|
||||
fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint,
|
||||
ns: namespace) -> option::t[def] {
|
||||
ns: namespace) -> option::t<def> {
|
||||
let i = vec::len(b.stmts);
|
||||
while i > 0u {
|
||||
i -= 1u;
|
||||
|
|
@ -838,7 +838,7 @@ fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint,
|
|||
ret none[def];
|
||||
}
|
||||
|
||||
fn found_def_item(i: &@ast::item, ns: namespace) -> option::t[def] {
|
||||
fn found_def_item(i: &@ast::item, ns: namespace) -> option::t<def> {
|
||||
alt i.node {
|
||||
ast::item_const(_, _) {
|
||||
if ns == ns_value { ret some(ast::def_const(local_def(i.id))); }
|
||||
|
|
@ -884,7 +884,7 @@ fn found_def_item(i: &@ast::item, ns: namespace) -> option::t[def] {
|
|||
}
|
||||
|
||||
fn lookup_in_mod_strict(e: &env, sc: &scopes, m: def, sp: &span, name: &ident,
|
||||
ns: namespace, dr: dir) -> option::t[def] {
|
||||
ns: namespace, dr: dir) -> option::t<def> {
|
||||
alt lookup_in_mod(e, m, sp, name, ns, dr) {
|
||||
none. { unresolved_err(e, sc, sp, name, ns_name(ns)); ret none; }
|
||||
some(d) { ret some(d); }
|
||||
|
|
@ -892,7 +892,7 @@ fn lookup_in_mod_strict(e: &env, sc: &scopes, m: def, sp: &span, name: &ident,
|
|||
}
|
||||
|
||||
fn lookup_in_mod(e: &env, m: &def, sp: &span, name: &ident, ns: namespace,
|
||||
dr: dir) -> option::t[def] {
|
||||
dr: dir) -> option::t<def> {
|
||||
let defid = ast::def_id_of_def(m);
|
||||
if defid.crate != ast::local_crate {
|
||||
// examining a module in an external crate
|
||||
|
|
@ -919,7 +919,7 @@ fn lookup_in_mod(e: &env, m: &def, sp: &span, name: &ident, ns: namespace,
|
|||
}
|
||||
|
||||
fn found_view_item(e: &env, vi: @ast::view_item, ns: namespace) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
alt vi.node {
|
||||
ast::view_item_use(_, _, id) {
|
||||
let cnum = cstore::get_use_stmt_cnum(e.cstore, id);
|
||||
|
|
@ -935,7 +935,7 @@ fn found_view_item(e: &env, vi: @ast::view_item, ns: namespace) ->
|
|||
}
|
||||
}
|
||||
|
||||
fn lookup_import(e: &env, defid: def_id, ns: namespace) -> option::t[def] {
|
||||
fn lookup_import(e: &env, defid: def_id, ns: namespace) -> option::t<def> {
|
||||
alt e.imports.get(defid.node) {
|
||||
todo(item, sc) {
|
||||
resolve_import(e, item, sc);
|
||||
|
|
@ -949,12 +949,12 @@ fn lookup_import(e: &env, defid: def_id, ns: namespace) -> option::t[def] {
|
|||
}
|
||||
|
||||
fn lookup_in_local_native_mod(e: &env, node_id: node_id, sp: &span,
|
||||
id: &ident, ns: namespace) -> option::t[def] {
|
||||
id: &ident, ns: namespace) -> option::t<def> {
|
||||
ret lookup_in_local_mod(e, node_id, sp, id, ns, inside);
|
||||
}
|
||||
|
||||
fn lookup_in_local_mod(e: &env, node_id: node_id, sp: &span, id: &ident,
|
||||
ns: namespace, dr: dir) -> option::t[def] {
|
||||
ns: namespace, dr: dir) -> option::t<def> {
|
||||
let info = e.mod_map.get(node_id);
|
||||
if dr == outside && !ast::is_exported(id, option::get(info.m)) {
|
||||
// if we're in a native mod, then dr==inside, so info.m is some _mod
|
||||
|
|
@ -984,13 +984,13 @@ fn lookup_in_local_mod(e: &env, node_id: node_id, sp: &span, id: &ident,
|
|||
}
|
||||
|
||||
fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident,
|
||||
wanted_ns: namespace, dr: dir) -> option::t[def] {
|
||||
wanted_ns: namespace, dr: dir) -> option::t<def> {
|
||||
fn per_ns(e: &env, info: @indexed_mod, sp: &span, id: &ident,
|
||||
ns: namespace, dr: dir) -> option::t[def] {
|
||||
ns: namespace, dr: dir) -> option::t<def> {
|
||||
|
||||
fn lookup_in_mod_(e: &env, def: &glob_imp_def, sp: &span,
|
||||
name: &ident, ns: namespace, dr: dir) ->
|
||||
option::t[glob_imp_def] {
|
||||
option::t<glob_imp_def> {
|
||||
alt lookup_in_mod(e, def.def, sp, name, ns, dr) {
|
||||
option::some(d) { option::some({def: d, item: def.item}) }
|
||||
option::none. { option::none }
|
||||
|
|
@ -1041,7 +1041,7 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident,
|
|||
}
|
||||
|
||||
fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
alt mie {
|
||||
mie_view_item(view_item) { ret found_view_item(e, view_item, ns); }
|
||||
mie_item(item) { ret found_def_item(item, ns); }
|
||||
|
|
@ -1077,7 +1077,7 @@ fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) ->
|
|||
|
||||
|
||||
// Module indexing
|
||||
fn add_to_index(index: &hashmap[ident, list[mod_index_entry]], id: &ident,
|
||||
fn add_to_index(index: &hashmap<ident, list<mod_index_entry>>, id: &ident,
|
||||
ent: &mod_index_entry) {
|
||||
alt index.find(id) {
|
||||
none. { index.insert(id, cons(ent, @nil[mod_index_entry])); }
|
||||
|
|
@ -1086,7 +1086,7 @@ fn add_to_index(index: &hashmap[ident, list[mod_index_entry]], id: &ident,
|
|||
}
|
||||
|
||||
fn index_mod(md: &ast::_mod) -> mod_index {
|
||||
let index = new_str_hash[list[mod_index_entry]]();
|
||||
let index = new_str_hash[list<mod_index_entry>]();
|
||||
for it: @ast::view_item in md.view_items {
|
||||
alt it.node {
|
||||
ast::view_item_import(ident, _, _) | ast::view_item_use(ident, _, _)
|
||||
|
|
@ -1121,7 +1121,7 @@ fn index_mod(md: &ast::_mod) -> mod_index {
|
|||
}
|
||||
|
||||
fn index_nmod(md: &ast::native_mod) -> mod_index {
|
||||
let index = new_str_hash[list[mod_index_entry]]();
|
||||
let index = new_str_hash[list<mod_index_entry>]();
|
||||
for it: @ast::view_item in md.view_items {
|
||||
alt it.node {
|
||||
ast::view_item_use(ident, _, _) | ast::view_item_import(ident, _, _)
|
||||
|
|
@ -1158,7 +1158,7 @@ fn ns_for_def(d: def) -> namespace {
|
|||
}
|
||||
|
||||
fn lookup_external(e: &env, cnum: int, ids: &[ident], ns: namespace) ->
|
||||
option::t[def] {
|
||||
option::t<def> {
|
||||
for d: def in csearch::lookup_defs(e.sess.get_cstore(), cnum, ids) {
|
||||
e.ext_map.insert(ast::def_id_of_def(d), ids);
|
||||
if ns == ns_for_def(d) { ret some(d); }
|
||||
|
|
@ -1173,7 +1173,7 @@ fn check_for_collisions(e: &@env, c: &ast::crate) {
|
|||
// name for multiple entities in the same namespace.
|
||||
for each m: @{key: ast::node_id, val: @indexed_mod}
|
||||
in e.mod_map.items() {
|
||||
for each name: @{key: ident, val: list[mod_index_entry]}
|
||||
for each name: @{key: ident, val: list<mod_index_entry>}
|
||||
in m.val.index.items() {
|
||||
check_mod_name(*e, name.key, name.val);
|
||||
}
|
||||
|
|
@ -1188,7 +1188,7 @@ fn check_for_collisions(e: &@env, c: &ast::crate) {
|
|||
visit::visit_crate(c, (), visit::mk_vt(v));
|
||||
}
|
||||
|
||||
fn check_mod_name(e: &env, name: &ident, entries: list[mod_index_entry]) {
|
||||
fn check_mod_name(e: &env, name: &ident, entries: list<mod_index_entry>) {
|
||||
let saw_mod = false;
|
||||
let saw_type = false;
|
||||
let saw_value = false;
|
||||
|
|
@ -1229,7 +1229,7 @@ fn mie_span(mie: &mod_index_entry) -> span {
|
|||
};
|
||||
}
|
||||
|
||||
fn check_item(e: &@env, i: &@ast::item, x: &(), v: &vt[()]) {
|
||||
fn check_item(e: &@env, i: &@ast::item, x: &(), v: &vt<()>) {
|
||||
fn typaram_names(tps: &[ast::ty_param]) -> [ident] {
|
||||
let x: [ast::ident] = ~[];
|
||||
for tp: ast::ty_param in tps { x += ~[tp.ident] }
|
||||
|
|
@ -1266,7 +1266,7 @@ fn check_pat(ch: checker, p: &@ast::pat) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt[()]) {
|
||||
fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt<()>) {
|
||||
visit::visit_arm(a, x, v);
|
||||
let ch0 = checker(*e, "binding");
|
||||
check_pat(ch0, a.pats.(0));
|
||||
|
|
@ -1296,7 +1296,7 @@ fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt[()]) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_block(e: &@env, b: &ast::blk, x: &(), v: &vt[()]) {
|
||||
fn check_block(e: &@env, b: &ast::blk, x: &(), v: &vt<()>) {
|
||||
visit::visit_block(b, x, v);
|
||||
let values = checker(*e, "value");
|
||||
let types = checker(*e, "type");
|
||||
|
|
@ -1349,7 +1349,7 @@ fn check_fn(e: &env, sp: &span, f: &ast::_fn) {
|
|||
ensure_unique(e, sp, f.decl.inputs, arg_name, "argument");
|
||||
}
|
||||
|
||||
fn check_expr(e: &@env, ex: &@ast::expr, x: &(), v: &vt[()]) {
|
||||
fn check_expr(e: &@env, ex: &@ast::expr, x: &(), v: &vt<()>) {
|
||||
alt ex.node {
|
||||
ast::expr_rec(fields, _) {
|
||||
fn field_name(f: &ast::field) -> ident { ret f.node.ident; }
|
||||
|
|
@ -1360,7 +1360,7 @@ fn check_expr(e: &@env, ex: &@ast::expr, x: &(), v: &vt[()]) {
|
|||
visit::visit_expr(ex, x, v);
|
||||
}
|
||||
|
||||
fn check_ty(e: &@env, ty: &@ast::ty, x: &(), v: &vt[()]) {
|
||||
fn check_ty(e: &@env, ty: &@ast::ty, x: &(), v: &vt<()>) {
|
||||
alt ty.node {
|
||||
ast::ty_rec(fields) {
|
||||
fn field_name(f: &ast::ty_field) -> ident { ret f.node.ident; }
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ type res_info = { did: ast::def_id, t: ty::t };
|
|||
type ctxt = {
|
||||
mutable next_tag_id: u16,
|
||||
pad: u16,
|
||||
tag_id_to_index: hashmap[ast::def_id,u16],
|
||||
tag_id_to_index: hashmap<ast::def_id,u16>,
|
||||
mutable tag_order: [ast::def_id],
|
||||
resources: interner::interner[res_info],
|
||||
resources: interner::interner<res_info>,
|
||||
llshapetablesty: TypeRef,
|
||||
llshapetables: ValueRef
|
||||
};
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ fn decl_glue(llmod: ModuleRef, cx: &crate_ctxt, s: &str) -> ValueRef {
|
|||
ret decl_cdecl_fn(llmod, s, T_fn(~[T_taskptr(cx)], T_void()));
|
||||
}
|
||||
|
||||
fn get_extern_fn(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
||||
fn get_extern_fn(externs: &hashmap<str, ValueRef>, llmod: ModuleRef,
|
||||
name: &str, cc: uint, ty: TypeRef) -> ValueRef {
|
||||
if externs.contains_key(name) { ret externs.get(name); }
|
||||
let f = decl_fn(llmod, name, cc, ty);
|
||||
|
|
@ -369,7 +369,7 @@ fn get_extern_fn(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
|||
ret f;
|
||||
}
|
||||
|
||||
fn get_extern_const(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
||||
fn get_extern_const(externs: &hashmap<str, ValueRef>, llmod: ModuleRef,
|
||||
name: &str, ty: TypeRef) -> ValueRef {
|
||||
if externs.contains_key(name) { ret externs.get(name); }
|
||||
let c = llvm::LLVMAddGlobal(llmod, ty, str::buf(name));
|
||||
|
|
@ -377,7 +377,7 @@ fn get_extern_const(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
|||
ret c;
|
||||
}
|
||||
|
||||
fn get_simple_extern_fn(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
||||
fn get_simple_extern_fn(externs: &hashmap<str, ValueRef>, llmod: ModuleRef,
|
||||
name: &str, n_args: int) -> ValueRef {
|
||||
let inputs = std::vec::init_elt[TypeRef](T_int(), n_args as uint);
|
||||
let output = T_int();
|
||||
|
|
@ -386,7 +386,7 @@ fn get_simple_extern_fn(externs: &hashmap[str, ValueRef], llmod: ModuleRef,
|
|||
}
|
||||
|
||||
fn trans_native_call(b: &builder, glues: @glue_fns, lltaskptr: ValueRef,
|
||||
externs: &hashmap[str, ValueRef], tn: &type_names,
|
||||
externs: &hashmap<str, ValueRef>, tn: &type_names,
|
||||
llmod: ModuleRef, name: &str, pass_task: bool,
|
||||
args: &[ValueRef]) -> ValueRef {
|
||||
let n: int = std::vec::len[ValueRef](args) as int;
|
||||
|
|
@ -939,7 +939,7 @@ fn trans_stack_local_derived_tydesc(cx: &@block_ctxt, llsz: ValueRef,
|
|||
}
|
||||
|
||||
fn get_derived_tydesc(cx: &@block_ctxt, t: &ty::t, escapes: bool,
|
||||
static_ti: &mutable option::t[@tydesc_info]) -> result {
|
||||
static_ti: &mutable option::t<@tydesc_info>) -> result {
|
||||
alt cx.fcx.derived_tydescs.find(t) {
|
||||
some(info) {
|
||||
|
||||
|
|
@ -1007,7 +1007,7 @@ fn get_derived_tydesc(cx: &@block_ctxt, t: &ty::t, escapes: bool,
|
|||
}
|
||||
|
||||
fn get_tydesc(cx: &@block_ctxt, orig_t: &ty::t, escapes: bool,
|
||||
static_ti: &mutable option::t[@tydesc_info]) -> result {
|
||||
static_ti: &mutable option::t<@tydesc_info>) -> result {
|
||||
|
||||
let t = ty::strip_cname(bcx_tcx(cx), orig_t);
|
||||
|
||||
|
|
@ -1470,7 +1470,7 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: &ast::def_id,
|
|||
~[C_int(0), C_int(abi::fn_field_box)]));
|
||||
let args = ~[cx.fcx.llretptr, cx.fcx.lltaskptr, dtor_env];
|
||||
for tp: ty::t in tps {
|
||||
let ti: option::t[@tydesc_info] = none;
|
||||
let ti: option::t<@tydesc_info> = none;
|
||||
let td = get_tydesc(cx, tp, false, ti);
|
||||
args += ~[td.val];
|
||||
cx = td.bcx;
|
||||
|
|
@ -1983,7 +1983,7 @@ fn iter_sequence(cx: @block_ctxt, v: ValueRef, t: &ty::t, f: &val_and_ty_fn)
|
|||
}
|
||||
|
||||
fn lazily_emit_all_tydesc_glue(cx: &@block_ctxt,
|
||||
static_ti: &option::t[@tydesc_info]) {
|
||||
static_ti: &option::t<@tydesc_info>) {
|
||||
lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(cx, abi::tydesc_field_free_glue, static_ti);
|
||||
|
|
@ -1992,13 +1992,13 @@ fn lazily_emit_all_tydesc_glue(cx: &@block_ctxt,
|
|||
|
||||
fn lazily_emit_all_generic_info_tydesc_glues(cx: &@block_ctxt,
|
||||
gi: &generic_info) {
|
||||
for ti: option::t[@tydesc_info] in gi.static_tis {
|
||||
for ti: option::t<@tydesc_info> in gi.static_tis {
|
||||
lazily_emit_all_tydesc_glue(cx, ti);
|
||||
}
|
||||
}
|
||||
|
||||
fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int,
|
||||
static_ti: &option::t[@tydesc_info]) {
|
||||
static_ti: &option::t<@tydesc_info>) {
|
||||
alt static_ti {
|
||||
none. { }
|
||||
some(ti) {
|
||||
|
|
@ -2073,7 +2073,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int,
|
|||
}
|
||||
|
||||
fn call_tydesc_glue_full(cx: &@block_ctxt, v: ValueRef, tydesc: ValueRef,
|
||||
field: int, static_ti: &option::t[@tydesc_info]) {
|
||||
field: int, static_ti: &option::t<@tydesc_info>) {
|
||||
lazily_emit_tydesc_glue(cx, field, static_ti);
|
||||
|
||||
let static_glue_fn = none;
|
||||
|
|
@ -2114,7 +2114,7 @@ fn call_tydesc_glue_full(cx: &@block_ctxt, v: ValueRef, tydesc: ValueRef,
|
|||
|
||||
fn call_tydesc_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t, field: int) ->
|
||||
result {
|
||||
let ti: option::t[@tydesc_info] = none[@tydesc_info];
|
||||
let ti: option::t<@tydesc_info> = none[@tydesc_info];
|
||||
let td = get_tydesc(cx, t, false, ti);
|
||||
call_tydesc_glue_full(td.bcx, spill_if_immediate(td.bcx, v, t), td.val,
|
||||
field, ti);
|
||||
|
|
@ -3376,7 +3376,7 @@ fn join_branches(parent_cx: &@block_ctxt, ins: &[result]) -> @block_ctxt {
|
|||
tag out_method { return; save_in(ValueRef); }
|
||||
|
||||
fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk,
|
||||
els: &option::t[@ast::expr], id: ast::node_id,
|
||||
els: &option::t<@ast::expr>, id: ast::node_id,
|
||||
output: &out_method) -> result {
|
||||
let cond_res = trans_expr(cx, cond);
|
||||
|
||||
|
|
@ -3778,15 +3778,15 @@ fn trans_do_while(cx: &@block_ctxt, body: &ast::blk, cond: &@ast::expr) ->
|
|||
|
||||
type generic_info =
|
||||
{item_type: ty::t,
|
||||
static_tis: [option::t[@tydesc_info]],
|
||||
static_tis: [option::t<@tydesc_info>],
|
||||
tydescs: [ValueRef]};
|
||||
|
||||
type lval_result =
|
||||
{res: result,
|
||||
is_mem: bool,
|
||||
generic: option::t[generic_info],
|
||||
llobj: option::t[ValueRef],
|
||||
method_ty: option::t[ty::t]};
|
||||
generic: option::t<generic_info>,
|
||||
llobj: option::t<ValueRef>,
|
||||
method_ty: option::t<ty::t>};
|
||||
|
||||
fn lval_mem(cx: &@block_ctxt, val: ValueRef) -> lval_result {
|
||||
ret {res: rslt(cx, val),
|
||||
|
|
@ -3827,7 +3827,7 @@ fn lval_generic_fn(cx: &@block_ctxt, tpt: &ty::ty_param_kinds_and_ty,
|
|||
if std::vec::len[ty::t](tys) != 0u {
|
||||
let bcx = lv.res.bcx;
|
||||
let tydescs: [ValueRef] = ~[];
|
||||
let tis: [option::t[@tydesc_info]] = ~[];
|
||||
let tis: [option::t<@tydesc_info>] = ~[];
|
||||
for t: ty::t in tys {
|
||||
// TODO: Doesn't always escape.
|
||||
|
||||
|
|
@ -4213,10 +4213,10 @@ fn trans_cast(cx: &@block_ctxt, e: &@ast::expr, id: ast::node_id) -> result {
|
|||
}
|
||||
|
||||
fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
|
||||
outgoing_fty: &ty::t, args: &[option::t[@ast::expr]],
|
||||
outgoing_fty: &ty::t, args: &[option::t<@ast::expr>],
|
||||
env_ty: &ty::t, bound_tys: &[ty::t],
|
||||
ty_param_count: uint,
|
||||
target_fn: &option::t[ValueRef]) ->
|
||||
target_fn: &option::t<ValueRef>) ->
|
||||
{val: ValueRef, ty: TypeRef} {
|
||||
|
||||
// Here we're not necessarily constructing a thunk in the sense of
|
||||
|
|
@ -4330,7 +4330,7 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
|
|||
let outgoing_arg_index: uint = 0u;
|
||||
let llout_arg_tys: [TypeRef] =
|
||||
type_of_explicit_args(cx.ccx, sp, outgoing_args);
|
||||
for arg: option::t[@ast::expr] in args {
|
||||
for arg: option::t<@ast::expr> in args {
|
||||
let out_arg = outgoing_args.(outgoing_arg_index);
|
||||
let llout_arg_ty = llout_arg_tys.(outgoing_arg_index);
|
||||
let is_val = out_arg.mode == ty::mo_val;
|
||||
|
|
@ -4405,16 +4405,16 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
|
|||
}
|
||||
|
||||
fn trans_bind(cx: &@block_ctxt, f: &@ast::expr,
|
||||
args: &[option::t[@ast::expr]], id: ast::node_id) -> result {
|
||||
args: &[option::t<@ast::expr>], id: ast::node_id) -> result {
|
||||
let f_res = trans_lval_gen(cx, f);
|
||||
ret trans_bind_1(cx, f, f_res, args, id);
|
||||
}
|
||||
|
||||
fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result,
|
||||
args: &[option::t[@ast::expr]], id: ast::node_id) ->
|
||||
args: &[option::t<@ast::expr>], id: ast::node_id) ->
|
||||
result {
|
||||
let bound: [@ast::expr] = ~[];
|
||||
for argopt: option::t[@ast::expr] in args {
|
||||
for argopt: option::t<@ast::expr> in args {
|
||||
alt argopt { none. { } some(e) { bound += ~[e]; } }
|
||||
}
|
||||
|
||||
|
|
@ -4561,7 +4561,7 @@ fn trans_arg_expr(cx: &@block_ctxt, arg: &ty::arg,
|
|||
// - new_fn_ctxt
|
||||
// - trans_args
|
||||
fn trans_args(cx: &@block_ctxt, llenv: ValueRef,
|
||||
gen: &option::t[generic_info], lliterbody: &option::t[ValueRef],
|
||||
gen: &option::t<generic_info>, lliterbody: &option::t<ValueRef>,
|
||||
es: &[@ast::expr], fn_ty: &ty::t) ->
|
||||
{bcx: @block_ctxt,
|
||||
args: [ValueRef],
|
||||
|
|
@ -4645,7 +4645,7 @@ fn trans_args(cx: &@block_ctxt, llenv: ValueRef,
|
|||
}
|
||||
|
||||
fn trans_call(cx: &@block_ctxt, f: &@ast::expr,
|
||||
lliterbody: &option::t[ValueRef], args: &[@ast::expr],
|
||||
lliterbody: &option::t<ValueRef>, args: &[@ast::expr],
|
||||
id: ast::node_id) -> result {
|
||||
// NB: 'f' isn't necessarily a function; it might be an entire self-call
|
||||
// expression because of the hack that allows us to process self-calls
|
||||
|
|
@ -4910,7 +4910,7 @@ fn trans_ivec(bcx: @block_ctxt, args: &[@ast::expr], id: ast::node_id) ->
|
|||
}
|
||||
|
||||
fn trans_rec(cx: &@block_ctxt, fields: &[ast::field],
|
||||
base: &option::t[@ast::expr], id: ast::node_id) -> result {
|
||||
base: &option::t<@ast::expr>, id: ast::node_id) -> result {
|
||||
let bcx = cx;
|
||||
let t = node_id_type(bcx_ccx(bcx), id);
|
||||
let rec_res = alloc_ty(bcx, t);
|
||||
|
|
@ -5263,8 +5263,8 @@ fn trans_check_expr(cx: &@block_ctxt, e: &@ast::expr, s: &str) -> result {
|
|||
ret rslt(next_cx, C_nil());
|
||||
}
|
||||
|
||||
fn trans_fail_expr(cx: &@block_ctxt, sp_opt: &option::t[span],
|
||||
fail_expr: &option::t[@ast::expr]) -> result {
|
||||
fn trans_fail_expr(cx: &@block_ctxt, sp_opt: &option::t<span>,
|
||||
fail_expr: &option::t<@ast::expr>) -> result {
|
||||
let bcx = cx;
|
||||
alt fail_expr {
|
||||
some(expr) {
|
||||
|
|
@ -5290,13 +5290,13 @@ fn trans_fail_expr(cx: &@block_ctxt, sp_opt: &option::t[span],
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_fail(cx: &@block_ctxt, sp_opt: &option::t[span], fail_str: &str) ->
|
||||
fn trans_fail(cx: &@block_ctxt, sp_opt: &option::t<span>, fail_str: &str) ->
|
||||
result {
|
||||
let V_fail_str = C_cstr(bcx_ccx(cx), fail_str);
|
||||
ret trans_fail_value(cx, sp_opt, V_fail_str);
|
||||
}
|
||||
|
||||
fn trans_fail_value(cx: &@block_ctxt, sp_opt: &option::t[span],
|
||||
fn trans_fail_value(cx: &@block_ctxt, sp_opt: &option::t<span>,
|
||||
V_fail_str: &ValueRef) -> result {
|
||||
let V_filename;
|
||||
let V_line;
|
||||
|
|
@ -5316,7 +5316,7 @@ fn trans_fail_value(cx: &@block_ctxt, sp_opt: &option::t[span],
|
|||
ret rslt(cx, C_nil());
|
||||
}
|
||||
|
||||
fn trans_put(cx: &@block_ctxt, e: &option::t[@ast::expr]) -> result {
|
||||
fn trans_put(cx: &@block_ctxt, e: &option::t<@ast::expr>) -> result {
|
||||
let llcallee = C_nil();
|
||||
let llenv = C_nil();
|
||||
alt { cx.fcx.lliterbody } {
|
||||
|
|
@ -5415,7 +5415,7 @@ fn trans_cont(sp: &span, cx: &@block_ctxt) -> result {
|
|||
ret trans_break_cont(sp, cx, false);
|
||||
}
|
||||
|
||||
fn trans_ret(cx: &@block_ctxt, e: &option::t[@ast::expr]) -> result {
|
||||
fn trans_ret(cx: &@block_ctxt, e: &option::t<@ast::expr>) -> result {
|
||||
let bcx = cx;
|
||||
alt e {
|
||||
some(x) {
|
||||
|
|
@ -5552,7 +5552,7 @@ fn new_scope_block_ctxt(bcx: &@block_ctxt, n: &str) -> @block_ctxt {
|
|||
}
|
||||
|
||||
fn new_loop_scope_block_ctxt(bcx: &@block_ctxt,
|
||||
_cont: &option::t[@block_ctxt],
|
||||
_cont: &option::t<@block_ctxt>,
|
||||
_break: &@block_ctxt, n: &str) -> @block_ctxt {
|
||||
ret new_block_ctxt(bcx.fcx, parent_some(bcx),
|
||||
LOOP_SCOPE_BLOCK(_cont, _break), n);
|
||||
|
|
@ -5788,11 +5788,11 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: &span, llfndecl: ValueRef,
|
|||
let llretptr: ValueRef = llvm::LLVMGetParam(llfndecl, 0u);
|
||||
let lltaskptr: ValueRef = llvm::LLVMGetParam(llfndecl, 1u);
|
||||
let llenv: ValueRef = llvm::LLVMGetParam(llfndecl, 2u);
|
||||
let llargs: hashmap[ast::node_id, ValueRef] = new_int_hash[ValueRef]();
|
||||
let llobjfields: hashmap[ast::node_id, ValueRef] =
|
||||
let llargs: hashmap<ast::node_id, ValueRef> = new_int_hash[ValueRef]();
|
||||
let llobjfields: hashmap<ast::node_id, ValueRef> =
|
||||
new_int_hash[ValueRef]();
|
||||
let lllocals: hashmap[ast::node_id, ValueRef] = new_int_hash[ValueRef]();
|
||||
let llupvars: hashmap[ast::node_id, ValueRef] = new_int_hash[ValueRef]();
|
||||
let lllocals: hashmap<ast::node_id, ValueRef> = new_int_hash[ValueRef]();
|
||||
let llupvars: hashmap<ast::node_id, ValueRef> = new_int_hash[ValueRef]();
|
||||
let derived_tydescs =
|
||||
map::mk_hashmap[ty::t, derived_tydesc_info](ty::hash_ty, ty::eq_ty);
|
||||
let llbbs = mk_standard_basic_blocks(llfndecl);
|
||||
|
|
@ -5838,7 +5838,7 @@ fn new_fn_ctxt(cx: @local_ctxt, sp: &span, llfndecl: ValueRef) -> @fn_ctxt {
|
|||
// the function's fn_ctxt). create_llargs_for_fn_args populates the llargs
|
||||
// field of the fn_ctxt with
|
||||
fn create_llargs_for_fn_args(cx: &@fn_ctxt, proto: ast::proto,
|
||||
ty_self: option::t[ty::t], ret_ty: ty::t,
|
||||
ty_self: option::t<ty::t>, ret_ty: ty::t,
|
||||
args: &[ast::arg], ty_params: &[ast::ty_param]) {
|
||||
// Skip the implicit arguments 0, 1, and 2. TODO: Pull out 3u and define
|
||||
// it as a constant, since we're using it in several places in trans this
|
||||
|
|
@ -5997,11 +5997,11 @@ fn finish_fn(fcx: &@fn_ctxt, lltop: BasicBlockRef) {
|
|||
// trans_closure: Builds an LLVM function out of a source function.
|
||||
// If the function closes over its environment a closure will be
|
||||
// returned.
|
||||
fn trans_closure(bcx_maybe: &option::t[@block_ctxt],
|
||||
llfnty: &option::t[TypeRef], cx: @local_ctxt, sp: &span,
|
||||
f: &ast::_fn, llfndecl: ValueRef, ty_self: option::t[ty::t],
|
||||
fn trans_closure(bcx_maybe: &option::t<@block_ctxt>,
|
||||
llfnty: &option::t<TypeRef>, cx: @local_ctxt, sp: &span,
|
||||
f: &ast::_fn, llfndecl: ValueRef, ty_self: option::t<ty::t>,
|
||||
ty_params: &[ast::ty_param], id: ast::node_id)
|
||||
-> option::t[{fn_pair: ValueRef, bcx: @block_ctxt}] {
|
||||
-> option::t<{fn_pair: ValueRef, bcx: @block_ctxt}> {
|
||||
set_uwtable(llfndecl);
|
||||
|
||||
// Set up arguments to the function.
|
||||
|
|
@ -6068,7 +6068,7 @@ fn trans_closure(bcx_maybe: &option::t[@block_ctxt],
|
|||
}
|
||||
|
||||
fn trans_fn_inner(cx: @local_ctxt, sp: &span, f: &ast::_fn,
|
||||
llfndecl: ValueRef, ty_self: option::t[ty::t],
|
||||
llfndecl: ValueRef, ty_self: option::t<ty::t>,
|
||||
ty_params: &[ast::ty_param], id: ast::node_id) {
|
||||
trans_closure(none, none, cx, sp, f, llfndecl, ty_self, ty_params, id);
|
||||
}
|
||||
|
|
@ -6077,7 +6077,7 @@ fn trans_fn_inner(cx: @local_ctxt, sp: &span, f: &ast::_fn,
|
|||
// trans_fn: creates an LLVM function corresponding to a source language
|
||||
// function.
|
||||
fn trans_fn(cx: @local_ctxt, sp: &span, f: &ast::_fn, llfndecl: ValueRef,
|
||||
ty_self: option::t[ty::t], ty_params: &[ast::ty_param],
|
||||
ty_self: option::t<ty::t>, ty_params: &[ast::ty_param],
|
||||
id: ast::node_id) {
|
||||
if !cx.ccx.sess.get_opts().stats {
|
||||
trans_fn_inner(cx, sp, f, llfndecl, ty_self, ty_params, id);
|
||||
|
|
@ -6747,7 +6747,7 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str],
|
|||
fn item_path(item: &@ast::item) -> [str] { ret ~[item.ident]; }
|
||||
|
||||
fn collect_native_item(ccx: @crate_ctxt, i: &@ast::native_item, pt: &[str],
|
||||
v: &vt[[str]]) {
|
||||
v: &vt<[str]>) {
|
||||
alt i.node {
|
||||
ast::native_item_fn(_, _, _) {
|
||||
if !ccx.obj_methods.contains_key(i.id) {
|
||||
|
|
@ -6759,7 +6759,7 @@ fn collect_native_item(ccx: @crate_ctxt, i: &@ast::native_item, pt: &[str],
|
|||
}
|
||||
|
||||
fn collect_item_1(ccx: @crate_ctxt, i: &@ast::item, pt: &[str],
|
||||
v: &vt[[str]]) {
|
||||
v: &vt<[str]>) {
|
||||
visit::visit_item(i, pt + item_path(i), v);
|
||||
alt i.node {
|
||||
ast::item_const(_, _) {
|
||||
|
|
@ -6778,7 +6778,7 @@ fn collect_item_1(ccx: @crate_ctxt, i: &@ast::item, pt: &[str],
|
|||
}
|
||||
|
||||
fn collect_item_2(ccx: &@crate_ctxt, i: &@ast::item, pt: &[str],
|
||||
v: &vt[[str]]) {
|
||||
v: &vt<[str]>) {
|
||||
let new_pt = pt + item_path(i);
|
||||
visit::visit_item(i, new_pt, v);
|
||||
alt i.node {
|
||||
|
|
@ -6818,7 +6818,7 @@ fn collect_items(ccx: &@crate_ctxt, crate: @ast::crate) {
|
|||
}
|
||||
|
||||
fn collect_tag_ctor(ccx: @crate_ctxt, i: &@ast::item, pt: &[str],
|
||||
v: &vt[[str]]) {
|
||||
v: &vt<[str]>) {
|
||||
let new_pt = pt + item_path(i);
|
||||
visit::visit_item(i, new_pt, v);
|
||||
alt i.node {
|
||||
|
|
@ -6844,7 +6844,7 @@ fn collect_tag_ctors(ccx: &@crate_ctxt, crate: @ast::crate) {
|
|||
|
||||
// The constant translation pass.
|
||||
fn trans_constant(ccx: @crate_ctxt, it: &@ast::item, pt: &[str],
|
||||
v: &vt[[str]]) {
|
||||
v: &vt<[str]>) {
|
||||
let new_pt = pt + item_path(it);
|
||||
visit::visit_item(it, new_pt, v);
|
||||
alt it.node {
|
||||
|
|
@ -6891,7 +6891,7 @@ fn i2p(v: ValueRef, t: TypeRef) -> ValueRef {
|
|||
ret llvm::LLVMConstIntToPtr(v, t);
|
||||
}
|
||||
|
||||
fn declare_intrinsics(llmod: ModuleRef) -> hashmap[str, ValueRef] {
|
||||
fn declare_intrinsics(llmod: ModuleRef) -> hashmap<str, ValueRef> {
|
||||
let T_memmove32_args: [TypeRef] =
|
||||
~[T_ptr(T_i8()), T_ptr(T_i8()), T_i32(), T_i32(), T_i1()];
|
||||
let T_memmove64_args: [TypeRef] =
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ fn bind_for_pat(p: &@ast::pat, br: &match_branch, val: ValueRef) {
|
|||
}
|
||||
}
|
||||
|
||||
type enter_pat = fn(&@ast::pat) -> option::t[[@ast::pat]] ;
|
||||
type enter_pat = fn(&@ast::pat) -> option::t<[@ast::pat]> ;
|
||||
|
||||
fn enter_match(m: &match, col: uint, val: ValueRef, e: &enter_pat) -> match {
|
||||
let result = ~[];
|
||||
|
|
@ -98,7 +98,7 @@ fn enter_match(m: &match, col: uint, val: ValueRef, e: &enter_pat) -> match {
|
|||
}
|
||||
|
||||
fn enter_default(m: &match, col: uint, val: ValueRef) -> match {
|
||||
fn e(p: &@ast::pat) -> option::t[[@ast::pat]] {
|
||||
fn e(p: &@ast::pat) -> option::t<[@ast::pat]> {
|
||||
ret if matches_always(p) { some(~[]) } else { none };
|
||||
}
|
||||
ret enter_match(m, col, val, e);
|
||||
|
|
@ -108,7 +108,7 @@ fn enter_opt(ccx: &@crate_ctxt, m: &match, opt: &opt, col: uint,
|
|||
tag_size: uint, val: ValueRef) -> match {
|
||||
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
|
||||
fn e(ccx: &@crate_ctxt, dummy: &@ast::pat, opt: &opt, size: uint,
|
||||
p: &@ast::pat) -> option::t[[@ast::pat]] {
|
||||
p: &@ast::pat) -> option::t<[@ast::pat]> {
|
||||
alt p.node {
|
||||
ast::pat_tag(ctor, subpats) {
|
||||
ret if opt_eq(variant_opt(ccx, p.id), opt) {
|
||||
|
|
@ -128,7 +128,7 @@ fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) ->
|
|||
match {
|
||||
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
|
||||
fn e(dummy: &@ast::pat, fields: &[ast::ident], p: &@ast::pat) ->
|
||||
option::t[[@ast::pat]] {
|
||||
option::t<[@ast::pat]> {
|
||||
alt p.node {
|
||||
ast::pat_rec(fpats, _) {
|
||||
let pats = ~[];
|
||||
|
|
@ -150,7 +150,7 @@ fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) ->
|
|||
fn enter_tup(m: &match, col: uint, val: ValueRef, n_elts: uint) -> match {
|
||||
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
|
||||
fn e(dummy: &@ast::pat, n_elts: uint, p: &@ast::pat)
|
||||
-> option::t[[@ast::pat]] {
|
||||
-> option::t<[@ast::pat]> {
|
||||
alt p.node {
|
||||
ast::pat_tup(elts) { ret some(elts); }
|
||||
_ { ret some(vec::init_elt(dummy, n_elts)); }
|
||||
|
|
@ -161,7 +161,7 @@ fn enter_tup(m: &match, col: uint, val: ValueRef, n_elts: uint) -> match {
|
|||
|
||||
fn enter_box(m: &match, col: uint, val: ValueRef) -> match {
|
||||
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
|
||||
fn e(dummy: &@ast::pat, p: &@ast::pat) -> option::t[[@ast::pat]] {
|
||||
fn e(dummy: &@ast::pat, p: &@ast::pat) -> option::t<[@ast::pat]> {
|
||||
alt p.node {
|
||||
ast::pat_box(sub) { ret some(~[sub]); }
|
||||
_ { ret some(~[dummy]); }
|
||||
|
|
@ -431,7 +431,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef],
|
|||
// Returns false for unreachable blocks
|
||||
fn make_phi_bindings(bcx: &@block_ctxt, map: &[exit_node],
|
||||
ids: &ast::pat_id_map) -> bool {
|
||||
fn assoc(key: str, list: &bind_map) -> option::t[ValueRef] {
|
||||
fn assoc(key: str, list: &bind_map) -> option::t<ValueRef> {
|
||||
for elt: {ident: ast::ident, val: ValueRef} in list {
|
||||
if str::eq(elt.ident, key) { ret some(elt.val); }
|
||||
}
|
||||
|
|
@ -486,7 +486,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm],
|
|||
// Cached fail-on-fallthrough block
|
||||
let fail_cx = @mutable none;
|
||||
fn mk_fail(cx: &@block_ctxt, sp: &span,
|
||||
done: @mutable option::t[BasicBlockRef]) -> BasicBlockRef {
|
||||
done: @mutable option::t<BasicBlockRef>) -> BasicBlockRef {
|
||||
alt *done { some(bb) { ret bb; } _ { } }
|
||||
let fail_cx = new_sub_block_ctxt(cx, "case_fallthrough");
|
||||
trans::trans_fail(fail_cx, some(sp), "non-exhaustive match failure");
|
||||
|
|
@ -517,7 +517,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm],
|
|||
|
||||
// Not alt-related, but similar to the pattern-munging code above
|
||||
fn bind_irrefutable_pat(bcx: @block_ctxt, pat: &@ast::pat, val: ValueRef,
|
||||
table: hashmap[ast::node_id, ValueRef],
|
||||
table: hashmap<ast::node_id, ValueRef>,
|
||||
make_copy: bool)
|
||||
-> @block_ctxt {
|
||||
let ccx = bcx.fcx.lcx.ccx;
|
||||
|
|
|
|||
|
|
@ -75,10 +75,10 @@ type tydesc_info =
|
|||
tydesc: ValueRef,
|
||||
size: ValueRef,
|
||||
align: ValueRef,
|
||||
mutable copy_glue: option::t[ValueRef],
|
||||
mutable drop_glue: option::t[ValueRef],
|
||||
mutable free_glue: option::t[ValueRef],
|
||||
mutable cmp_glue: option::t[ValueRef],
|
||||
mutable copy_glue: option::t<ValueRef>,
|
||||
mutable drop_glue: option::t<ValueRef>,
|
||||
mutable free_glue: option::t<ValueRef>,
|
||||
mutable cmp_glue: option::t<ValueRef>,
|
||||
ty_params: [uint]};
|
||||
|
||||
/*
|
||||
|
|
@ -110,32 +110,32 @@ type crate_ctxt = {
|
|||
llmod: ModuleRef,
|
||||
td: target_data,
|
||||
tn: type_names,
|
||||
externs: hashmap[str, ValueRef],
|
||||
intrinsics: hashmap[str, ValueRef],
|
||||
externs: hashmap<str, ValueRef>,
|
||||
intrinsics: hashmap<str, ValueRef>,
|
||||
|
||||
// A mapping from the def_id of each item in this crate to the address
|
||||
// of the first instruction of the item's definition in the executable
|
||||
// we're generating.
|
||||
item_ids: hashmap[ast::node_id, ValueRef],
|
||||
item_ids: hashmap<ast::node_id, ValueRef>,
|
||||
ast_map: ast_map::map,
|
||||
item_symbols: hashmap[ast::node_id, str],
|
||||
mutable main_fn: option::t[ValueRef],
|
||||
item_symbols: hashmap<ast::node_id, str>,
|
||||
mutable main_fn: option::t<ValueRef>,
|
||||
link_meta: link::link_meta,
|
||||
// TODO: hashmap[tup(tag_id,subtys), @tag_info]
|
||||
tag_sizes: hashmap[ty::t, uint],
|
||||
discrims: hashmap[ast::node_id, ValueRef],
|
||||
discrim_symbols: hashmap[ast::node_id, str],
|
||||
fn_pairs: hashmap[ast::node_id, ValueRef],
|
||||
consts: hashmap[ast::node_id, ValueRef],
|
||||
obj_methods: hashmap[ast::node_id, ()],
|
||||
tydescs: hashmap[ty::t, @tydesc_info],
|
||||
module_data: hashmap[str, ValueRef],
|
||||
lltypes: hashmap[ty::t, TypeRef],
|
||||
// TODO: hashmap<tup(tag_id,subtys), @tag_info>
|
||||
tag_sizes: hashmap<ty::t, uint>,
|
||||
discrims: hashmap<ast::node_id, ValueRef>,
|
||||
discrim_symbols: hashmap<ast::node_id, str>,
|
||||
fn_pairs: hashmap<ast::node_id, ValueRef>,
|
||||
consts: hashmap<ast::node_id, ValueRef>,
|
||||
obj_methods: hashmap<ast::node_id, ()>,
|
||||
tydescs: hashmap<ty::t, @tydesc_info>,
|
||||
module_data: hashmap<str, ValueRef>,
|
||||
lltypes: hashmap<ty::t, TypeRef>,
|
||||
glues: @glue_fns,
|
||||
names: namegen,
|
||||
sha: std::sha1::sha1,
|
||||
type_sha1s: hashmap[ty::t, str],
|
||||
type_short_names: hashmap[ty::t, str],
|
||||
type_sha1s: hashmap<ty::t, str>,
|
||||
type_short_names: hashmap<ty::t, str>,
|
||||
tcx: ty::ctxt,
|
||||
stats: stats,
|
||||
upcalls: @upcall::upcalls,
|
||||
|
|
@ -216,37 +216,37 @@ type fn_ctxt = {
|
|||
|
||||
// The 'self' object currently in use in this function, if there
|
||||
// is one.
|
||||
mutable llself: option::t[val_self_pair],
|
||||
mutable llself: option::t<val_self_pair>,
|
||||
|
||||
// If this function is actually a iter, a block containing the
|
||||
// code called whenever the iter calls 'put'.
|
||||
mutable lliterbody: option::t[ValueRef],
|
||||
mutable lliterbody: option::t<ValueRef>,
|
||||
|
||||
// If this function is actually a iter, the type of the function
|
||||
// that that we call when we call 'put'. Having to track this is
|
||||
// pretty irritating. We have to do it because we need the type if
|
||||
// we are going to put the iterbody into a closure (if it appears
|
||||
// in a for-each inside of an iter).
|
||||
mutable iterbodyty: option::t[ty::t],
|
||||
mutable iterbodyty: option::t<ty::t>,
|
||||
|
||||
// The next four items: hash tables mapping from AST def_ids to
|
||||
// LLVM-stuff-in-the-frame.
|
||||
|
||||
// Maps arguments to allocas created for them in llallocas.
|
||||
llargs: hashmap[ast::node_id, ValueRef],
|
||||
llargs: hashmap<ast::node_id, ValueRef>,
|
||||
|
||||
// Maps fields in objects to pointers into the interior of
|
||||
// llself's body.
|
||||
llobjfields: hashmap[ast::node_id, ValueRef],
|
||||
llobjfields: hashmap<ast::node_id, ValueRef>,
|
||||
|
||||
// Maps the def_ids for local variables to the allocas created for
|
||||
// them in llallocas.
|
||||
lllocals: hashmap[ast::node_id, ValueRef],
|
||||
lllocals: hashmap<ast::node_id, ValueRef>,
|
||||
|
||||
// The same as above, but for variables accessed via the frame
|
||||
// pointer we pass into an iter, for access to the static
|
||||
// environment of the iter-calling frame.
|
||||
llupvars: hashmap[ast::node_id, ValueRef],
|
||||
llupvars: hashmap<ast::node_id, ValueRef>,
|
||||
|
||||
// For convenience, a vector of the incoming tydescs for each of
|
||||
// this functions type parameters, fetched via llvm::LLVMGetParam.
|
||||
|
|
@ -263,7 +263,7 @@ type fn_ctxt = {
|
|||
// when information about both "[T]" and "T" are available. When
|
||||
// such a tydesc is created, we cache it in the derived_tydescs
|
||||
// table for the next time that such a tydesc is needed.
|
||||
derived_tydescs: hashmap[ty::t, derived_tydesc_info],
|
||||
derived_tydescs: hashmap<ty::t, derived_tydesc_info>,
|
||||
|
||||
// The node_id of the function, or -1 if it doesn't correspond to
|
||||
// a user-defined function.
|
||||
|
|
@ -350,7 +350,7 @@ tag block_kind {
|
|||
// which block to jump to in the case of "continue" or "break", with the
|
||||
// "continue" block optional, because "while" and "do while" don't support
|
||||
// "continue" (TODO: is this intentional?)
|
||||
LOOP_SCOPE_BLOCK(option::t[@block_ctxt], @block_ctxt);
|
||||
LOOP_SCOPE_BLOCK(option::t<@block_ctxt>, @block_ctxt);
|
||||
|
||||
|
||||
// A non-scope block is a basic block created as a translation artifact
|
||||
|
|
@ -397,7 +397,7 @@ type block_ctxt = {
|
|||
fcx: @fn_ctxt
|
||||
};
|
||||
|
||||
// FIXME: we should be able to use option::t[@block_parent] here but
|
||||
// FIXME: we should be able to use option::t<@block_parent> here but
|
||||
// the infinite-tag check in rustboot gets upset.
|
||||
tag block_parent { parent_none; parent_some(@block_ctxt); }
|
||||
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ fn vtbl_mthd_lteq(a: &vtbl_mthd, b: &vtbl_mthd) -> bool {
|
|||
// ones that we don't need forwarding slots for.
|
||||
fn filtering_fn(cx: @local_ctxt, m: &vtbl_mthd,
|
||||
addtl_meths: [@ast::method]) ->
|
||||
option::t[vtbl_mthd] {
|
||||
option::t<vtbl_mthd> {
|
||||
|
||||
// Since m is a fwding_mthd, and we're checking to see if it's in
|
||||
// addtl_meths (which only contains normal_mthds), we can't just check if
|
||||
|
|
@ -448,7 +448,7 @@ fn filtering_fn(cx: @local_ctxt, m: &vtbl_mthd,
|
|||
// object, and return a pointer to it.
|
||||
fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t,
|
||||
ob: &ast::_obj, ty_params: &[ast::ty_param],
|
||||
inner_obj_ty: option::t[ty::t],
|
||||
inner_obj_ty: option::t<ty::t>,
|
||||
additional_field_tys: &[ty::t]) -> ValueRef {
|
||||
|
||||
let llmethods: [ValueRef] = ~[];
|
||||
|
|
@ -892,7 +892,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method,
|
|||
// object body: [tydesc, [typaram, ...], [field, ...], inner_obj].
|
||||
fn create_object_body_type(tcx: &ty::ctxt, fields_ty: &[ty::t],
|
||||
typarams_ty: &[ty::t],
|
||||
maybe_inner_obj_ty: option::t[ty::t]) -> ty::t {
|
||||
maybe_inner_obj_ty: option::t<ty::t>) -> ty::t {
|
||||
|
||||
let tydesc_ty: ty::t = ty::mk_type(tcx);
|
||||
let typarams_ty_tup: ty::t = ty::mk_tup(tcx, typarams_ty);
|
||||
|
|
|
|||
|
|
@ -208,11 +208,11 @@ Both types store an ident and span, for error-logging purposes.
|
|||
*/
|
||||
type pred_args_ = {args: [@constr_arg_use], bit_num: uint};
|
||||
|
||||
type pred_args = spanned[pred_args_];
|
||||
type pred_args = spanned<pred_args_>;
|
||||
|
||||
// The attached node ID is the *defining* node ID
|
||||
// for this local.
|
||||
type constr_arg_use = spanned[constr_arg_general_[inst]];
|
||||
type constr_arg_use = spanned<constr_arg_general_<inst>>;
|
||||
|
||||
tag constraint {
|
||||
cinit(uint, span, ident);
|
||||
|
|
@ -232,11 +232,11 @@ tag tsconstr {
|
|||
npred(path, def_id, [@constr_arg_use]);
|
||||
}
|
||||
|
||||
type sp_constr = spanned[tsconstr];
|
||||
type sp_constr = spanned<tsconstr>;
|
||||
|
||||
type norm_constraint = {bit_num: uint, c: sp_constr};
|
||||
|
||||
type constr_map = @std::map::hashmap[def_id, constraint];
|
||||
type constr_map = @std::map::hashmap<def_id, constraint>;
|
||||
|
||||
/* Contains stuff that has to be computed up front */
|
||||
type fn_info =
|
||||
|
|
@ -295,7 +295,7 @@ type node_ann_table = @mutable [mutable ts_ann];
|
|||
|
||||
|
||||
/* mapping from function name to fn_info map */
|
||||
type fn_info_map = @std::map::hashmap[node_id, fn_info];
|
||||
type fn_info_map = @std::map::hashmap<node_id, fn_info>;
|
||||
|
||||
type fn_ctxt =
|
||||
{enclosing: fn_info,
|
||||
|
|
@ -318,7 +318,7 @@ fn add_node(ccx: &crate_ctxt, i: node_id, a: &ts_ann) {
|
|||
ccx.node_anns.(i) = a;
|
||||
}
|
||||
|
||||
fn get_ts_ann(ccx: &crate_ctxt, i: node_id) -> option::t[ts_ann] {
|
||||
fn get_ts_ann(ccx: &crate_ctxt, i: node_id) -> option::t<ts_ann> {
|
||||
if i as uint < vec::len(*ccx.node_anns) {
|
||||
ret some[ts_ann](ccx.node_anns.(i));
|
||||
} else { ret none[ts_ann]; }
|
||||
|
|
@ -547,10 +547,10 @@ fn node_id_to_def_strict(cx: &ty::ctxt, id: node_id) -> def {
|
|||
}
|
||||
}
|
||||
|
||||
fn node_id_to_def(ccx: &crate_ctxt, id: node_id) -> option::t[def] {
|
||||
fn node_id_to_def(ccx: &crate_ctxt, id: node_id) -> option::t<def> {
|
||||
ret ccx.tcx.def_map.find(id);
|
||||
}
|
||||
fn node_id_to_def_upvar(cx: &fn_ctxt, id: node_id) -> option::t[def] {
|
||||
fn node_id_to_def_upvar(cx: &fn_ctxt, id: node_id) -> option::t<def> {
|
||||
ret freevars::def_lookup(cx.ccx.tcx, cx.id, id);
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +704,7 @@ fn substitute_arg(cx: &ty::ctxt, actuals: &[@expr], a: @constr_arg) ->
|
|||
}
|
||||
}
|
||||
|
||||
fn pred_args_matches(pattern: &[constr_arg_general_[inst]],
|
||||
fn pred_args_matches(pattern: &[constr_arg_general_<inst>],
|
||||
desc: &pred_args) -> bool {
|
||||
let i = 0u;
|
||||
for c: @constr_arg_use in desc.node.args {
|
||||
|
|
@ -729,8 +729,8 @@ fn pred_args_matches(pattern: &[constr_arg_general_[inst]],
|
|||
ret true;
|
||||
}
|
||||
|
||||
fn find_instance_(pattern: &[constr_arg_general_[inst]],
|
||||
descs: &[pred_args]) -> option::t[uint] {
|
||||
fn find_instance_(pattern: &[constr_arg_general_<inst>],
|
||||
descs: &[pred_args]) -> option::t<uint> {
|
||||
for d: pred_args in descs {
|
||||
if pred_args_matches(pattern, d) { ret some(d.node.bit_num); }
|
||||
}
|
||||
|
|
@ -764,7 +764,7 @@ fn find_instances(fcx: &fn_ctxt, subst: &subst, c: &constraint) ->
|
|||
rslt
|
||||
}
|
||||
|
||||
fn find_in_subst(id: node_id, s: &subst) -> option::t[inst] {
|
||||
fn find_in_subst(id: node_id, s: &subst) -> option::t<inst> {
|
||||
for p: {from: inst, to: inst} in s {
|
||||
if id == p.from.node { ret some(p.to); }
|
||||
}
|
||||
|
|
@ -775,9 +775,9 @@ fn find_in_subst_bool(s: &subst, id: node_id) -> bool {
|
|||
is_some(find_in_subst(id, s))
|
||||
}
|
||||
|
||||
fn insts_to_str(stuff: &[constr_arg_general_[inst]]) -> str {
|
||||
fn insts_to_str(stuff: &[constr_arg_general_<inst>]) -> str {
|
||||
let rslt = "<";
|
||||
for i: constr_arg_general_[inst] in stuff {
|
||||
for i: constr_arg_general_<inst> in stuff {
|
||||
rslt +=
|
||||
" " +
|
||||
alt i {
|
||||
|
|
@ -790,8 +790,8 @@ fn insts_to_str(stuff: &[constr_arg_general_[inst]]) -> str {
|
|||
rslt
|
||||
}
|
||||
|
||||
fn replace(subst: subst, d: pred_args) -> [constr_arg_general_[inst]] {
|
||||
let rslt: [constr_arg_general_[inst]] = ~[];
|
||||
fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
|
||||
let rslt: [constr_arg_general_<inst>] = ~[];
|
||||
for c: @constr_arg_use in d.node.args {
|
||||
alt c.node {
|
||||
carg_ident(p) {
|
||||
|
|
@ -808,7 +808,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_[inst]] {
|
|||
}
|
||||
|
||||
/*
|
||||
for (constr_arg_general_[tup(ident, def_id)] p in rslt) {
|
||||
for (constr_arg_general_<tup(ident, def_id)> p in rslt) {
|
||||
alt (p) {
|
||||
case (carg_ident(?p)) {
|
||||
log_err p._0;
|
||||
|
|
@ -849,11 +849,11 @@ fn local_node_id_to_def_id_strict(fcx: &fn_ctxt, sp: &span, i: &node_id) ->
|
|||
}
|
||||
}
|
||||
|
||||
fn local_node_id_to_def(fcx: &fn_ctxt, i: &node_id) -> option::t[def] {
|
||||
fn local_node_id_to_def(fcx: &fn_ctxt, i: &node_id) -> option::t<def> {
|
||||
fcx.ccx.tcx.def_map.find(i)
|
||||
}
|
||||
|
||||
fn local_node_id_to_def_id(fcx: &fn_ctxt, i: &node_id) -> option::t[def_id] {
|
||||
fn local_node_id_to_def_id(fcx: &fn_ctxt, i: &node_id) -> option::t<def_id> {
|
||||
alt local_node_id_to_def(fcx, i) {
|
||||
some(def_local(d_id)) { some(d_id) }
|
||||
some(def_arg(a_id)) { some(a_id) }
|
||||
|
|
@ -862,7 +862,7 @@ fn local_node_id_to_def_id(fcx: &fn_ctxt, i: &node_id) -> option::t[def_id] {
|
|||
}
|
||||
|
||||
fn local_node_id_to_local_def_id(fcx: &fn_ctxt, i: &node_id) ->
|
||||
option::t[node_id] {
|
||||
option::t<node_id> {
|
||||
alt local_node_id_to_def(fcx, i) {
|
||||
some(def_local(d_id)) { some(d_id.node) }
|
||||
some(def_arg(a_id)) { some(a_id.node) }
|
||||
|
|
@ -1052,7 +1052,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,
|
||||
iid: node_id, cx: &T, v: &visit::vt[T]) {
|
||||
iid: node_id, cx: &T, v: &visit::vt<T>) {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1077,7 +1077,7 @@ fn ast_constr_to_sp_constr(tcx: &ty::ctxt, args: &[arg], c: &@constr) ->
|
|||
ret respan(c.span, tconstr);
|
||||
}
|
||||
|
||||
type binding = {lhs: [inst], rhs: option::t[initializer]};
|
||||
type binding = {lhs: [inst], rhs: option::t<initializer>};
|
||||
|
||||
fn local_to_bindings(loc : &@local) -> binding {
|
||||
let lhs = ~[];
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ fn declare_var(fcx: &fn_ctxt, c: &tsconstr, pre: prestate) -> prestate {
|
|||
}
|
||||
|
||||
fn relax_precond_expr(e: &@expr, cx: &relax_ctxt,
|
||||
vt: &visit::vt[relax_ctxt]) {
|
||||
vt: &visit::vt<relax_ctxt>) {
|
||||
relax_precond(cx.i as uint, expr_precond(cx.fcx.ccx, e));
|
||||
visit::visit_expr(e, cx, vt);
|
||||
}
|
||||
|
||||
fn relax_precond_stmt(s: &@stmt, cx: &relax_ctxt,
|
||||
vt: &visit::vt[relax_ctxt]) {
|
||||
vt: &visit::vt<relax_ctxt>) {
|
||||
relax_precond(cx.i as uint, stmt_precond(cx.fcx.ccx, *s));
|
||||
visit::visit_stmt(s, cx, vt);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ fn relax_precond_stmt(s: &@stmt, cx: &relax_ctxt,
|
|||
type relax_ctxt = {fcx:fn_ctxt, i:node_id};
|
||||
|
||||
fn relax_precond_block_inner(b: &blk, cx: &relax_ctxt,
|
||||
vt: &visit::vt[relax_ctxt]) {
|
||||
vt: &visit::vt<relax_ctxt>) {
|
||||
relax_precond(cx.i as uint, block_precond(cx.fcx.ccx, b));
|
||||
visit::visit_block(b, cx, vt);
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ fn relax_precond_block(fcx: &fn_ctxt, i: node_id, b:&blk) {
|
|||
visit_expr: relax_precond_expr,
|
||||
visit_stmt: relax_precond_stmt,
|
||||
visit_item: (fn (i: &@item, cx: &relax_ctxt,
|
||||
vt: &visit::vt[relax_ctxt]) {})
|
||||
vt: &visit::vt<relax_ctxt>) {})
|
||||
with *visitor};
|
||||
let v1 = visit::mk_vt(visitor);
|
||||
v1.visit_block(b, cx, v1);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ fn check_unused_vars(fcx: &fn_ctxt) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_states_expr(e: &@expr, fcx: &fn_ctxt, v: &visit::vt[fn_ctxt]) {
|
||||
fn check_states_expr(e: &@expr, fcx: &fn_ctxt, v: &visit::vt<fn_ctxt>) {
|
||||
visit::visit_expr(e, fcx, v);
|
||||
|
||||
let prec: precond = expr_precond(fcx.ccx, e);
|
||||
|
|
@ -92,7 +92,7 @@ fn check_states_expr(e: &@expr, fcx: &fn_ctxt, v: &visit::vt[fn_ctxt]) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_states_stmt(s: &@stmt, fcx: &fn_ctxt, v: &visit::vt[fn_ctxt]) {
|
||||
fn check_states_stmt(s: &@stmt, fcx: &fn_ctxt, v: &visit::vt<fn_ctxt>) {
|
||||
visit::visit_stmt(s, fcx, v);
|
||||
|
||||
let a = stmt_to_ann(fcx.ccx, *s);
|
||||
|
|
@ -184,7 +184,7 @@ fn check_fn_states(fcx: &fn_ctxt, f: &_fn, tps: &[ast::ty_param], id: node_id,
|
|||
}
|
||||
|
||||
fn fn_states(f: &_fn, tps: &[ast::ty_param], sp: &span, i: &fn_ident,
|
||||
id: node_id, ccx: &crate_ctxt, v: &visit::vt[crate_ctxt]) {
|
||||
id: node_id, ccx: &crate_ctxt, v: &visit::vt<crate_ctxt>) {
|
||||
visit::visit_fn(f, tps, sp, i, id, ccx, v);
|
||||
/* Look up the var-to-bit-num map for this function */
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import syntax::ast::respan;
|
|||
|
||||
type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};
|
||||
|
||||
fn collect_local(loc: &@local, cx: &ctxt, v: &visit::vt[ctxt]) {
|
||||
fn collect_local(loc: &@local, cx: &ctxt, v: &visit::vt<ctxt>) {
|
||||
for each p: @pat in pat_bindings(loc.node.pat) {
|
||||
let ident = alt p.node { pat_bind(id) { id } };
|
||||
log "collect_local: pushing " + ident;
|
||||
|
|
@ -22,7 +22,7 @@ fn collect_local(loc: &@local, cx: &ctxt, v: &visit::vt[ctxt]) {
|
|||
visit::visit_local(loc, cx, v);
|
||||
}
|
||||
|
||||
fn collect_pred(e: &@expr, cx: &ctxt, v: &visit::vt[ctxt]) {
|
||||
fn collect_pred(e: &@expr, cx: &ctxt, v: &visit::vt<ctxt>) {
|
||||
alt e.node {
|
||||
expr_check(_, ch) { *cx.cs += ~[expr_to_constr(cx.tcx, ch)]; }
|
||||
expr_if_check(ex, _, _) { *cx.cs += ~[expr_to_constr(cx.tcx, ex)]; }
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ fn find_pre_post_loop(fcx: &fn_ctxt, l: &@local, index: &@expr, body: &blk,
|
|||
// annotation for an if-expression with consequent conseq
|
||||
// and alternative maybe_alt
|
||||
fn join_then_else(fcx: &fn_ctxt, antec: &@expr, conseq: &blk,
|
||||
maybe_alt: &option::t[@expr], id: node_id, chck: &if_ty) {
|
||||
maybe_alt: &option::t<@expr>, id: node_id, chck: &if_ty) {
|
||||
find_pre_post_expr(fcx, antec);
|
||||
find_pre_post_block(fcx, conseq);
|
||||
alt maybe_alt {
|
||||
|
|
@ -553,7 +553,7 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
|||
let cmodes = callee_modes(fcx, operator.id);
|
||||
let modes = ~[];
|
||||
let i = 0;
|
||||
for expr_opt: option::t[@expr] in maybe_args {
|
||||
for expr_opt: option::t<@expr> in maybe_args {
|
||||
alt expr_opt {
|
||||
none. {/* no-op */ }
|
||||
some(expr) {
|
||||
|
|
@ -723,7 +723,7 @@ fn find_pre_post_fn(fcx: &fn_ctxt, f: &_fn) {
|
|||
}
|
||||
|
||||
fn fn_pre_post(f: &_fn, tps: &[ty_param], sp: &span, i: &fn_ident,
|
||||
id: node_id, ccx: &crate_ctxt, v: &visit::vt[crate_ctxt]) {
|
||||
id: node_id, ccx: &crate_ctxt, v: &visit::vt<crate_ctxt>) {
|
||||
visit::visit_fn(f, tps, sp, i, id, ccx, v);
|
||||
assert (ccx.fm.contains_key(id));
|
||||
let fcx =
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ fn seq_states(fcx: &fn_ctxt, pres: &prestate, bindings: &[binding])
|
|||
}
|
||||
|
||||
fn find_pre_post_state_sub(fcx: &fn_ctxt, pres: &prestate, e: &@expr,
|
||||
parent: node_id, c: option::t[tsconstr]) -> bool {
|
||||
parent: node_id, c: option::t<tsconstr>) -> bool {
|
||||
let changed = find_pre_post_state_expr(fcx, pres, e);
|
||||
|
||||
changed = set_prestate_ann(fcx.ccx, parent, pres) || changed;
|
||||
|
|
@ -238,7 +238,7 @@ fn gen_if_local(fcx: &fn_ctxt, p: &poststate, e: &@expr) -> bool {
|
|||
}
|
||||
|
||||
fn join_then_else(fcx: &fn_ctxt, antec: &@expr, conseq: &blk,
|
||||
maybe_alt: &option::t[@expr], id: node_id, chk: &if_ty,
|
||||
maybe_alt: &option::t<@expr>, id: node_id, chk: &if_ty,
|
||||
pres: &prestate) -> bool {
|
||||
let changed =
|
||||
set_prestate_ann(fcx.ccx, id, pres) |
|
||||
|
|
@ -328,7 +328,7 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
|||
let callee_ops = callee_arg_init_ops(fcx, operator.id);
|
||||
let ops = ~[];
|
||||
let i = 0;
|
||||
for a_opt: option::t[@expr] in maybe_args {
|
||||
for a_opt: option::t<@expr> in maybe_args {
|
||||
alt a_opt {
|
||||
none. {/* no-op */ }
|
||||
some(a) {
|
||||
|
|
|
|||
|
|
@ -199,14 +199,14 @@ type method =
|
|||
cf: controlflow,
|
||||
constrs: [@constr]};
|
||||
|
||||
type constr_table = hashmap[ast::node_id, [constr]];
|
||||
type constr_table = hashmap<ast::node_id, [constr]>;
|
||||
|
||||
type mt = {ty: t, mut: ast::mutability};
|
||||
|
||||
|
||||
// Contains information needed to resolve types and (in the future) look up
|
||||
// the types of AST nodes.
|
||||
type creader_cache = hashmap[{cnum: int, pos: uint, len: uint}, ty::t];
|
||||
type creader_cache = hashmap<{cnum: int, pos: uint, len: uint}, ty::t>;
|
||||
|
||||
type ctxt =
|
||||
|
||||
|
|
@ -219,11 +219,11 @@ type ctxt =
|
|||
freevars: freevars::freevar_map,
|
||||
tcache: type_cache,
|
||||
rcache: creader_cache,
|
||||
short_names_cache: hashmap[t, str],
|
||||
has_pointer_cache: hashmap[t, bool],
|
||||
kind_cache: hashmap[t, ast::kind],
|
||||
owns_heap_mem_cache: hashmap[t, bool],
|
||||
ast_ty_to_ty_cache: hashmap[@ast::ty, option::t[t]]};
|
||||
short_names_cache: hashmap<t, str>,
|
||||
has_pointer_cache: hashmap<t, bool>,
|
||||
kind_cache: hashmap<t, ast::kind>,
|
||||
owns_heap_mem_cache: hashmap<t, bool>,
|
||||
ast_ty_to_ty_cache: hashmap<@ast::ty, option::t<t>>};
|
||||
|
||||
type ty_ctxt = ctxt;
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ fn method_ty_to_fn_ty(cx: &ctxt, m: method) -> t {
|
|||
// Never construct these manually. These are interned.
|
||||
type raw_t =
|
||||
{struct: sty,
|
||||
cname: option::t[str],
|
||||
cname: option::t<str>,
|
||||
hash: uint,
|
||||
has_params: bool,
|
||||
has_vars: bool};
|
||||
|
|
@ -284,9 +284,9 @@ 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 type_constr = constr_general[path];
|
||||
type constr = constr_general[uint];
|
||||
type constr_general[ARG] = spanned<constr_general_<ARG, def_id>>;
|
||||
type type_constr = constr_general<path>;
|
||||
type constr = constr_general<uint>;
|
||||
|
||||
// Data structures used in type unification
|
||||
tag type_err {
|
||||
|
|
@ -308,7 +308,7 @@ tag type_err {
|
|||
|
||||
type ty_param_kinds_and_ty = {kinds: [ast::kind], ty: t};
|
||||
|
||||
type type_cache = hashmap[ast::def_id, ty_param_kinds_and_ty];
|
||||
type type_cache = hashmap<ast::def_id, ty_param_kinds_and_ty>;
|
||||
|
||||
const idx_nil: uint = 0u;
|
||||
|
||||
|
|
@ -352,12 +352,12 @@ const idx_bot: uint = 19u;
|
|||
|
||||
const idx_first_others: uint = 20u;
|
||||
|
||||
type type_store = interner::interner[@raw_t];
|
||||
type type_store = interner::interner<@raw_t>;
|
||||
|
||||
type ty_param_substs_opt_and_ty = {substs: option::t[[ty::t]], ty: ty::t};
|
||||
type ty_param_substs_opt_and_ty = {substs: option::t<[ty::t]>, ty: ty::t};
|
||||
|
||||
type node_type_table =
|
||||
@smallintmap::smallintmap[ty::ty_param_substs_opt_and_ty];
|
||||
@smallintmap::smallintmap<ty::ty_param_substs_opt_and_ty>;
|
||||
|
||||
fn populate_type_store(cx: &ctxt) {
|
||||
intern(cx, ty_nil, none);
|
||||
|
|
@ -421,7 +421,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
|
|||
|
||||
|
||||
// Type constructors
|
||||
fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t[str]) -> @raw_t {
|
||||
fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t<str>) -> @raw_t {
|
||||
let cname = none;
|
||||
let h = hash_type_info(st, cname);
|
||||
let has_params: bool = false;
|
||||
|
|
@ -502,11 +502,11 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t[str]) -> @raw_t {
|
|||
has_vars: has_vars};
|
||||
}
|
||||
|
||||
fn intern(cx: &ctxt, st: &sty, cname: &option::t[str]) {
|
||||
fn intern(cx: &ctxt, st: &sty, cname: &option::t<str>) {
|
||||
interner::intern(*cx.ts, mk_raw_ty(cx, st, cname));
|
||||
}
|
||||
|
||||
fn gen_ty_full(cx: &ctxt, st: &sty, cname: &option::t[str]) -> t {
|
||||
fn gen_ty_full(cx: &ctxt, st: &sty, cname: &option::t<str>) -> t {
|
||||
let raw_type = mk_raw_ty(cx, st, cname);
|
||||
ret interner::intern(*cx.ts, raw_type);
|
||||
}
|
||||
|
|
@ -621,7 +621,7 @@ fn struct(cx: &ctxt, typ: &t) -> sty {
|
|||
|
||||
|
||||
// Returns the canonical name of the given type.
|
||||
fn cname(cx: &ctxt, typ: &t) -> option::t[str] {
|
||||
fn cname(cx: &ctxt, typ: &t) -> option::t<str> {
|
||||
ret interner::get(*cx.ts, typ).cname;
|
||||
}
|
||||
|
||||
|
|
@ -1363,7 +1363,7 @@ fn type_is_pod(cx : &ctxt, ty : &t) -> bool {
|
|||
ret result;
|
||||
}
|
||||
|
||||
fn type_param(cx: &ctxt, ty: &t) -> option::t[uint] {
|
||||
fn type_param(cx: &ctxt, ty: &t) -> option::t<uint> {
|
||||
alt struct(cx, ty) {
|
||||
ty_param(id,_) { ret some(id); }
|
||||
_ {/* fall through */ }
|
||||
|
|
@ -1536,7 +1536,7 @@ fn hash_type_structure(st: &sty) -> uint {
|
|||
}
|
||||
}
|
||||
|
||||
fn hash_type_info(st: &sty, cname_opt: &option::t[str]) -> uint {
|
||||
fn hash_type_info(st: &sty, cname_opt: &option::t<str>) -> uint {
|
||||
let h = hash_type_structure(st);
|
||||
alt cname_opt {
|
||||
none. {/* no-op */ }
|
||||
|
|
@ -1554,8 +1554,8 @@ 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],
|
||||
b: @sp_constr_arg[T]) -> bool {
|
||||
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. {
|
||||
alt b.node { ast::carg_base. { ret true; } _ { ret false; } }
|
||||
|
|
@ -1569,10 +1569,10 @@ 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]],
|
||||
b: &[@sp_constr_arg[T]]) -> bool {
|
||||
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 {
|
||||
for arg: @sp_constr_arg<T> in a {
|
||||
if !arg_eq(eq, arg, b.(i)) { ret false; }
|
||||
i += 1u;
|
||||
}
|
||||
|
|
@ -2008,7 +2008,7 @@ fn is_lval(expr: &@ast::expr) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn occurs_check_fails(tcx: &ctxt, sp: &option::t[span], vid: int, rt: &t)
|
||||
fn occurs_check_fails(tcx: &ctxt, sp: &option::t<span>, vid: int, rt: &t)
|
||||
-> bool {
|
||||
if (!type_contains_vars(tcx, rt)) {
|
||||
// Fast path
|
||||
|
|
@ -2066,7 +2066,7 @@ mod unify {
|
|||
|
||||
}
|
||||
type var_bindings =
|
||||
{sets: ufind::ufind, types: smallintmap::smallintmap[t]};
|
||||
{sets: ufind::ufind, types: smallintmap::smallintmap<t>};
|
||||
|
||||
type ctxt = {vb: @var_bindings, tcx: ty_ctxt};
|
||||
|
||||
|
|
@ -2198,7 +2198,7 @@ mod unify {
|
|||
|
||||
// Unifies two mutability flags.
|
||||
fn unify_mut(expected: ast::mutability, actual: ast::mutability) ->
|
||||
option::t[ast::mutability] {
|
||||
option::t<ast::mutability> {
|
||||
if expected == actual { ret some(expected); }
|
||||
if expected == ast::maybe_mut { ret some(actual); }
|
||||
if actual == ast::maybe_mut { ret some(expected); }
|
||||
|
|
@ -2736,7 +2736,7 @@ mod unify {
|
|||
while i < vec::len[ufind::node](vb.sets.nodes) {
|
||||
let sets = "";
|
||||
let j = 0u;
|
||||
while j < vec::len[option::t[uint]](vb.sets.nodes) {
|
||||
while j < vec::len[option::t<uint>](vb.sets.nodes) {
|
||||
if ufind::find(vb.sets, j) == i {
|
||||
sets += #fmt(" %u", j);
|
||||
}
|
||||
|
|
@ -2756,10 +2756,10 @@ mod unify {
|
|||
// Takes an optional span - complain about occurs check violations
|
||||
// iff the span is present (so that if we already know we're going
|
||||
// to error anyway, we don't complain)
|
||||
fn fixup_vars(tcx: ty_ctxt, sp: &option::t[span],
|
||||
fn fixup_vars(tcx: ty_ctxt, sp: &option::t<span>,
|
||||
vb: @var_bindings, typ: t) -> fixup_result {
|
||||
fn subst_vars(tcx: ty_ctxt, sp: &option::t[span], vb: @var_bindings,
|
||||
unresolved: @mutable option::t[int], vid: int) -> t {
|
||||
fn subst_vars(tcx: ty_ctxt, sp: &option::t<span>, vb: @var_bindings,
|
||||
unresolved: @mutable option::t<int>, vid: int) -> t {
|
||||
// Should really return a fixup_result instead of a t, but fold_ty
|
||||
// doesn't allow returning anything but a t.
|
||||
if vid as uint >= ufind::set_count(vb.sets) {
|
||||
|
|
@ -2789,7 +2789,7 @@ mod unify {
|
|||
some(var_id) { ret fix_err(var_id); }
|
||||
}
|
||||
}
|
||||
fn resolve_type_var(tcx: &ty_ctxt, sp: &option::t[span],
|
||||
fn resolve_type_var(tcx: &ty_ctxt, sp: &option::t<span>,
|
||||
vb: &@var_bindings, vid: int) ->
|
||||
fixup_result {
|
||||
if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); }
|
||||
|
|
@ -3090,8 +3090,8 @@ 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]) ->
|
||||
@ty::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.)) {
|
||||
ret @respan(c.span,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import syntax::print::pprust::*;
|
|||
|
||||
export check_crate;
|
||||
|
||||
type ty_table = hashmap[ast::def_id, ty::t];
|
||||
type ty_table = hashmap<ast::def_id, ty::t>;
|
||||
|
||||
// Used for typechecking the methods of an object.
|
||||
tag obj_info {
|
||||
|
|
@ -57,7 +57,7 @@ tag obj_info {
|
|||
regular_obj([ast::obj_field], ast::node_id);
|
||||
// Anonymous objects only have a type at compile time. It's optional
|
||||
// because not all anonymous objects have a inner_obj to attach to.
|
||||
anon_obj([ast::obj_field], option::t[ty::sty]);
|
||||
anon_obj([ast::obj_field], option::t<ty::sty>);
|
||||
}
|
||||
|
||||
type crate_ctxt = {mutable obj_infos: [obj_info], tcx: ty::ctxt};
|
||||
|
|
@ -70,8 +70,8 @@ type fn_ctxt =
|
|||
purity: ast::purity,
|
||||
proto: ast::proto,
|
||||
var_bindings: @ty::unify::var_bindings,
|
||||
locals: hashmap[ast::node_id, int],
|
||||
local_names: hashmap[ast::node_id, ast::ident],
|
||||
locals: hashmap<ast::node_id, int>,
|
||||
local_names: hashmap<ast::node_id, ast::ident>,
|
||||
next_var_id: @mutable int,
|
||||
mutable fixups: [ast::node_id],
|
||||
ccx: @crate_ctxt};
|
||||
|
|
@ -235,7 +235,7 @@ fn structure_of(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> ty::sty {
|
|||
// Returns the one-level-deep structure of the given type or none if it
|
||||
// is not known yet.
|
||||
fn structure_of_maybe(fcx: &@fn_ctxt, sp: &span, typ: ty::t) ->
|
||||
option::t[ty::sty] {
|
||||
option::t<ty::sty> {
|
||||
let r =
|
||||
ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ);
|
||||
ret alt r {
|
||||
|
|
@ -433,7 +433,7 @@ fn ast_ty_to_ty_crate(ccx: @crate_ctxt, ast_ty: &@ast::ty) -> ty::t {
|
|||
|
||||
// A wrapper around ast_ty_to_ty_crate that handles ty_infer.
|
||||
fn ast_ty_to_ty_crate_infer(ccx: @crate_ctxt, ast_ty: &@ast::ty)
|
||||
-> option::t[ty::t] {
|
||||
-> option::t<ty::t> {
|
||||
alt ast_ty.node {
|
||||
ast::ty_infer. { none }
|
||||
_ { some(ast_ty_to_ty_crate(ccx, ast_ty)) }
|
||||
|
|
@ -544,7 +544,7 @@ mod collect {
|
|||
fn ty_of_fn_decl(cx: &@ctxt, convert: &fn(&@ast::ty) -> ty::t ,
|
||||
ty_of_arg: &fn(&ast::arg) -> arg , decl: &ast::fn_decl,
|
||||
proto: ast::proto, ty_params: &[ast::ty_param],
|
||||
def_id: &option::t[ast::def_id]) ->
|
||||
def_id: &option::t<ast::def_id>) ->
|
||||
ty::ty_param_kinds_and_ty {
|
||||
let input_tys = ~[];
|
||||
for a: ast::arg in decl.inputs { input_tys += ~[ty_of_arg(a)]; }
|
||||
|
|
@ -775,7 +775,7 @@ mod collect {
|
|||
}
|
||||
ret meths;
|
||||
}
|
||||
fn convert(cx: @ctxt, abi: @mutable option::t[ast::native_abi],
|
||||
fn convert(cx: @ctxt, abi: @mutable option::t<ast::native_abi>,
|
||||
it: &@ast::item) {
|
||||
alt it.node {
|
||||
ast::item_mod(_) {
|
||||
|
|
@ -850,7 +850,7 @@ mod collect {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn convert_native(cx: @ctxt, abi: @mutable option::t[ast::native_abi],
|
||||
fn convert_native(cx: @ctxt, abi: @mutable option::t<ast::native_abi>,
|
||||
i: &@ast::native_item) {
|
||||
// As above, this call populates the type table with the converted
|
||||
// type of the native item. We simply write it into the node type
|
||||
|
|
@ -1077,7 +1077,7 @@ mod writeback {
|
|||
export resolve_type_vars_in_expr;
|
||||
|
||||
fn resolve_type_vars_in_type(fcx: &@fn_ctxt, sp: &span, typ: ty::t) ->
|
||||
option::t[ty::t] {
|
||||
option::t<ty::t> {
|
||||
if !ty::type_contains_vars(fcx.ccx.tcx, typ) { ret some(typ); }
|
||||
alt ty::unify::fixup_vars(fcx.ccx.tcx, some(sp),
|
||||
fcx.var_bindings, typ) {
|
||||
|
|
@ -1120,7 +1120,7 @@ mod writeback {
|
|||
// As soon as we hit an error we have to stop resolving
|
||||
// the entire function
|
||||
{fcx: @fn_ctxt, mutable success: bool};
|
||||
type wb_vt = visit::vt[wb_ctxt];
|
||||
type wb_vt = visit::vt<wb_ctxt>;
|
||||
|
||||
fn visit_stmt(s: &@ast::stmt, wbcx: &wb_ctxt, v: &wb_vt) {
|
||||
if !wbcx.success { ret; }
|
||||
|
|
@ -1197,13 +1197,13 @@ mod writeback {
|
|||
// for them before typechecking the function.
|
||||
type gather_result =
|
||||
{var_bindings: @ty::unify::var_bindings,
|
||||
locals: hashmap[ast::node_id, int],
|
||||
local_names: hashmap[ast::node_id, ast::ident],
|
||||
locals: hashmap<ast::node_id, int>,
|
||||
local_names: hashmap<ast::node_id, ast::ident>,
|
||||
next_var_id: @mutable int};
|
||||
|
||||
// Used only as a helper for check_fn.
|
||||
fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
|
||||
old_fcx: &option::t[@fn_ctxt]) -> gather_result {
|
||||
old_fcx: &option::t<@fn_ctxt>) -> gather_result {
|
||||
let {vb, locals, local_names, nvi} = alt old_fcx {
|
||||
none. {
|
||||
{ vb: ty::unify::mk_var_bindings(),
|
||||
|
|
@ -1226,7 +1226,7 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
|
|||
ret rv;
|
||||
};
|
||||
let assign = lambda(nid: ast::node_id, ident: &ast::ident,
|
||||
ty_opt: option::t[ty::t]) {
|
||||
ty_opt: option::t<ty::t>) {
|
||||
let var_id = next_var_id();
|
||||
locals.insert(nid, var_id);
|
||||
local_names.insert(nid, ident);
|
||||
|
|
@ -1263,14 +1263,14 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
|
|||
}
|
||||
|
||||
// Add explicitly-declared locals.
|
||||
let visit_local = lambda(local: &@ast::local, e: &(), v: &visit::vt[()]) {
|
||||
let visit_local = lambda(local: &@ast::local, e: &(), v: &visit::vt<()>) {
|
||||
let local_ty = ast_ty_to_ty_crate_infer(ccx, local.node.ty);
|
||||
assign(local.node.id, ident_for_local(local), local_ty);
|
||||
visit::visit_local(local, e, v);
|
||||
};
|
||||
|
||||
// Add pattern bindings.
|
||||
let visit_pat = lambda(p: &@ast::pat, e: &(), v: &visit::vt[()]) {
|
||||
let visit_pat = lambda(p: &@ast::pat, e: &(), v: &visit::vt<()>) {
|
||||
alt p.node {
|
||||
ast::pat_bind(ident) {
|
||||
assign(p.id, ident, none);
|
||||
|
|
@ -1283,8 +1283,8 @@ 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,
|
||||
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]) { }
|
||||
v: &visit::vt<E>) { }
|
||||
fn visit_item[E](i: &@ast::item, e: &E, v: &visit::vt<E>) { }
|
||||
|
||||
let visit =
|
||||
@{visit_local: visit_local,
|
||||
|
|
@ -1538,7 +1538,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
// A generic function to factor out common logic from call and bind
|
||||
// expressions.
|
||||
fn check_call_or_bind(fcx: &@fn_ctxt, sp: &span, f: &@ast::expr,
|
||||
args: &[option::t[@ast::expr]],
|
||||
args: &[option::t<@ast::expr>],
|
||||
call_kind: call_kind) -> bool {
|
||||
// Check the function.
|
||||
let bot = check_expr(fcx, f);
|
||||
|
|
@ -1587,7 +1587,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
|
||||
// Check that the correct number of arguments were supplied.
|
||||
let expected_arg_count = vec::len[ty::arg](arg_tys);
|
||||
let supplied_arg_count = vec::len[option::t[@ast::expr]](args);
|
||||
let supplied_arg_count = vec::len[option::t<@ast::expr>](args);
|
||||
if expected_arg_count != supplied_arg_count {
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
#fmt("this function takes %u \
|
||||
|
|
@ -1612,7 +1612,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
let check_args = lambda(check_blocks: bool) -> bool {
|
||||
let i = 0u;
|
||||
let bot = false;
|
||||
for a_opt: option::t[@ast::expr] in args {
|
||||
for a_opt: option::t<@ast::expr> in args {
|
||||
alt a_opt {
|
||||
some(a) {
|
||||
let is_block =
|
||||
|
|
@ -1647,7 +1647,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
// A generic function for checking call expressions
|
||||
fn check_call(fcx: &@fn_ctxt, sp: &span, f: &@ast::expr,
|
||||
args: &[@ast::expr], call_kind: call_kind) -> bool {
|
||||
let args_opt_0: [option::t[@ast::expr]] = ~[];
|
||||
let args_opt_0: [option::t<@ast::expr>] = ~[];
|
||||
for arg: @ast::expr in args {
|
||||
args_opt_0 += ~[some[@ast::expr](arg)];
|
||||
}
|
||||
|
|
@ -1745,7 +1745,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
// A generic function for checking the then and else in an if
|
||||
// or if-check
|
||||
fn check_then_else(fcx: &@fn_ctxt, thn: &ast::blk,
|
||||
elsopt: &option::t[@ast::expr], id: ast::node_id,
|
||||
elsopt: &option::t<@ast::expr>, id: ast::node_id,
|
||||
sp: &span) -> bool {
|
||||
let then_bot = check_block(fcx, thn);
|
||||
let els_bot = false;
|
||||
|
|
@ -2093,7 +2093,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
// For each blank argument, add the type of that argument
|
||||
// to the resulting function type.
|
||||
let i = 0u;
|
||||
while i < vec::len[option::t[@ast::expr]](args) {
|
||||
while i < vec::len[option::t<@ast::expr>](args) {
|
||||
alt args.(i) {
|
||||
some(_) {/* no-op */ }
|
||||
none. { arg_tys_1 += ~[arg_tys.(i)]; }
|
||||
|
|
@ -2113,9 +2113,9 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
}
|
||||
ast::expr_self_method(ident) {
|
||||
let t = ty::mk_nil(tcx);
|
||||
let this_obj_sty: option::t[ty::sty] =
|
||||
let this_obj_sty: option::t<ty::sty> =
|
||||
some(structure_of(fcx, expr.span, ty::mk_nil(tcx)));
|
||||
let this_obj_info: option::t[obj_info] = get_obj_info(fcx.ccx);
|
||||
let this_obj_info: option::t<obj_info> = get_obj_info(fcx.ccx);
|
||||
alt this_obj_info {
|
||||
some(oinfo) {
|
||||
alt oinfo {
|
||||
|
|
@ -2205,7 +2205,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
}
|
||||
ast::expr_rec(fields, base) {
|
||||
alt base { none. {/* no-op */ } some(b_0) { check_expr(fcx, b_0); } }
|
||||
let fields_t: [spanned[field]] = ~[];
|
||||
let fields_t: [spanned<field>] = ~[];
|
||||
for f: ast::field in fields {
|
||||
bot |= check_expr(fcx, f.node.expr);
|
||||
let expr_t = expr_ty(tcx, f.node.expr);
|
||||
|
|
@ -2218,7 +2218,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
}
|
||||
alt base {
|
||||
none. {
|
||||
fn get_node(f: &spanned[field]) -> field { f.node }
|
||||
fn get_node(f: &spanned<field>) -> field { f.node }
|
||||
let typ = ty::mk_rec(tcx, vec::map(get_node, fields_t));
|
||||
write::ty_only_fixup(fcx, id, typ);
|
||||
}
|
||||
|
|
@ -2234,7 +2234,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
}
|
||||
}
|
||||
write::ty_only_fixup(fcx, id, bexpr_t);
|
||||
for f: spanned[ty::field] in fields_t {
|
||||
for f: spanned<ty::field> in fields_t {
|
||||
let found = false;
|
||||
for bf: ty::field in base_fields {
|
||||
if str::eq(f.node.ident, bf.ident) {
|
||||
|
|
@ -2362,7 +2362,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
// type.
|
||||
let inner_obj_methods: [ty::method] = ~[];
|
||||
let inner_obj_ty: ty::t = ty::mk_nil(tcx);
|
||||
let inner_obj_sty: option::t[ty::sty] = none;
|
||||
let inner_obj_sty: option::t<ty::sty> = none;
|
||||
alt ao.inner_obj {
|
||||
none. { }
|
||||
some(e) {
|
||||
|
|
@ -2399,7 +2399,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
fn filtering_fn(ccx: @crate_ctxt,
|
||||
m: &ty::method,
|
||||
outer_obj_methods: [@ast::method]) ->
|
||||
option::t[ty::method] {
|
||||
option::t<ty::method> {
|
||||
|
||||
for om: @ast::method in outer_obj_methods {
|
||||
if str::eq(om.node.ident, m.ident) {
|
||||
|
|
@ -2473,7 +2473,7 @@ fn next_ty_var(fcx: &@fn_ctxt) -> ty::t {
|
|||
ret ty::mk_var(fcx.ccx.tcx, next_ty_var_id(fcx));
|
||||
}
|
||||
|
||||
fn get_obj_info(ccx: &@crate_ctxt) -> option::t[obj_info] {
|
||||
fn get_obj_info(ccx: &@crate_ctxt) -> option::t<obj_info> {
|
||||
ret vec::last[obj_info](ccx.obj_infos);
|
||||
}
|
||||
|
||||
|
|
@ -2578,7 +2578,7 @@ fn check_const(ccx: &@crate_ctxt, sp: &span, e: &@ast::expr,
|
|||
}
|
||||
|
||||
fn check_fn(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
|
||||
old_fcx: &option::t[@fn_ctxt]) {
|
||||
old_fcx: &option::t<@fn_ctxt>) {
|
||||
let decl = f.decl;
|
||||
let body = f.body;
|
||||
let gather_result = gather_locals(ccx, f, id, old_fcx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue