rustc: Remove unneeded type params from alt patterns
This commit is contained in:
parent
ed0eb8f45a
commit
81fc2d8728
18 changed files with 271 additions and 271 deletions
|
@ -272,8 +272,8 @@ fn build_session_options(str binary, getopts::match match)
|
|||
};
|
||||
|
||||
auto sysroot = alt (sysroot_opt) {
|
||||
case (none[str]) { get_default_sysroot(binary) }
|
||||
case (some[str](?s)) { s }
|
||||
case (none) { get_default_sysroot(binary) }
|
||||
case (some(?s)) { s }
|
||||
};
|
||||
|
||||
let @session::options sopts =
|
||||
|
@ -376,7 +376,7 @@ fn main(vec[str] args) {
|
|||
ret;
|
||||
} else {
|
||||
alt (output_file) {
|
||||
case (none[str]) {
|
||||
case (none) {
|
||||
let vec[str] parts = str::split(ifile, '.' as u8);
|
||||
vec::pop[str](parts);
|
||||
saved_out_filename = parts.(0);
|
||||
|
@ -392,7 +392,7 @@ fn main(vec[str] args) {
|
|||
auto ofile = str::connect(parts, ".");
|
||||
compile_input(sess, env, ifile, ofile);
|
||||
}
|
||||
case (some[str](?ofile)) {
|
||||
case (some(?ofile)) {
|
||||
saved_out_filename = ofile;
|
||||
compile_input(sess, env, ifile, ofile);
|
||||
}
|
||||
|
|
|
@ -182,8 +182,8 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
|
|||
auto len = parse_hex(st);
|
||||
assert (next(st) as char == '#');
|
||||
alt (st.tcx.rcache.find(tup(st.crate,pos,len))) {
|
||||
case (some[ty::t](?tt)) { ret tt; }
|
||||
case (none[ty::t]) {
|
||||
case (some(?tt)) { ret tt; }
|
||||
case (none) {
|
||||
auto ps = @rec(pos=pos, len=len with *st);
|
||||
auto tt = parse_ty(ps, sd);
|
||||
st.tcx.rcache.insert(tup(st.crate,pos,len), tt);
|
||||
|
@ -262,10 +262,10 @@ fn parse_ty_fn(@pstate st, str_def sd) -> tup(vec[ty::arg], ty::t,
|
|||
st.pos = st.pos + 1u;
|
||||
auto res = parse_ty_or_bang(st, sd);
|
||||
alt (res) {
|
||||
case (a_bang[ty::t]) {
|
||||
case (a_bang) {
|
||||
ret tup(inputs, ty::mk_bot(st.tcx), ast::noreturn);
|
||||
}
|
||||
case (a_ty[ty::t](?t)) {
|
||||
case (a_ty(?t)) {
|
||||
ret tup(inputs, t, ast::return);
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ fn load_crate(session::session sess,
|
|||
for (str library_search_path in library_search_paths) {
|
||||
auto path = fs::connect(library_search_path, filename);
|
||||
alt (get_metadata_section(path)) {
|
||||
case (option::some[vec[u8]](?cvec)) {
|
||||
case (option::some(?cvec)) {
|
||||
sess.set_external_crate(cnum, rec(name=ident, data=cvec));
|
||||
ret;
|
||||
}
|
||||
|
@ -594,10 +594,10 @@ fn get_tag_variants(ty::ctxt tcx, ast::def_id def)
|
|||
|
||||
fn list_file_metadata(str path, io::writer out) {
|
||||
alt (get_metadata_section(path)) {
|
||||
case (option::some[vec[u8]](?bytes)) {
|
||||
case (option::some(?bytes)) {
|
||||
list_crate_metadata(bytes, out);
|
||||
}
|
||||
case (option::none[vec[u8]]) {
|
||||
case (option::none) {
|
||||
out.write_str("Could not find metadata in " + path + ".\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ fn eval_crate_directive_expr(ctx cx,
|
|||
}
|
||||
|
||||
alt (elopt) {
|
||||
case (some[@ast::expr](?els)) {
|
||||
case (some(?els)) {
|
||||
ret eval_crate_directive_expr(cx, e, els, prefix,
|
||||
view_items, items);
|
||||
}
|
||||
|
@ -370,10 +370,10 @@ fn eval_crate_directive(ctx cx,
|
|||
|
||||
auto file_path = id + ".rs";
|
||||
alt (file_opt) {
|
||||
case (some[filename](?f)) {
|
||||
case (some(?f)) {
|
||||
file_path = f;
|
||||
}
|
||||
case (none[filename]) {}
|
||||
case (none) {}
|
||||
}
|
||||
|
||||
auto full_path = prefix + std::fs::path_sep() + file_path;
|
||||
|
@ -401,10 +401,10 @@ fn eval_crate_directive(ctx cx,
|
|||
|
||||
auto path = id;
|
||||
alt (dir_opt) {
|
||||
case (some[filename](?d)) {
|
||||
case (some(?d)) {
|
||||
path = d;
|
||||
}
|
||||
case (none[filename]) {}
|
||||
case (none) {}
|
||||
}
|
||||
|
||||
auto full_path = prefix + std::fs::path_sep() + path;
|
||||
|
|
|
@ -28,10 +28,10 @@ fn expand_syntax_ext(parser::parser p,
|
|||
|
||||
auto var = expr_to_str(p, args.(0));
|
||||
alt (generic_os::getenv(var)) {
|
||||
case (option::none[str]) {
|
||||
case (option::none) {
|
||||
ret make_new_str(p, sp, "");
|
||||
}
|
||||
case (option::some[str](?s)) {
|
||||
case (option::some(?s)) {
|
||||
ret make_new_str(p, sp, s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ fn pieces_to_expr(parser p, vec[piece] pieces, vec[@ast::expr] args)
|
|||
auto unsupported = "conversion not supported in #fmt string";
|
||||
|
||||
alt (cnv.param) {
|
||||
case (option::none[int]) {
|
||||
case (option::none) {
|
||||
}
|
||||
case (_) {
|
||||
log_err unsupported;
|
||||
|
@ -407,7 +407,7 @@ fn pieces_to_expr(parser p, vec[piece] pieces, vec[@ast::expr] args)
|
|||
|
||||
fn log_conv(conv c) {
|
||||
alt (c.param) {
|
||||
case (some[int](?p)) {
|
||||
case (some(?p)) {
|
||||
log "param: " + std::int::to_str(p, 10u);
|
||||
}
|
||||
case (_) {
|
||||
|
|
|
@ -367,10 +367,10 @@ fn scan_number(char c, &reader rdr) -> token::token {
|
|||
c = rdr.curr();
|
||||
auto exponent_str = scan_exponent(rdr);
|
||||
alt (exponent_str) {
|
||||
case (some[str](?s)) {
|
||||
case (some(?s)) {
|
||||
float_str += s;
|
||||
}
|
||||
case (none[str]) {
|
||||
case (none) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -400,11 +400,11 @@ fn scan_number(char c, &reader rdr) -> token::token {
|
|||
|
||||
auto maybe_exponent = scan_exponent(rdr);
|
||||
alt(maybe_exponent) {
|
||||
case(some[str](?s)) {
|
||||
case(some(?s)) {
|
||||
ret token::LIT_FLOAT(interner::intern[str](*rdr.get_interner(),
|
||||
dec_str + s));
|
||||
}
|
||||
case(none[str]) {
|
||||
case(none) {
|
||||
ret token::LIT_INT(accum_int);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,10 +352,10 @@ fn parse_ty_fn(ast::proto proto, &parser p, uint lo)
|
|||
p.bump();
|
||||
auto tmp = parse_ty_or_bang(p);
|
||||
alt (tmp) {
|
||||
case (a_ty[@ast::ty](?t)) {
|
||||
case (a_ty(?t)) {
|
||||
output = t;
|
||||
}
|
||||
case (a_bang[@ast::ty]) {
|
||||
case (a_bang) {
|
||||
output = @spanned(lo, inputs.span.hi, ast::ty_bot);
|
||||
cf = ast::noreturn;
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ fn parse_seq_to_end[T](token::token ket,
|
|||
let vec[T] v = [];
|
||||
while (p.peek() != ket) {
|
||||
alt(sep) {
|
||||
case (some[token::token](?t)) {
|
||||
case (some(?t)) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
|
@ -1666,7 +1666,7 @@ fn parse_block(&parser p) -> ast::block {
|
|||
case (_) {
|
||||
auto stmt = parse_stmt(p);
|
||||
alt (stmt_to_expr(stmt)) {
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
alt (p.peek()) {
|
||||
case (token::SEMI) {
|
||||
p.bump();
|
||||
|
@ -1684,7 +1684,7 @@ fn parse_block(&parser p) -> ast::block {
|
|||
}
|
||||
}
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
// Not an expression statement.
|
||||
stmts += [stmt];
|
||||
// FIXME: crazy differentiation between conditions
|
||||
|
@ -1748,11 +1748,11 @@ fn parse_fn_decl(&parser p, ast::purity purity) -> ast::fn_decl {
|
|||
}
|
||||
|
||||
alt (res) {
|
||||
case (a_ty[@ast::ty](?t)) {
|
||||
case (a_ty(?t)) {
|
||||
ret rec(inputs=inputs.node, output=t,
|
||||
purity=purity, cf=ast::return);
|
||||
}
|
||||
case (a_bang[@ast::ty]) {
|
||||
case (a_bang) {
|
||||
ret rec(inputs=inputs.node,
|
||||
output=@spanned(p.get_lo_pos(),
|
||||
p.get_hi_pos(), ast::ty_bot),
|
||||
|
@ -2218,7 +2218,7 @@ fn parse_rest_import_name(&parser p, ast::ident first,
|
|||
auto hi = p.get_hi_pos();
|
||||
auto import_decl;
|
||||
alt (def_ident) {
|
||||
case(some[ast::ident](?i)) {
|
||||
case(some(?i)) {
|
||||
if (glob) {
|
||||
p.err("globbed imports can't be renamed");
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ mod Encode {
|
|||
case (ac_no_abbrevs) {
|
||||
auto result_str;
|
||||
alt (cx.tcx.short_names_cache.find(t)) {
|
||||
case (some[str](?s)) { result_str = s; }
|
||||
case (none[str]) {
|
||||
case (some(?s)) { result_str = s; }
|
||||
case (none) {
|
||||
auto sw = io::string_writer();
|
||||
enc_sty(sw.get_writer(), cx, ty::struct(cx.tcx, t));
|
||||
result_str = sw.get_str();
|
||||
|
@ -95,11 +95,11 @@ mod Encode {
|
|||
}
|
||||
case (ac_use_abbrevs(?abbrevs)) {
|
||||
alt (abbrevs.find(t)) {
|
||||
case (some[ty_abbrev](?a)) {
|
||||
case (some(?a)) {
|
||||
w.write_str(a.s);
|
||||
ret;
|
||||
}
|
||||
case (none[ty_abbrev]) {
|
||||
case (none) {
|
||||
auto pos = w.get_buf_writer().tell();
|
||||
auto ss = enc_sty(w, cx, ty::struct(cx.tcx, t));
|
||||
auto end = w.get_buf_writer().tell();
|
||||
|
|
|
@ -208,7 +208,7 @@ fn map_crate(&@env e, &ast::crate c) {
|
|||
fn link_glob(@env e, @mutable list[scope] sc, &@ast::view_item vi) {
|
||||
fn find_mod(@env e, list[scope] sc) -> @indexed_mod {
|
||||
alt (sc) {
|
||||
case (cons[scope](scope_item(?i), ?tl)) {
|
||||
case (cons(scope_item(?i), ?tl)) {
|
||||
alt(i.node) {
|
||||
case (ast::item_mod(_, _, ?defid)) {
|
||||
ret e.mod_map.get(defid._1);
|
||||
|
@ -506,11 +506,11 @@ fn lookup_path_strict(&env e, &list[scope] sc, &span sp, vec[ident] idents,
|
|||
fn lookup_in_scope_strict(&env e, list[scope] sc, &span sp, &ident id,
|
||||
namespace ns) -> def {
|
||||
alt (lookup_in_scope(e, sc, sp, id, ns)) {
|
||||
case (none[def]) {
|
||||
case (none) {
|
||||
unresolved(e, sp, id, ns_name(ns));
|
||||
fail;
|
||||
}
|
||||
case (some[def](?d)) {
|
||||
case (some(?d)) {
|
||||
ret d;
|
||||
}
|
||||
}
|
||||
|
@ -617,10 +617,10 @@ fn lookup_in_scope(&env e, list[scope] sc, &span sp, &ident id, namespace ns)
|
|||
auto left_fn_level2 = false;
|
||||
while (true) {
|
||||
alt (sc) {
|
||||
case (nil[scope]) {
|
||||
case (nil) {
|
||||
ret none[def];
|
||||
}
|
||||
case (cons[scope](?hd, ?tl)) {
|
||||
case (cons(?hd, ?tl)) {
|
||||
auto fnd = in_scope(e, sp, id, hd, ns);
|
||||
if (!option::is_none(fnd)) {
|
||||
auto df = option::get(fnd);
|
||||
|
@ -788,11 +788,11 @@ fn found_def_item(&@ast::item i, namespace ns) -> option::t[def] {
|
|||
fn lookup_in_mod_strict(&env e, def m, &span sp, &ident id,
|
||||
namespace ns, dir dr) -> def {
|
||||
alt (lookup_in_mod(e, m, sp, id, ns, dr)) {
|
||||
case (none[def]) {
|
||||
case (none) {
|
||||
unresolved(e, sp, id, ns_name(ns));
|
||||
fail;
|
||||
}
|
||||
case (some[def](?d)) {
|
||||
case (some(?d)) {
|
||||
ret d;
|
||||
}
|
||||
}
|
||||
|
@ -872,12 +872,12 @@ fn lookup_in_local_mod(&env e, def_id defid, &span sp,
|
|||
ret none[def]; // name is not visible
|
||||
}
|
||||
alt(info.index.find(id)) {
|
||||
case (none[list[mod_index_entry]]) { }
|
||||
case (some[list[mod_index_entry]](?lst)) {
|
||||
case (none) { }
|
||||
case (some(?lst)) {
|
||||
while (true) {
|
||||
alt (lst) {
|
||||
case (nil[mod_index_entry]) { break; }
|
||||
case (cons[mod_index_entry](?hd, ?tl)) {
|
||||
case (nil) { break; }
|
||||
case (cons(?hd, ?tl)) {
|
||||
auto found = lookup_in_mie(e, hd, ns);
|
||||
if (!option::is_none(found)) { ret found; }
|
||||
lst = *tl;
|
||||
|
@ -987,10 +987,10 @@ fn lookup_in_mie(&env e, &mod_index_entry mie, namespace ns)
|
|||
fn add_to_index(&hashmap[ident,list[mod_index_entry]] index, &ident id,
|
||||
&mod_index_entry ent) {
|
||||
alt (index.find(id)) {
|
||||
case (none[list[mod_index_entry]]) {
|
||||
case (none) {
|
||||
index.insert(id, cons(ent, @nil[mod_index_entry]));
|
||||
}
|
||||
case (some[list[mod_index_entry]](?prev)) {
|
||||
case (some(?prev)) {
|
||||
index.insert(id, cons(ent, @prev));
|
||||
}
|
||||
}
|
||||
|
@ -1134,7 +1134,7 @@ fn check_mod_name(&env e, &ident name, &list[mod_index_entry] entries) {
|
|||
|
||||
while (true) {
|
||||
alt (entries) {
|
||||
case (cons[mod_index_entry](?entry, ?rest)) {
|
||||
case (cons(?entry, ?rest)) {
|
||||
if (!option::is_none(lookup_in_mie(e, entry, ns_value))) {
|
||||
if (saw_value) { dup(e, mie_span(entry), "", name); }
|
||||
else { saw_value = true; }
|
||||
|
@ -1149,7 +1149,7 @@ fn check_mod_name(&env e, &ident name, &list[mod_index_entry] entries) {
|
|||
}
|
||||
entries = *rest;
|
||||
}
|
||||
case (nil[mod_index_entry]) { break; }
|
||||
case (nil) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,8 +307,8 @@ fn path_name(&vec[str] path) -> str {
|
|||
fn get_type_sha1(&@crate_ctxt ccx, &ty::t t) -> str {
|
||||
auto hash = "";
|
||||
alt (ccx.type_sha1s.find(t)) {
|
||||
case (some[str](?h)) { hash = h; }
|
||||
case (none[str]) {
|
||||
case (some(?h)) { hash = h; }
|
||||
case (none) {
|
||||
ccx.sha.reset();
|
||||
auto f = metadata::def_to_str;
|
||||
// NB: do *not* use abbrevs here as we want the symbol names
|
||||
|
@ -755,7 +755,7 @@ fn type_of_fn_full(&@crate_ctxt cx,
|
|||
|
||||
// Arg 2: Env (closure-bindings / self-obj)
|
||||
alt (obj_self) {
|
||||
case (some[TypeRef](?t)) {
|
||||
case (some(?t)) {
|
||||
assert (t as int != 0);
|
||||
atys += [t];
|
||||
}
|
||||
|
@ -1710,12 +1710,12 @@ fn trans_stack_local_derived_tydesc(&@block_ctxt cx, ValueRef llsz,
|
|||
fn get_derived_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
||||
&mutable option::t[@tydesc_info] static_ti) -> result {
|
||||
alt (cx.fcx.derived_tydescs.find(t)) {
|
||||
case (some[derived_tydesc_info](?info)) {
|
||||
case (some(?info)) {
|
||||
// If the tydesc escapes in this context, the cached derived
|
||||
// tydesc also has to be one that was marked as escaping.
|
||||
if (!(escapes && !info.escapes)) { ret res(cx, info.lltydesc); }
|
||||
}
|
||||
case (none[derived_tydesc_info]) { /* fall through */ }
|
||||
case (none) { /* fall through */ }
|
||||
}
|
||||
|
||||
cx.fcx.lcx.ccx.stats.n_derived_tydescs += 1u;
|
||||
|
@ -1789,8 +1789,8 @@ fn get_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
|||
&mutable option::t[@tydesc_info] static_ti) -> result {
|
||||
// Is the supplied type a type param? If so, return the passed-in tydesc.
|
||||
alt (ty::type_param(cx.fcx.lcx.ccx.tcx, t)) {
|
||||
case (some[uint](?id)) { ret res(cx, cx.fcx.lltydescs.(id)); }
|
||||
case (none[uint]) { /* fall through */ }
|
||||
case (some(?id)) { ret res(cx, cx.fcx.lltydescs.(id)); }
|
||||
case (none) { /* fall through */ }
|
||||
}
|
||||
|
||||
// Does it contain a type param? If so, generate a derived tydesc.
|
||||
|
@ -1809,10 +1809,10 @@ fn get_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
|||
fn get_static_tydesc(&@block_ctxt cx,
|
||||
&ty::t t, &vec[uint] ty_params) -> @tydesc_info {
|
||||
alt (cx.fcx.lcx.ccx.tydescs.find(t)) {
|
||||
case (some[@tydesc_info](?info)) {
|
||||
case (some(?info)) {
|
||||
ret info;
|
||||
}
|
||||
case (none[@tydesc_info]) {
|
||||
case (none) {
|
||||
cx.fcx.lcx.ccx.stats.n_static_tydescs += 1u;
|
||||
auto info = declare_tydesc(cx.fcx.lcx, cx.sp, t, ty_params);
|
||||
cx.fcx.lcx.ccx.tydescs.insert(t, info);
|
||||
|
@ -1981,44 +1981,44 @@ fn emit_tydescs(&@crate_ctxt ccx) {
|
|||
auto ti = pair._1;
|
||||
|
||||
auto take_glue = alt (ti.take_glue) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
ccx.stats.n_null_glues += 1u;
|
||||
C_null(glue_fn_ty)
|
||||
}
|
||||
case (some[ValueRef](?v)) {
|
||||
case (some(?v)) {
|
||||
ccx.stats.n_real_glues += 1u;
|
||||
v
|
||||
}
|
||||
};
|
||||
|
||||
auto drop_glue = alt (ti.drop_glue) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
ccx.stats.n_null_glues += 1u;
|
||||
C_null(glue_fn_ty)
|
||||
}
|
||||
case (some[ValueRef](?v)) {
|
||||
case (some(?v)) {
|
||||
ccx.stats.n_real_glues += 1u;
|
||||
v
|
||||
}
|
||||
};
|
||||
|
||||
auto free_glue = alt (ti.free_glue) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
ccx.stats.n_null_glues += 1u;
|
||||
C_null(glue_fn_ty)
|
||||
}
|
||||
case (some[ValueRef](?v)) {
|
||||
case (some(?v)) {
|
||||
ccx.stats.n_real_glues += 1u;
|
||||
v
|
||||
}
|
||||
};
|
||||
|
||||
auto cmp_glue = alt (ti.cmp_glue) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
ccx.stats.n_null_glues += 1u;
|
||||
C_null(cmp_fn_ty)
|
||||
}
|
||||
case (some[ValueRef](?v)) {
|
||||
case (some(?v)) {
|
||||
ccx.stats.n_real_glues += 1u;
|
||||
v
|
||||
}
|
||||
|
@ -2934,13 +2934,13 @@ fn lazily_emit_all_generic_info_tydesc_glues(&@block_ctxt cx,
|
|||
fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
|
||||
&option::t[@tydesc_info] static_ti) {
|
||||
alt (static_ti) {
|
||||
case (none[@tydesc_info]) { }
|
||||
case (some[@tydesc_info](?ti)) {
|
||||
case (none) { }
|
||||
case (some(?ti)) {
|
||||
|
||||
if(field == abi::tydesc_field_take_glue) {
|
||||
alt (ti.take_glue) {
|
||||
case (some[ValueRef](_)) {}
|
||||
case (none[ValueRef]) {
|
||||
case (some(_)) {}
|
||||
case (none) {
|
||||
log #fmt("+++ lazily_emit_tydesc_glue TAKE %s",
|
||||
ty::ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
|
||||
|
||||
|
@ -2960,8 +2960,8 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
|
|||
}
|
||||
} else if (field == abi::tydesc_field_drop_glue) {
|
||||
alt (ti.drop_glue) {
|
||||
case (some[ValueRef](_)) { }
|
||||
case (none[ValueRef]) {
|
||||
case (some(_)) { }
|
||||
case (none) {
|
||||
log #fmt("+++ lazily_emit_tydesc_glue DROP %s",
|
||||
ty::ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
|
||||
auto lcx = cx.fcx.lcx;
|
||||
|
@ -2980,8 +2980,8 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
|
|||
|
||||
} else if (field == abi::tydesc_field_free_glue) {
|
||||
alt (ti.free_glue) {
|
||||
case (some[ValueRef](_)) { }
|
||||
case (none[ValueRef]) {
|
||||
case (some(_)) { }
|
||||
case (none) {
|
||||
log #fmt("+++ lazily_emit_tydesc_glue FREE %s",
|
||||
ty::ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
|
||||
auto lcx = cx.fcx.lcx;
|
||||
|
@ -3001,8 +3001,8 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
|
|||
|
||||
} else if (field == abi::tydesc_field_cmp_glue) {
|
||||
alt (ti.cmp_glue) {
|
||||
case (some[ValueRef](_)) { }
|
||||
case (none[ValueRef]) {
|
||||
case (some(_)) { }
|
||||
case (none) {
|
||||
log #fmt("+++ lazily_emit_tydesc_glue CMP %s",
|
||||
ty::ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
|
||||
auto lcx = cx.fcx.lcx;
|
||||
|
@ -3726,7 +3726,7 @@ fn trans_if(&@block_ctxt cx, &@ast::expr cond,
|
|||
auto else_res;
|
||||
auto expr_llty;
|
||||
alt (els) {
|
||||
case (some[@ast::expr](?elexpr)) {
|
||||
case (some(?elexpr)) {
|
||||
alt (elexpr.node) {
|
||||
case (ast::expr_if(_, _, _, ?ann)) {
|
||||
// Synthesize a block here to act as the else block
|
||||
|
@ -3931,7 +3931,7 @@ fn trans_for_each(&@block_ctxt cx,
|
|||
for (ast::def_id did in upvars) {
|
||||
auto llbinding;
|
||||
alt (cx.fcx.lllocals.find(did)) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
alt (cx.fcx.llupvars.find(did)) {
|
||||
case (none[ValueRef]) {
|
||||
llbinding = cx.fcx.llargs.get(did);
|
||||
|
@ -3939,7 +3939,7 @@ fn trans_for_each(&@block_ctxt cx,
|
|||
case (some[ValueRef](?llval)) { llbinding = llval; }
|
||||
}
|
||||
}
|
||||
case (some[ValueRef](?llval)) { llbinding = llval; }
|
||||
case (some(?llval)) { llbinding = llval; }
|
||||
}
|
||||
llbindings += [llbinding];
|
||||
llbindingtys += [val_ty(llbinding)];
|
||||
|
@ -4379,7 +4379,7 @@ fn lval_generic_fn(&@block_ctxt cx,
|
|||
fn lookup_discriminant(&@local_ctxt lcx, &ast::def_id tid, &ast::def_id vid)
|
||||
-> ValueRef {
|
||||
alt (lcx.ccx.discrims.find(vid)) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
// It's an external discriminant that we haven't seen yet.
|
||||
assert (lcx.ccx.sess.get_targ_crate_num() != vid._0);
|
||||
auto sym = creader::get_symbol(lcx.ccx.sess, vid);
|
||||
|
@ -4391,7 +4391,7 @@ fn lookup_discriminant(&@local_ctxt lcx, &ast::def_id tid, &ast::def_id vid)
|
|||
lcx.ccx.discrims.insert(vid, gvar);
|
||||
ret gvar;
|
||||
}
|
||||
case (some[ValueRef](?llval)) { ret llval; }
|
||||
case (some(?llval)) { ret llval; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4399,22 +4399,22 @@ fn trans_path(&@block_ctxt cx, &ast::path p, &ast::ann ann) -> lval_result {
|
|||
alt (cx.fcx.lcx.ccx.tcx.def_map.get(ann.id)) {
|
||||
case (ast::def_arg(?did)) {
|
||||
alt (cx.fcx.llargs.find(did)) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
assert (cx.fcx.llupvars.contains_key(did));
|
||||
ret lval_mem(cx, cx.fcx.llupvars.get(did));
|
||||
}
|
||||
case (some[ValueRef](?llval)) {
|
||||
case (some(?llval)) {
|
||||
ret lval_mem(cx, llval);
|
||||
}
|
||||
}
|
||||
}
|
||||
case (ast::def_local(?did)) {
|
||||
alt (cx.fcx.lllocals.find(did)) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
assert (cx.fcx.llupvars.contains_key(did));
|
||||
ret lval_mem(cx, cx.fcx.llupvars.get(did));
|
||||
}
|
||||
case (some[ValueRef](?llval)) {
|
||||
case (some(?llval)) {
|
||||
ret lval_mem(cx, llval);
|
||||
}
|
||||
}
|
||||
|
@ -4614,7 +4614,7 @@ fn trans_lval(&@block_ctxt cx, &@ast::expr e) -> lval_result {
|
|||
}
|
||||
case (ast::expr_self_method(?ident, ?ann)) {
|
||||
alt (cx.fcx.llself) {
|
||||
case (some[self_vt](?s_vt)) {
|
||||
case (some(?s_vt)) {
|
||||
auto r = s_vt.v;
|
||||
auto t = s_vt.t;
|
||||
ret trans_field(cx, e.span, r, t, ident, ann);
|
||||
|
@ -4750,7 +4750,7 @@ fn trans_bind_thunk(&@local_ctxt cx,
|
|||
alt (arg) {
|
||||
|
||||
// Arg provided at binding time; thunk copies it from closure.
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
auto e_ty = ty::expr_ty(cx.ccx.tcx, e);
|
||||
auto bound_arg =
|
||||
GEP_tup_like(bcx, closure_ty, llclosure,
|
||||
|
@ -4781,7 +4781,7 @@ fn trans_bind_thunk(&@local_ctxt cx,
|
|||
}
|
||||
|
||||
// Arg will be provided when the thunk is invoked.
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
let ValueRef passed_arg = llvm::LLVMGetParam(llthunk, a);
|
||||
|
||||
if (ty::type_contains_params(cx.ccx.tcx, out_arg.ty)) {
|
||||
|
@ -4834,9 +4834,9 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
|
|||
|
||||
for (option::t[@ast::expr] argopt in args) {
|
||||
alt (argopt) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
}
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
vec::push[@ast::expr](bound, e);
|
||||
}
|
||||
}
|
||||
|
@ -4846,11 +4846,11 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
|
|||
let ty::t outgoing_fty;
|
||||
let vec[ValueRef] lltydescs;
|
||||
alt (f_res.generic) {
|
||||
case (none[generic_info]) {
|
||||
case (none) {
|
||||
outgoing_fty = ty::expr_ty(cx.fcx.lcx.ccx.tcx, f);
|
||||
lltydescs = [];
|
||||
}
|
||||
case (some[generic_info](?ginfo)) {
|
||||
case (some(?ginfo)) {
|
||||
lazily_emit_all_generic_info_tydesc_glues(cx, ginfo);
|
||||
outgoing_fty = ginfo.item_type;
|
||||
lltydescs = ginfo.tydescs;
|
||||
|
@ -4965,8 +4965,8 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
|
|||
// appropriate slot in the closure.
|
||||
|
||||
alt (f_res.generic) {
|
||||
case (none[generic_info]) { /* nothing to do */ }
|
||||
case (some[generic_info](?ginfo)) {
|
||||
case (none) { /* nothing to do */ }
|
||||
case (some(?ginfo)) {
|
||||
lazily_emit_all_generic_info_tydesc_glues(cx, ginfo);
|
||||
auto ty_params_slot =
|
||||
bcx.build.GEP(closure,
|
||||
|
@ -5114,7 +5114,7 @@ fn trans_args(&@block_ctxt cx,
|
|||
auto llretslot = llretslot_res.val;
|
||||
|
||||
alt (gen) {
|
||||
case (some[generic_info](?g)) {
|
||||
case (some(?g)) {
|
||||
lazily_emit_all_generic_info_tydesc_glues(cx, g);
|
||||
lltydescs = g.tydescs;
|
||||
args = ty::ty_fn_args(cx.fcx.lcx.ccx.tcx, g.item_type);
|
||||
|
@ -5145,7 +5145,7 @@ fn trans_args(&@block_ctxt cx,
|
|||
|
||||
// Arg 2: Env (closure-bindings / self-obj)
|
||||
alt (llobj) {
|
||||
case (some[ValueRef](?ob)) {
|
||||
case (some(?ob)) {
|
||||
// Every object is always found in memory,
|
||||
// and not-yet-loaded (as part of an lval x.y
|
||||
// doted method-call).
|
||||
|
@ -5161,8 +5161,8 @@ fn trans_args(&@block_ctxt cx,
|
|||
|
||||
// ... then possibly an lliterbody argument.
|
||||
alt (lliterbody) {
|
||||
case (none[ValueRef]) {}
|
||||
case (some[ValueRef](?lli)) {
|
||||
case (none) {}
|
||||
case (some(?lli)) {
|
||||
llargs += [lli];
|
||||
}
|
||||
}
|
||||
|
@ -5199,11 +5199,11 @@ fn trans_call(&@block_ctxt cx, &@ast::expr f,
|
|||
auto llenv = C_null(T_opaque_closure_ptr(cx.fcx.lcx.ccx.tn));
|
||||
|
||||
alt (f_res.llobj) {
|
||||
case (some[ValueRef](_)) {
|
||||
case (some(_)) {
|
||||
// It's a vtbl entry.
|
||||
faddr = f_res.res.bcx.build.Load(faddr);
|
||||
}
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
// It's a closure.
|
||||
auto bcx = f_res.res.bcx;
|
||||
auto pair = faddr;
|
||||
|
@ -5220,7 +5220,7 @@ fn trans_call(&@block_ctxt cx, &@ast::expr f,
|
|||
|
||||
let ty::t fn_ty;
|
||||
alt (f_res.method_ty) {
|
||||
case (some[ty::t](?meth)) {
|
||||
case (some(?meth)) {
|
||||
// self-call
|
||||
fn_ty = meth;
|
||||
}
|
||||
|
@ -5254,7 +5254,7 @@ fn trans_call(&@block_ctxt cx, &@ast::expr f,
|
|||
auto retval = C_nil();
|
||||
|
||||
alt (lliterbody) {
|
||||
case (none[ValueRef]) {
|
||||
case (none) {
|
||||
if (!ty::type_is_nil(cx.fcx.lcx.ccx.tcx, ret_ty)) {
|
||||
retval = load_if_immediate(bcx, llretslot, ret_ty);
|
||||
// Retval doesn't correspond to anything really tangible in
|
||||
|
@ -5264,7 +5264,7 @@ fn trans_call(&@block_ctxt cx, &@ast::expr f,
|
|||
[clean(bind drop_ty(_, retval, ret_ty))];
|
||||
}
|
||||
}
|
||||
case (some[ValueRef](_)) {
|
||||
case (some(_)) {
|
||||
// If there was an lliterbody, it means we were calling an
|
||||
// iter, and we are *not* the party using its 'output' value,
|
||||
// we should ignore llretslot.
|
||||
|
@ -5387,8 +5387,8 @@ fn trans_rec(&@block_ctxt cx, &vec[ast::field] fields,
|
|||
auto base_val = C_nil();
|
||||
|
||||
alt (base) {
|
||||
case (none[@ast::expr]) { }
|
||||
case (some[@ast::expr](?bexp)) {
|
||||
case (none) { }
|
||||
case (some(?bexp)) {
|
||||
auto base_res = trans_expr(bcx, bexp);
|
||||
bcx = base_res.bcx;
|
||||
base_val = base_res.val;
|
||||
|
@ -5753,12 +5753,12 @@ fn trans_fail(&@block_ctxt cx, &option::t[common::span] sp_opt, &str fail_str)
|
|||
|
||||
auto V_filename; auto V_line;
|
||||
alt (sp_opt) {
|
||||
case (some[common::span](?sp)) {
|
||||
case (some(?sp)) {
|
||||
auto loc = cx.fcx.lcx.ccx.sess.lookup_pos(sp.lo);
|
||||
V_filename = C_cstr(cx.fcx.lcx.ccx, loc.filename);
|
||||
V_line = loc.line as int;
|
||||
}
|
||||
case (none[common::span]) {
|
||||
case (none) {
|
||||
V_filename = C_cstr(cx.fcx.lcx.ccx, "<runtime>");
|
||||
V_line = 0;
|
||||
}
|
||||
|
@ -5779,7 +5779,7 @@ fn trans_put(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
|
|||
auto llenv = C_nil();
|
||||
|
||||
alt (cx.fcx.lliterbody) {
|
||||
case (some[ValueRef](?lli)) {
|
||||
case (some(?lli)) {
|
||||
auto slot = alloca(cx, val_ty(lli));
|
||||
cx.build.Store(lli, slot);
|
||||
|
||||
|
@ -5796,8 +5796,8 @@ fn trans_put(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
|
|||
auto dummy_retslot = alloca(bcx, T_nil());
|
||||
let vec[ValueRef] llargs = [dummy_retslot, cx.fcx.lltaskptr, llenv];
|
||||
alt (e) {
|
||||
case (none[@ast::expr]) { }
|
||||
case (some[@ast::expr](?x)) {
|
||||
case (none) { }
|
||||
case (some(?x)) {
|
||||
auto e_ty = ty::expr_ty(cx.fcx.lcx.ccx.tcx, x);
|
||||
auto arg = rec(mode=ty::mo_alias, ty=e_ty);
|
||||
auto arg_tys = type_of_explicit_args(cx.fcx.lcx.ccx,
|
||||
|
@ -5823,7 +5823,7 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
|
|||
bcx.build.Br(_break.llbb);
|
||||
} else {
|
||||
alt (_cont) {
|
||||
case (option::some[@block_ctxt](?_cont)) {
|
||||
case (option::some(?_cont)) {
|
||||
bcx.build.Br(_cont.llbb);
|
||||
}
|
||||
case (_) {
|
||||
|
@ -5858,7 +5858,7 @@ fn trans_ret(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
|
|||
auto val = C_nil();
|
||||
|
||||
alt (e) {
|
||||
case (some[@ast::expr](?x)) {
|
||||
case (some(?x)) {
|
||||
auto t = ty::expr_ty(cx.fcx.lcx.ccx.tcx, x);
|
||||
auto r = trans_expr(cx, x);
|
||||
bcx = r.bcx;
|
||||
|
@ -5961,7 +5961,7 @@ fn trans_spawn(&@block_ctxt cx,
|
|||
common::expr_to_str(func),
|
||||
str::connect(argss, ", "))
|
||||
}
|
||||
case(some[str](?n)) {
|
||||
case(some(?n)) {
|
||||
n
|
||||
}
|
||||
};
|
||||
|
@ -6228,8 +6228,8 @@ fn trans_anon_obj(&@block_ctxt cx, &ast::span sp,
|
|||
|
||||
let option::t[result] with_obj_val = none[result];
|
||||
alt (anon_obj.with_obj) {
|
||||
case (none[@ast::expr]) { }
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (none) { }
|
||||
case (some(?e)) {
|
||||
// Translating with_obj returns a ValueRef (pointer to a 2-word
|
||||
// value) wrapped in a result. We want to allocate space for this
|
||||
// value in our outer object, then copy it into the outer object.
|
||||
|
@ -6244,8 +6244,8 @@ fn trans_anon_obj(&@block_ctxt cx, &ast::span sp,
|
|||
let vec[ast::arg] addtl_fn_args = [];
|
||||
|
||||
alt (anon_obj.fields) {
|
||||
case (none[vec[ast::obj_field]]) { }
|
||||
case (some[vec[ast::obj_field]](?fields)) {
|
||||
case (none) { }
|
||||
case (some(?fields)) {
|
||||
for (ast::obj_field f in fields) {
|
||||
addtl_fn_args += [rec(mode=ast::alias, ty=f.ty,
|
||||
ident=f.ident, id=f.id)];
|
||||
|
@ -6271,7 +6271,7 @@ fn init_local(&@block_ctxt cx, &@ast::local local) -> result {
|
|||
[clean(bind drop_slot(_, llptr, ty))];
|
||||
|
||||
alt (local.init) {
|
||||
case (some[ast::initializer](?init)) {
|
||||
case (some(?init)) {
|
||||
alt (init.op) {
|
||||
case (ast::init_assign) {
|
||||
auto sub = trans_expr(bcx, init.expr);
|
||||
|
@ -6492,7 +6492,7 @@ fn trans_block(&@block_ctxt cx, &ast::block b) -> result {
|
|||
}
|
||||
|
||||
alt (b.node.expr) {
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
// Hold onto the context for this scope since we'll need it to
|
||||
// find the outer scope
|
||||
auto scope_bcx = bcx;
|
||||
|
@ -6546,7 +6546,7 @@ fn trans_block(&@block_ctxt cx, &ast::block b) -> result {
|
|||
}
|
||||
}
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
r = res(bcx, C_nil());
|
||||
}
|
||||
}
|
||||
|
@ -6635,10 +6635,10 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,
|
|||
auto arg_n = 3u;
|
||||
|
||||
alt (ty_self) {
|
||||
case (some[tup(TypeRef, ty::t)](?tt)) {
|
||||
case (some(?tt)) {
|
||||
cx.llself = some[self_vt](rec(v = cx.llenv, t = tt._1));
|
||||
}
|
||||
case (none[tup(TypeRef, ty::t)]) {
|
||||
case (none) {
|
||||
auto i = 0u;
|
||||
for (ast::ty_param tp in ty_params) {
|
||||
auto llarg = llvm::LLVMGetParam(cx.llfn, arg_n);
|
||||
|
@ -6675,7 +6675,7 @@ fn copy_any_self_to_alloca(@fn_ctxt fcx,
|
|||
auto bcx = llallocas_block_ctxt(fcx);
|
||||
|
||||
alt (fcx.llself) {
|
||||
case (some[self_vt](?s_vt)) {
|
||||
case (some(?s_vt)) {
|
||||
alt (ty_self) {
|
||||
case (some[tup(TypeRef, ty::t)](?tt)) {
|
||||
auto a = alloca(bcx, tt._0);
|
||||
|
@ -6845,7 +6845,7 @@ fn trans_fn(@local_ctxt cx, &ast::span sp, &ast::_fn f, ast::def_id fid,
|
|||
copy_any_self_to_alloca(fcx, ty_self);
|
||||
|
||||
alt (fcx.llself) {
|
||||
case (some[self_vt](?llself)) {
|
||||
case (some(?llself)) {
|
||||
populate_fn_ctxt_from_llself(fcx, llself);
|
||||
}
|
||||
case (_) {
|
||||
|
@ -6877,11 +6877,11 @@ fn create_vtbl(@local_ctxt cx,
|
|||
&vec[ast::ty_param] ty_params) -> ValueRef {
|
||||
auto dtor = C_null(T_ptr(T_i8()));
|
||||
alt (ob.dtor) {
|
||||
case (some[@ast::method](?d)) {
|
||||
case (some(?d)) {
|
||||
auto dtor_1 = trans_dtor(cx, llself_ty, self_ty, ty_params, d);
|
||||
dtor = llvm::LLVMConstBitCast(dtor_1, val_ty(dtor));
|
||||
}
|
||||
case (none[@ast::method]) {}
|
||||
case (none) {}
|
||||
}
|
||||
let vec[ValueRef] methods = [dtor];
|
||||
|
||||
|
@ -7065,10 +7065,10 @@ fn trans_obj(@local_ctxt cx, &ast::span sp, &ast::_obj ob, ast::def_id oid,
|
|||
|
||||
auto dtor = C_null(T_ptr(T_glue_fn(ccx.tn)));
|
||||
alt (ob.dtor) {
|
||||
case (some[@ast::method](?d)) {
|
||||
case (some(?d)) {
|
||||
dtor = trans_dtor(cx, llself_ty, self_ty, ty_params, d);
|
||||
}
|
||||
case (none[@ast::method]) {}
|
||||
case (none) {}
|
||||
}
|
||||
|
||||
bcx = body_td.bcx;
|
||||
|
|
|
@ -232,12 +232,12 @@ fn get_ts_ann(&crate_ctxt ccx, uint i) -> option::t[ts_ann] {
|
|||
|
||||
fn ann_to_ts_ann(&crate_ctxt ccx, &ann a) -> ts_ann {
|
||||
alt (get_ts_ann(ccx, a.id)) {
|
||||
case (none[ts_ann]) {
|
||||
case (none) {
|
||||
log_err ("ann_to_ts_ann: no ts_ann for node_id "
|
||||
+ uistr(a.id));
|
||||
fail;
|
||||
}
|
||||
case (some[ts_ann](?t)) { ret t; }
|
||||
case (some(?t)) { ret t; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,8 +429,8 @@ fn new_crate_ctxt(ty::ctxt cx) -> crate_ctxt {
|
|||
|
||||
fn controlflow_def_id(&crate_ctxt ccx, &def_id d) -> controlflow {
|
||||
alt (ccx.fm.find(d)) {
|
||||
case (some[fn_info](?fi)) { ret fi.cf; }
|
||||
case (none[fn_info]) { ret return; }
|
||||
case (some(?fi)) { ret fi.cf; }
|
||||
case (none) { ret return; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,11 +451,11 @@ fn controlflow_expr(&crate_ctxt ccx, @expr e) -> controlflow {
|
|||
|
||||
fn ann_to_def_strict(&crate_ctxt ccx, &ann a) -> def {
|
||||
alt (ccx.tcx.def_map.find(a.id)) {
|
||||
case (none[def]) {
|
||||
case (none) {
|
||||
log_err("ann_to_def: node_id " + uistr(a.id) + " has no def");
|
||||
fail;
|
||||
}
|
||||
case (some[def](?d)) { ret d; }
|
||||
case (some(?d)) { ret d; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ fn find_pre_post_loop(&fn_ctxt fcx, &@decl d, &@expr index,
|
|||
fn gen_if_local(&fn_ctxt fcx, @expr lhs, @expr rhs,
|
||||
&ann larger_ann, &ann new_var) -> () {
|
||||
alt (ann_to_def(fcx.ccx, new_var)) {
|
||||
case (some[def](?d)) {
|
||||
case (some(?d)) {
|
||||
alt (d) {
|
||||
case (def_local(?d_id)) {
|
||||
find_pre_post_expr(fcx, rhs);
|
||||
|
@ -341,11 +341,11 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) -> () {
|
|||
}
|
||||
case(expr_put(?opt, ?a)) {
|
||||
alt (opt) {
|
||||
case (some[@expr](?arg)) {
|
||||
case (some(?arg)) {
|
||||
find_pre_post_expr(fcx, arg);
|
||||
copy_pre_post(fcx.ccx, a, arg);
|
||||
}
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
clear_pp(expr_pp(fcx.ccx, e));
|
||||
}
|
||||
}
|
||||
|
@ -392,11 +392,11 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) -> () {
|
|||
}
|
||||
case (expr_ret(?maybe_val, ?a)) {
|
||||
alt (maybe_val) {
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
clear_precond(fcx.ccx, a);
|
||||
set_postcond_false(fcx.ccx, a);
|
||||
}
|
||||
case (some[@expr](?ret_val)) {
|
||||
case (some(?ret_val)) {
|
||||
find_pre_post_expr(fcx, ret_val);
|
||||
set_precondition(ann_to_ts_ann(fcx.ccx, a),
|
||||
expr_precond(fcx.ccx, ret_val));
|
||||
|
@ -414,7 +414,7 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) -> () {
|
|||
find_pre_post_expr(fcx, antec);
|
||||
find_pre_post_block(fcx, conseq);
|
||||
alt (maybe_alt) {
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
log "333";
|
||||
auto precond_res = seq_preconds(fcx,
|
||||
[expr_pp(fcx.ccx, antec),
|
||||
|
@ -422,7 +422,7 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) -> () {
|
|||
set_pre_and_post(fcx.ccx, a, precond_res,
|
||||
expr_poststate(fcx.ccx, antec));
|
||||
}
|
||||
case (some[@expr](?altern)) {
|
||||
case (some(?altern)) {
|
||||
find_pre_post_expr(fcx, altern);
|
||||
log "444";
|
||||
auto precond_true_case =
|
||||
|
@ -570,11 +570,11 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) -> () {
|
|||
}
|
||||
case (expr_anon_obj(?anon_obj, _, _, ?a)) {
|
||||
alt (anon_obj.with_obj) {
|
||||
case (some[@expr](?ex)) {
|
||||
case (some(?ex)) {
|
||||
find_pre_post_expr(fcx, ex);
|
||||
copy_pre_post(fcx.ccx, a, ex);
|
||||
}
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
clear_pp(expr_pp(fcx.ccx, e));
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ fn find_pre_post_stmt(&fn_ctxt fcx, &stmt s)
|
|||
alt(adecl.node) {
|
||||
case(decl_local(?alocal)) {
|
||||
alt(alocal.init) {
|
||||
case(some[initializer](?an_init)) {
|
||||
case(some(?an_init)) {
|
||||
find_pre_post_expr(fcx, an_init.expr);
|
||||
copy_pre_post(fcx.ccx, alocal.ann, an_init.expr);
|
||||
|
||||
|
@ -610,7 +610,7 @@ fn find_pre_post_stmt(&fn_ctxt fcx, &stmt s)
|
|||
log_err("pp = ");
|
||||
log_pp(stmt_pp(s)); */
|
||||
}
|
||||
case(none[initializer]) {
|
||||
case(none) {
|
||||
clear_pp(ann_to_ts_ann(fcx.ccx,
|
||||
alocal.ann).conditions);
|
||||
clear_pp(ann_to_ts_ann(fcx.ccx, a).conditions);
|
||||
|
|
|
@ -204,7 +204,7 @@ fn find_pre_post_state_loop(&fn_ctxt fcx, prestate pres, &@decl d,
|
|||
|
||||
fn gen_if_local(&fn_ctxt fcx, &ann a_new_var, &ann a) -> bool {
|
||||
alt (ann_to_def(fcx.ccx, a_new_var)) {
|
||||
case (some[def](def_local(?loc))) {
|
||||
case (some(def_local(?loc))) {
|
||||
ret gen_poststate(fcx, a, loc);
|
||||
}
|
||||
case (_) { ret false; }
|
||||
|
@ -287,14 +287,14 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
|
|||
}
|
||||
case (expr_put(?maybe_e, ?a)) {
|
||||
alt (maybe_e) {
|
||||
case (some[@expr](?arg)) {
|
||||
case (some(?arg)) {
|
||||
changed = find_pre_post_state_expr(fcx, pres, arg);
|
||||
changed = extend_prestate_ann(fcx.ccx, a, pres) || changed;
|
||||
changed = extend_poststate_ann(fcx.ccx, a,
|
||||
expr_poststate(fcx.ccx, arg)) || changed;
|
||||
ret changed;
|
||||
}
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
ret pure_exp(fcx.ccx, a, pres);
|
||||
}
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
|
|||
changed = find_pre_post_state_exprs(fcx, pres, a,
|
||||
field_exprs(fields)) || changed;
|
||||
alt (maybe_base) {
|
||||
case (none[@expr]) { /* do nothing */ }
|
||||
case (some[@expr](?base)) {
|
||||
case (none) { /* do nothing */ }
|
||||
case (some(?base)) {
|
||||
changed = find_pre_post_state_expr(fcx, pres, base)
|
||||
|| changed;
|
||||
changed = extend_poststate_ann(fcx.ccx, a,
|
||||
|
@ -386,8 +386,8 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
|
|||
case (_) {}
|
||||
}
|
||||
alt(maybe_ret_val) {
|
||||
case (none[@expr]) { /* do nothing */ }
|
||||
case (some[@expr](?ret_val)) {
|
||||
case (none) { /* do nothing */ }
|
||||
case (some(?ret_val)) {
|
||||
changed = find_pre_post_state_expr(fcx,
|
||||
pres, ret_val) || changed;
|
||||
}
|
||||
|
@ -407,11 +407,11 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
|
|||
changed = find_pre_post_state_block(fcx,
|
||||
expr_poststate(fcx.ccx, antec), conseq) || changed;
|
||||
alt (maybe_alt) {
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
changed = extend_poststate_ann(fcx.ccx, a,
|
||||
expr_poststate(fcx.ccx, antec)) || changed;
|
||||
}
|
||||
case (some[@expr](?altern)) {
|
||||
case (some(?altern)) {
|
||||
changed = find_pre_post_state_expr(fcx,
|
||||
expr_poststate(fcx.ccx, antec), altern) || changed;
|
||||
auto poststate_res = intersect_postconds
|
||||
|
@ -594,14 +594,14 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
|
|||
}
|
||||
case (expr_anon_obj(?anon_obj, _, _,?a)) {
|
||||
alt (anon_obj.with_obj) {
|
||||
case (some[@expr](?e)) {
|
||||
case (some(?e)) {
|
||||
changed = find_pre_post_state_expr(fcx, pres, e);
|
||||
changed = extend_prestate_ann(fcx.ccx, a, pres) || changed;
|
||||
changed = extend_poststate_ann(fcx.ccx, a,
|
||||
expr_poststate(fcx.ccx, e)) || changed;
|
||||
ret changed;
|
||||
}
|
||||
case (none[@expr]) {
|
||||
case (none) {
|
||||
ret pure_exp(fcx.ccx, a, pres);
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ fn find_pre_post_state_stmt(&fn_ctxt fcx, &prestate pres, @stmt s) -> bool {
|
|||
alt (adecl.node) {
|
||||
case (decl_local(?alocal)) {
|
||||
alt (alocal.init) {
|
||||
case (some[initializer](?an_init)) {
|
||||
case (some(?an_init)) {
|
||||
changed = extend_prestate
|
||||
(stmt_ann.states.prestate, pres) || changed;
|
||||
changed = find_pre_post_state_expr
|
||||
|
@ -650,7 +650,7 @@ fn find_pre_post_state_stmt(&fn_ctxt fcx, &prestate pres, @stmt s) -> bool {
|
|||
|
||||
ret changed;
|
||||
}
|
||||
case (none[initializer]) {
|
||||
case (none) {
|
||||
changed = extend_prestate
|
||||
(stmt_ann.states.prestate, pres) || changed;
|
||||
changed = extend_poststate
|
||||
|
@ -716,8 +716,8 @@ fn find_pre_post_state_block(&fn_ctxt fcx, &prestate pres0, &block b)
|
|||
auto post = pres;
|
||||
|
||||
alt (b.node.expr) {
|
||||
case (none[@expr]) {}
|
||||
case (some[@expr](?e)) {
|
||||
case (none) {}
|
||||
case (some(?e)) {
|
||||
changed = find_pre_post_state_expr(fcx, pres, e) || changed;
|
||||
post = expr_poststate(fcx.ccx, e);
|
||||
}
|
||||
|
|
|
@ -551,7 +551,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
|
|||
}
|
||||
|
||||
alt (ident) {
|
||||
case (some[ast::ident](?i)) {
|
||||
case (some(?i)) {
|
||||
s += " ";
|
||||
s += i;
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
|
|||
}
|
||||
|
||||
alt (cname(cx, typ)) {
|
||||
case (some[str](?cs)) {
|
||||
case (some(?cs)) {
|
||||
ret cs;
|
||||
}
|
||||
case (_) { }
|
||||
|
@ -1232,8 +1232,8 @@ fn hash_type_structure(&sty st) -> uint {
|
|||
fn hash_type_info(&sty st, &option::t[str] cname_opt) -> uint {
|
||||
auto h = hash_type_structure(st);
|
||||
alt (cname_opt) {
|
||||
case (none[str]) { /* no-op */ }
|
||||
case (some[str](?s)) { h += h << 5u + str::hash(s); }
|
||||
case (none) { /* no-op */ }
|
||||
case (some(?s)) { h += h << 5u + str::hash(s); }
|
||||
}
|
||||
ret h;
|
||||
}
|
||||
|
@ -1500,15 +1500,15 @@ fn eq_raw_ty(&raw_t a, &raw_t b) -> bool {
|
|||
|
||||
// Check canonical names.
|
||||
alt (a.cname) {
|
||||
case (none[str]) {
|
||||
case (none) {
|
||||
alt (b.cname) {
|
||||
case (none[str]) { /* ok */ }
|
||||
case (_) { ret false; }
|
||||
}
|
||||
}
|
||||
case (some[str](?s_a)) {
|
||||
case (some(?s_a)) {
|
||||
alt (b.cname) {
|
||||
case (some[str](?s_b)) {
|
||||
case (some(?s_b)) {
|
||||
if (!str::eq(s_a, s_b)) { ret false; }
|
||||
}
|
||||
case (_) { ret false; }
|
||||
|
@ -1530,12 +1530,12 @@ fn eq_ty(&t a, &t b) -> bool { ret a == b; }
|
|||
fn ann_to_ty_param_substs_opt_and_ty(&node_type_table ntt, &ast::ann ann)
|
||||
-> ty_param_substs_opt_and_ty {
|
||||
alt (ntt.(ann.id)) {
|
||||
case (none[ty::ty_param_substs_opt_and_ty]) {
|
||||
case (none) {
|
||||
log_err "ann_to_ty_param_substs_opt_and_ty() called on an " +
|
||||
"untyped node";
|
||||
fail;
|
||||
}
|
||||
case (some[ty::ty_param_substs_opt_and_ty](?tpot)) { ret tpot; }
|
||||
case (some(?tpot)) { ret tpot; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1545,11 +1545,11 @@ fn ann_to_type(&node_type_table ntt, &ast::ann ann) -> t {
|
|||
|
||||
fn ann_to_type_params(&node_type_table ntt, &ast::ann ann) -> vec[t] {
|
||||
alt (ann_to_ty_param_substs_opt_and_ty(ntt, ann)._0) {
|
||||
case (none[vec[t]]) {
|
||||
case (none) {
|
||||
let vec[t] result = [];
|
||||
ret result;
|
||||
}
|
||||
case (some[vec[t]](?tps)) { ret tps; }
|
||||
case (some(?tps)) { ret tps; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1564,8 +1564,8 @@ fn ann_has_type_params(&node_type_table ntt, &ast::ann ann) -> bool {
|
|||
fn ann_to_monotype(&ctxt cx, ast::ann a) -> t {
|
||||
auto tpot = ann_to_ty_param_substs_opt_and_ty(cx.node_types, a);
|
||||
alt (tpot._0) {
|
||||
case (none[vec[t]]) { ret tpot._1; }
|
||||
case (some[vec[t]](?tps)) {
|
||||
case (none) { ret tpot._1; }
|
||||
case (some(?tps)) {
|
||||
ret substitute_type_params(cx, tps, tpot._1);
|
||||
}
|
||||
}
|
||||
|
@ -1953,7 +1953,7 @@ mod unify {
|
|||
auto result_type = typ;
|
||||
if (n < vec::len[option::t[t]](bindings.types)) {
|
||||
alt (bindings.types.(n)) {
|
||||
case (some[t](?old_type)) {
|
||||
case (some(?old_type)) {
|
||||
alt (unify_step(cx, old_type, typ)) {
|
||||
case (ures_ok(?unified_type)) {
|
||||
result_type = unified_type;
|
||||
|
@ -1961,7 +1961,7 @@ mod unify {
|
|||
case (?res) { ret res; }
|
||||
}
|
||||
}
|
||||
case (none[t]) { /* fall through */ }
|
||||
case (none) { /* fall through */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2198,11 +2198,11 @@ mod unify {
|
|||
fn get_or_create_set[T](&@bindings[T] bindings, &T key) -> uint {
|
||||
auto set_num;
|
||||
alt (bindings.ids.find(key)) {
|
||||
case (none[uint]) {
|
||||
case (none) {
|
||||
set_num = ufind::make_set(bindings.sets);
|
||||
bindings.ids.insert(key, set_num);
|
||||
}
|
||||
case (some[uint](?n)) { set_num = n; }
|
||||
case (some(?n)) { set_num = n; }
|
||||
}
|
||||
ret set_num;
|
||||
}
|
||||
|
@ -2250,8 +2250,8 @@ mod unify {
|
|||
case (ty::ty_local(?actual_id)) {
|
||||
auto result_ty;
|
||||
alt (cx.handler.resolve_local(actual_id)) {
|
||||
case (none[t]) { result_ty = expected; }
|
||||
case (some[t](?actual_ty)) {
|
||||
case (none) { result_ty = expected; }
|
||||
case (some(?actual_ty)) {
|
||||
auto result = unify_step(cx, expected, actual_ty);
|
||||
alt (result) {
|
||||
case (ures_ok(?rty)) { result_ty = rty; }
|
||||
|
@ -2339,11 +2339,11 @@ mod unify {
|
|||
case (ty::ty_box(?actual_mt)) {
|
||||
auto mut;
|
||||
alt (unify_mut(expected_mt.mut, actual_mt.mut)) {
|
||||
case (none[ast::mutability]) {
|
||||
case (none) {
|
||||
ret ures_err(terr_box_mutability, expected,
|
||||
actual);
|
||||
}
|
||||
case (some[ast::mutability](?m)) { mut = m; }
|
||||
case (some(?m)) { mut = m; }
|
||||
}
|
||||
|
||||
auto result = unify_step(cx,
|
||||
|
@ -2371,11 +2371,11 @@ mod unify {
|
|||
case (ty::ty_vec(?actual_mt)) {
|
||||
auto mut;
|
||||
alt (unify_mut(expected_mt.mut, actual_mt.mut)) {
|
||||
case (none[ast::mutability]) {
|
||||
case (none) {
|
||||
ret ures_err(terr_vec_mutability, expected,
|
||||
actual);
|
||||
}
|
||||
case (some[ast::mutability](?m)) { mut = m; }
|
||||
case (some(?m)) { mut = m; }
|
||||
}
|
||||
|
||||
auto result = unify_step(cx,
|
||||
|
@ -2464,11 +2464,11 @@ mod unify {
|
|||
auto mut;
|
||||
alt (unify_mut(expected_elem.mut,
|
||||
actual_elem.mut)) {
|
||||
case (none[ast::mutability]) {
|
||||
case (none) {
|
||||
auto err = terr_tuple_mutability;
|
||||
ret ures_err(err, expected, actual);
|
||||
}
|
||||
case (some[ast::mutability](?m)) { mut = m; }
|
||||
case (some(?m)) { mut = m; }
|
||||
}
|
||||
|
||||
auto result = unify_step(cx,
|
||||
|
@ -2518,11 +2518,11 @@ mod unify {
|
|||
auto mut;
|
||||
alt (unify_mut(expected_field.mt.mut,
|
||||
actual_field.mt.mut)) {
|
||||
case (none[ast::mutability]) {
|
||||
case (none) {
|
||||
ret ures_err(terr_record_mutability,
|
||||
expected, actual);
|
||||
}
|
||||
case (some[ast::mutability](?m)) { mut = m; }
|
||||
case (some(?m)) { mut = m; }
|
||||
}
|
||||
|
||||
if (!str::eq(expected_field.ident,
|
||||
|
@ -2619,8 +2619,8 @@ mod unify {
|
|||
case (ty::ty_local(?expected_id)) {
|
||||
auto result_ty;
|
||||
alt (cx.handler.resolve_local(expected_id)) {
|
||||
case (none[t]) { result_ty = actual; }
|
||||
case (some[t](?expected_ty)) {
|
||||
case (none) { result_ty = actual; }
|
||||
case (some(?expected_ty)) {
|
||||
auto result = unify_step(cx, expected_ty, actual);
|
||||
alt (result) {
|
||||
case (ures_ok(?rty)) { result_ty = rty; }
|
||||
|
@ -2658,11 +2658,11 @@ mod unify {
|
|||
alt (struct(tcx, typ)) {
|
||||
case (ty_var(?id)) {
|
||||
alt (bindings.ids.find(id)) {
|
||||
case (some[uint](?n)) {
|
||||
case (some(?n)) {
|
||||
auto root = ufind::find(bindings.sets, n);
|
||||
ret types.(root);
|
||||
}
|
||||
case (none[uint]) { ret typ; }
|
||||
case (none) { ret typ; }
|
||||
}
|
||||
}
|
||||
case (_) { ret typ; }
|
||||
|
@ -2698,11 +2698,11 @@ mod unify {
|
|||
while (i < node_count) {
|
||||
auto root = ufind::find(bindings.sets, i);
|
||||
alt (bindings.types.(i)) {
|
||||
case (none[t]) { /* nothing to do */ }
|
||||
case (some[t](?actual)) {
|
||||
case (none) { /* nothing to do */ }
|
||||
case (some(?actual)) {
|
||||
alt (results.(root)) {
|
||||
case (none[t]) { results.(root) = some[t](actual); }
|
||||
case (some[t](?expected)) {
|
||||
case (none) { results.(root) = some[t](actual); }
|
||||
case (some(?expected)) {
|
||||
// FIXME: Is this right?
|
||||
auto bindings = mk_bindings[int](int::hash,
|
||||
int::eq_alias);
|
||||
|
@ -2928,8 +2928,8 @@ fn lookup_item_type(ctxt cx, ast::def_id did) -> ty_param_count_and_ty {
|
|||
}
|
||||
|
||||
alt (cx.tcache.find(did)) {
|
||||
case (some[ty_param_count_and_ty](?tpt)) { ret tpt; }
|
||||
case (none[ty_param_count_and_ty]) {
|
||||
case (some(?tpt)) { ret tpt; }
|
||||
case (none) {
|
||||
auto tyt = creader::get_type(cx, did);
|
||||
cx.tcache.insert(did, tyt);
|
||||
ret tyt;
|
||||
|
|
|
@ -125,8 +125,8 @@ fn ty_param_count_and_ty_for_def(&@fn_ctxt fcx, &ast::span sp, &ast::def defn)
|
|||
case (ast::def_local(?id)) {
|
||||
auto t;
|
||||
alt (fcx.locals.find(id)) {
|
||||
case (some[ty::t](?t1)) { t = t1; }
|
||||
case (none[ty::t]) { t = ty::mk_local(fcx.ccx.tcx, id); }
|
||||
case (some(?t1)) { t = t1; }
|
||||
case (none) { t = ty::mk_local(fcx.ccx.tcx, id); }
|
||||
}
|
||||
ret tup(0u, t);
|
||||
}
|
||||
|
@ -355,8 +355,8 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
|
|||
}
|
||||
|
||||
alt (cname) {
|
||||
case (none[str]) { /* no-op */ }
|
||||
case (some[str](?cname_str)) {
|
||||
case (none) { /* no-op */ }
|
||||
case (some(?cname_str)) {
|
||||
typ = ty::rename(tcx, typ, cname_str);
|
||||
}
|
||||
}
|
||||
|
@ -574,10 +574,10 @@ mod collect {
|
|||
|
||||
case (ast::item_ty(?ident, ?t, ?tps, ?def_id, _)) {
|
||||
alt (cx.tcx.tcache.find(def_id)) {
|
||||
case (some[ty::ty_param_count_and_ty](?tpt)) {
|
||||
case (some(?tpt)) {
|
||||
ret tpt;
|
||||
}
|
||||
case (none[ty::ty_param_count_and_ty]) {}
|
||||
case (none) {}
|
||||
}
|
||||
|
||||
// Tell ast_ty_to_ty() that we want to perform a recursive
|
||||
|
@ -625,10 +625,10 @@ mod collect {
|
|||
}
|
||||
case (ast::native_item_ty(_, ?def_id)) {
|
||||
alt (cx.tcx.tcache.find(def_id)) {
|
||||
case (some[ty::ty_param_count_and_ty](?tpt)) {
|
||||
case (some(?tpt)) {
|
||||
ret tpt;
|
||||
}
|
||||
case (none[ty::ty_param_count_and_ty]) {}
|
||||
case (none) {}
|
||||
}
|
||||
|
||||
auto t = ty::mk_native(cx.tcx);
|
||||
|
@ -766,8 +766,8 @@ mod collect {
|
|||
|
||||
// Finally, write in the type of the destructor.
|
||||
alt (object.dtor) {
|
||||
case (none[@ast::method]) { /* nothing to do */ }
|
||||
case (some[@ast::method](?m)) {
|
||||
case (none) { /* nothing to do */ }
|
||||
case (some(?m)) {
|
||||
// TODO: typechecker botch
|
||||
let vec[arg] no_args = [];
|
||||
auto t = ty::mk_fn(cx.tcx, ast::proto_fn, no_args,
|
||||
|
@ -848,11 +848,11 @@ mod unify {
|
|||
&vec[mutable ty::t] param_substs) -> ty::unify::result {
|
||||
auto cache_key = tup(expected, actual, param_substs);
|
||||
alt (scx.fcx.ccx.unify_cache.find(cache_key)) {
|
||||
case (some[ty::unify::result](?r)) {
|
||||
case (some(?r)) {
|
||||
scx.fcx.ccx.cache_hits += 1u;
|
||||
ret r;
|
||||
}
|
||||
case (none[ty::unify::result]) {
|
||||
case (none) {
|
||||
scx.fcx.ccx.cache_misses += 1u;
|
||||
}
|
||||
}
|
||||
|
@ -860,8 +860,8 @@ mod unify {
|
|||
obj unify_handler(@stmt_ctxt scx, vec[mutable ty::t] param_substs) {
|
||||
fn resolve_local(ast::def_id id) -> option::t[ty::t] {
|
||||
alt (scx.fcx.locals.find(id)) {
|
||||
case (none[ty::t]) { ret none[ty::t]; }
|
||||
case (some[ty::t](?existing_type)) {
|
||||
case (none) { ret none[ty::t]; }
|
||||
case (some(?existing_type)) {
|
||||
if (ty::type_contains_vars(scx.fcx.ccx.tcx,
|
||||
existing_type)) {
|
||||
// Not fully resolved yet. The writeback phase
|
||||
|
@ -875,8 +875,8 @@ mod unify {
|
|||
fn record_local(ast::def_id id, ty::t new_type) {
|
||||
auto unified_type;
|
||||
alt (scx.fcx.locals.find(id)) {
|
||||
case (none[ty::t]) { unified_type = new_type; }
|
||||
case (some[ty::t](?old_type)) {
|
||||
case (none) { unified_type = new_type; }
|
||||
case (some(?old_type)) {
|
||||
alt (with_params(scx, old_type, new_type,
|
||||
param_substs)) {
|
||||
case (ures_ok(?ut)) { unified_type = ut; }
|
||||
|
@ -1176,10 +1176,10 @@ mod pushdown {
|
|||
|
||||
auto ty_params_opt;
|
||||
alt (ty_params_subst._0) {
|
||||
case (none[vec[ty::t]]) {
|
||||
case (none) {
|
||||
ty_params_opt = none[vec[ty::t]];
|
||||
}
|
||||
case (some[vec[ty::t]](?tps)) {
|
||||
case (some(?tps)) {
|
||||
ty_params_opt = some[vec[ty::t]](tag_tps);
|
||||
}
|
||||
}
|
||||
|
@ -1245,7 +1245,7 @@ mod pushdown {
|
|||
alt (struct(scx.fcx.ccx.tcx, t)) {
|
||||
case (ty::ty_rec(?field_mts)) {
|
||||
alt (base_0) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto i = 0u;
|
||||
for (ast::field field_0 in fields_0) {
|
||||
assert (str::eq(field_0.ident,
|
||||
|
@ -1256,7 +1256,7 @@ mod pushdown {
|
|||
i += 1u;
|
||||
}
|
||||
}
|
||||
case (some[@ast::expr](?bx)) {
|
||||
case (some(?bx)) {
|
||||
|
||||
let vec[field] base_fields = [];
|
||||
|
||||
|
@ -1354,8 +1354,8 @@ mod pushdown {
|
|||
pushdown_block(scx, expected, then_0);
|
||||
|
||||
alt (else_0) {
|
||||
case (none[@ast::expr]) { /* no-op */ }
|
||||
case (some[@ast::expr](?e_0)) {
|
||||
case (none) { /* no-op */ }
|
||||
case (some(?e_0)) {
|
||||
auto else_t = ty::expr_ty(scx.fcx.ccx.tcx, e_0);
|
||||
pushdown_expr(scx, expected, e_0);
|
||||
}
|
||||
|
@ -1426,10 +1426,10 @@ mod pushdown {
|
|||
auto ty_params_opt;
|
||||
alt (ty::ann_to_ty_param_substs_opt_and_ty
|
||||
(scx.fcx.ccx.tcx.node_types, ann)._0) {
|
||||
case (none[vec[ty::t]]) {
|
||||
case (none) {
|
||||
ty_params_opt = none[vec[ty::t]];
|
||||
}
|
||||
case (some[vec[ty::t]](?tps)) {
|
||||
case (some(?tps)) {
|
||||
ty_params_opt = some[vec[ty::t]](tps);
|
||||
}
|
||||
}
|
||||
|
@ -1526,10 +1526,10 @@ mod pushdown {
|
|||
// Push-down over typed blocks.
|
||||
fn pushdown_block(&@stmt_ctxt scx, &ty::t expected, &ast::block bloc) {
|
||||
alt (bloc.node.expr) {
|
||||
case (some[@ast::expr](?e_0)) {
|
||||
case (some(?e_0)) {
|
||||
pushdown_expr(scx, expected, e_0);
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
|
@ -1546,12 +1546,12 @@ mod writeback {
|
|||
fn wb_local(&@fn_ctxt fcx, &span sp, &@ast::local local) {
|
||||
auto local_ty;
|
||||
alt (fcx.locals.find(local.id)) {
|
||||
case (none[ty::t]) {
|
||||
case (none) {
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
"unable to determine type of local: " + local.ident);
|
||||
fail;
|
||||
}
|
||||
case (some[ty::t](?lt)) {
|
||||
case (some(?lt)) {
|
||||
local_ty = lt;
|
||||
}
|
||||
}
|
||||
|
@ -1817,12 +1817,12 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
let vec[arg] arg_tys_0 = [];
|
||||
for (option::t[@ast::expr] a_opt in args) {
|
||||
alt (a_opt) {
|
||||
case (some[@ast::expr](?a)) {
|
||||
case (some(?a)) {
|
||||
check_expr(scx, a);
|
||||
auto typ = expr_ty(scx.fcx.ccx.tcx, a);
|
||||
vec::push[arg](arg_tys_0, rec(mode=mo_either, ty=typ));
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto typ = next_ty_var(scx);
|
||||
vec::push[arg](arg_tys_0, rec(mode=mo_either, ty=typ));
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
|
||||
case (ast::expr_ret(?expr_opt, ?a)) {
|
||||
alt (expr_opt) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto nil = ty::mk_nil(scx.fcx.ccx.tcx);
|
||||
if (!are_compatible(scx, scx.fcx.ret_ty, nil)) {
|
||||
// TODO: span_err
|
||||
|
@ -2010,7 +2010,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
write::bot_ty(scx.fcx.ccx.tcx, a.id);
|
||||
}
|
||||
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
check_expr(scx, e);
|
||||
pushdown::pushdown_expr(scx, scx.fcx.ret_ty, e);
|
||||
|
||||
|
@ -2023,7 +2023,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
require_impure(scx.fcx.ccx.tcx.sess, scx.fcx.purity, expr.span);
|
||||
|
||||
alt (expr_opt) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto nil = ty::mk_nil(scx.fcx.ccx.tcx);
|
||||
if (!are_compatible(scx, scx.fcx.ret_ty, nil)) {
|
||||
scx.fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
|
@ -2033,7 +2033,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
write::nil_ty(scx.fcx.ccx.tcx, a.id);
|
||||
}
|
||||
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
check_expr(scx, e);
|
||||
pushdown::pushdown_expr(scx, scx.fcx.ret_ty, e);
|
||||
|
||||
|
@ -2164,7 +2164,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
check_block(scx, thn);
|
||||
|
||||
auto if_t = alt (elsopt) {
|
||||
case (some[@ast::expr](?els)) {
|
||||
case (some(?els)) {
|
||||
check_expr(scx, els);
|
||||
|
||||
auto thn_t = block_ty(scx.fcx.ccx.tcx, thn);
|
||||
|
@ -2175,7 +2175,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
thn_t
|
||||
}
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
ty::mk_nil(scx.fcx.ccx.tcx)
|
||||
}
|
||||
};
|
||||
|
@ -2278,11 +2278,11 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
case (ast::expr_block(?b, ?a)) {
|
||||
check_block(scx, b);
|
||||
alt (b.node.expr) {
|
||||
case (some[@ast::expr](?expr)) {
|
||||
case (some(?expr)) {
|
||||
auto typ = expr_ty(scx.fcx.ccx.tcx, expr);
|
||||
write::ty_only_fixup(scx, a.id, typ);
|
||||
}
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto typ = ty::mk_nil(scx.fcx.ccx.tcx);
|
||||
write::ty_only_fixup(scx, a.id, typ);
|
||||
}
|
||||
|
@ -2309,8 +2309,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
auto i = 0u;
|
||||
while (i < vec::len[option::t[@ast::expr]](args)) {
|
||||
alt (args.(i)) {
|
||||
case (some[@ast::expr](_)) { /* no-op */ }
|
||||
case (none[@ast::expr]) {
|
||||
case (some(_)) { /* no-op */ }
|
||||
case (none) {
|
||||
arg_tys_1 += [arg_tys.(i)];
|
||||
}
|
||||
}
|
||||
|
@ -2359,7 +2359,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
|
||||
alt (this_obj_info) {
|
||||
// If we're inside a current object, grab its type.
|
||||
case (some[obj_info](?obj_info)) {
|
||||
case (some(?obj_info)) {
|
||||
// FIXME: In the case of anonymous objects with methods
|
||||
// containing self-calls, this lookup fails because
|
||||
// obj_info.this_obj is not in the type cache
|
||||
|
@ -2367,7 +2367,7 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
obj_info.this_obj)._1;
|
||||
}
|
||||
|
||||
case (none[obj_info]) { fail; }
|
||||
case (none) { fail; }
|
||||
}
|
||||
|
||||
// Grab this method's type out of the current object type.
|
||||
|
@ -2454,8 +2454,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
case (ast::expr_rec(?fields, ?base, ?a)) {
|
||||
|
||||
alt (base) {
|
||||
case (none[@ast::expr]) { /* no-op */}
|
||||
case (some[@ast::expr](?b_0)) { check_expr(scx, b_0); }
|
||||
case (none) { /* no-op */}
|
||||
case (some(?b_0)) { check_expr(scx, b_0); }
|
||||
}
|
||||
|
||||
let vec[field] fields_t = [];
|
||||
|
@ -2469,12 +2469,12 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
}
|
||||
|
||||
alt (base) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
auto typ = ty::mk_rec(scx.fcx.ccx.tcx, fields_t);
|
||||
write::ty_only_fixup(scx, a.id, typ);
|
||||
}
|
||||
|
||||
case (some[@ast::expr](?bexpr)) {
|
||||
case (some(?bexpr)) {
|
||||
check_expr(scx, bexpr);
|
||||
auto bexpr_t = expr_ty(scx.fcx.ccx.tcx, bexpr);
|
||||
|
||||
|
@ -2623,8 +2623,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
// We're entering an object, so gather up the info we need.
|
||||
let vec[ast::obj_field] fields = [];
|
||||
alt (anon_obj.fields) {
|
||||
case (none[vec[ast::obj_field]]) { }
|
||||
case (some[vec[ast::obj_field]](?v)) { fields = v; }
|
||||
case (none) { }
|
||||
case (some(?v)) { fields = v; }
|
||||
}
|
||||
let ast::def_id di = obj_def_ids.ty;
|
||||
|
||||
|
@ -2634,8 +2634,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
|
|||
// Typecheck 'with_obj', if it exists.
|
||||
let option::t[@ast::expr] with_obj = none[@ast::expr];
|
||||
alt (anon_obj.with_obj) {
|
||||
case (none[@ast::expr]) { }
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (none) { }
|
||||
case (some(?e)) {
|
||||
// This had better have object type. TOOD: report an
|
||||
// error if the user is trying to extend a non-object
|
||||
// with_obj.
|
||||
|
@ -2723,11 +2723,11 @@ fn check_decl_local(&@fn_ctxt fcx, &@ast::decl decl) -> @ast::decl {
|
|||
auto t = ty::mk_nil(fcx.ccx.tcx);
|
||||
|
||||
alt (local.ty) {
|
||||
case (none[@ast::ty]) {
|
||||
case (none) {
|
||||
// Auto slot. Do nothing for now.
|
||||
}
|
||||
|
||||
case (some[@ast::ty](?ast_ty)) {
|
||||
case (some(?ast_ty)) {
|
||||
auto local_ty = ast_ty_to_ty_crate(fcx.ccx, ast_ty);
|
||||
fcx.locals.insert(local.id, local_ty);
|
||||
t = local_ty;
|
||||
|
@ -2739,7 +2739,7 @@ fn check_decl_local(&@fn_ctxt fcx, &@ast::decl decl) -> @ast::decl {
|
|||
|
||||
auto initopt = local.init;
|
||||
alt (local.init) {
|
||||
case (some[ast::initializer](?init)) {
|
||||
case (some(?init)) {
|
||||
with_stmt_ctxt(fcx,
|
||||
bind check_decl_initializer(_, local.id, init));
|
||||
}
|
||||
|
@ -2780,10 +2780,10 @@ fn check_block(&@stmt_ctxt scx, &ast::block block) {
|
|||
for (@ast::stmt s in block.node.stmts) { check_stmt(scx.fcx, s); }
|
||||
|
||||
alt (block.node.expr) {
|
||||
case (none[@ast::expr]) {
|
||||
case (none) {
|
||||
write::nil_ty(scx.fcx.ccx.tcx, block.node.a.id);
|
||||
}
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (some(?e)) {
|
||||
check_expr(scx, e);
|
||||
auto ety = expr_ty(scx.fcx.ccx.tcx, e);
|
||||
pushdown::pushdown_expr(scx, ety, e);
|
||||
|
@ -2814,13 +2814,13 @@ fn check_fn(&@crate_ctxt ccx, &ast::fn_decl decl, ast::proto proto,
|
|||
// again here, we can extract them.
|
||||
|
||||
alt (get_obj_info(ccx)) {
|
||||
case (option::some[obj_info](?oinfo)) {
|
||||
case (option::some(?oinfo)) {
|
||||
for (ast::obj_field f in oinfo.obj_fields) {
|
||||
auto field_ty = ty::ann_to_type(ccx.tcx.node_types, f.ann);
|
||||
local_ty_table.insert(f.id, field_ty);
|
||||
}
|
||||
}
|
||||
case (option::none[obj_info]) { /* no fields */ }
|
||||
case (option::none) { /* no fields */ }
|
||||
}
|
||||
|
||||
// Store the type of each argument in the table.
|
||||
|
|
|
@ -127,8 +127,8 @@ fn walk_item(&ast_visitor v, @ast::item i) {
|
|||
v.visit_method_post(m);
|
||||
}
|
||||
alt (ob.dtor) {
|
||||
case (none[@ast::method]) {}
|
||||
case (some[@ast::method](?m)) {
|
||||
case (none) {}
|
||||
case (some(?m)) {
|
||||
walk_fn(v, m.node.meth, m.span, m.node.ident, m.node.id,
|
||||
m.node.ann);
|
||||
}
|
||||
|
@ -277,12 +277,12 @@ fn walk_decl(&ast_visitor v, @ast::decl d) {
|
|||
alt (d.node) {
|
||||
case (ast::decl_local(?loc)) {
|
||||
alt (loc.ty) {
|
||||
case (none[@ast::ty]) {}
|
||||
case (some[@ast::ty](?t)) { walk_ty(v, t); }
|
||||
case (none) {}
|
||||
case (some(?t)) { walk_ty(v, t); }
|
||||
}
|
||||
alt (loc.init) {
|
||||
case (none[ast::initializer]) {}
|
||||
case (some[ast::initializer](?i)) {
|
||||
case (none) {}
|
||||
case (some(?i)) {
|
||||
walk_expr(v, i.expr);
|
||||
}
|
||||
}
|
||||
|
@ -296,8 +296,8 @@ fn walk_decl(&ast_visitor v, @ast::decl d) {
|
|||
|
||||
fn walk_expr_opt(&ast_visitor v, option::t[@ast::expr] eo) {
|
||||
alt (eo) {
|
||||
case (none[@ast::expr]) {}
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (none) {}
|
||||
case (some(?e)) {
|
||||
walk_expr(v, e);
|
||||
}
|
||||
}
|
||||
|
@ -454,8 +454,8 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
|
|||
= none[vec[ast::obj_field]];
|
||||
|
||||
alt (anon_obj.fields) {
|
||||
case (none[vec[ast::obj_field]]) { }
|
||||
case (some[vec[ast::obj_field]](?fields)) {
|
||||
case (none) { }
|
||||
case (some(?fields)) {
|
||||
for (ast::obj_field f in fields) {
|
||||
walk_ty(v, f.ty);
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
|
|||
// with_obj
|
||||
let option::t[@ast::expr] with_obj = none[@ast::expr];
|
||||
alt (anon_obj.with_obj) {
|
||||
case (none[@ast::expr]) { }
|
||||
case (some[@ast::expr](?e)) {
|
||||
case (none) { }
|
||||
case (some(?e)) {
|
||||
walk_expr(v, e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ fn has_nonlocal_exits(&ast::block b) -> bool {
|
|||
|
||||
fn local_rhs_span(&@ast::local l, &ast::span def) -> ast::span {
|
||||
alt (l.init) {
|
||||
case (some[ast::initializer](?i)) { ret i.expr.span; }
|
||||
case (some(?i)) { ret i.expr.span; }
|
||||
case (_) { ret def; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ mod interner {
|
|||
|
||||
fn intern[T](&interner[T] itr, &T val) -> uint {
|
||||
alt (itr.map.find(val)) {
|
||||
case (some[uint](?idx)) { ret idx; }
|
||||
case (none[uint]) {
|
||||
case (some(?idx)) { ret idx; }
|
||||
case (none) {
|
||||
auto new_idx = vec::len[T](itr.vect);
|
||||
itr.map.insert(val, new_idx);
|
||||
itr.vect += [val];
|
||||
|
|
Loading…
Reference in a new issue