Rename ast::proto_fn to ast::proto_shared

This commit is contained in:
Brian Anderson 2011-10-18 20:22:46 -07:00
parent 29ad3bdb10
commit 4b30a06abe
13 changed files with 32 additions and 31 deletions

View file

@ -192,7 +192,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
il: ast::il_normal,
cf: ast::return_val,
constraints: []};
let proto = ast::proto_fn;
let proto = ast::proto_shared;
// The vector of test_descs for this crate
let test_descs = mk_test_desc_vec(cx);
@ -214,7 +214,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
}
fn empty_fn_ty() -> ast::ty {
let proto = ast::proto_fn;
let proto = ast::proto_shared;
let input_ty = [];
let ret_ty = @nospan(ast::ty_nil);
let cf = ast::return_val;

View file

@ -242,7 +242,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
}
'F' {
let func = parse_ty_fn(st, sd);
ret ty::mk_fn(st.tcx, ast::proto_fn, func.args, func.ty, func.cf,
ret ty::mk_fn(st.tcx, ast::proto_shared, func.args, func.ty, func.cf,
func.cs);
}
'f' {

View file

@ -195,7 +195,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
fn enc_proto(w: io::writer, proto: proto) {
alt proto {
proto_iter. { w.write_char('W'); }
proto_fn. { w.write_char('F'); }
proto_shared. { w.write_char('F'); }
proto_block. { w.write_char('B'); }
proto_bare. { w.write_char('f'); }
}

View file

@ -594,7 +594,8 @@ fn lookup_in_scope_strict(e: env, sc: scopes, sp: span, name: ident,
fn scope_is_fn(sc: scope) -> bool {
ret alt sc {
scope_fn(_, ast::proto_iter., _) | scope_fn(_, ast::proto_fn., _) |
scope_fn(_, ast::proto_iter., _) |
scope_fn(_, ast::proto_shared., _) |
scope_fn(_, ast::proto_bare., _) |
scope_native_item(_) {
true

View file

@ -5349,7 +5349,7 @@ fn trans_res_ctor(cx: @local_ctxt, sp: span, dtor: ast::_fn,
}
let fcx = new_fn_ctxt(cx, sp, llctor_decl);
let ret_t = ty::ret_ty_of_fn(cx.ccx.tcx, ctor_id);
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>, ret_t,
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>, ret_t,
dtor.decl.inputs, ty_params);
let bcx = new_top_block_ctxt(fcx);
let lltop = bcx.llbb;
@ -5409,7 +5409,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
}
}
let fcx = new_fn_ctxt(cx, variant.span, llfndecl);
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>,
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>,
ty::ret_ty_of_fn(cx.ccx.tcx, variant.node.id),
fn_args, ty_params);
let ty_param_substs: [ty::t] = [];
@ -5616,7 +5616,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
let nt = ty::mk_nil(ccx.tcx);
check non_ty_var(ccx, nt);
let llfty = type_of_fn(ccx, sp, ast::proto_fn, false, false,
let llfty = type_of_fn(ccx, sp, ast::proto_shared, false, false,
[vecarg_ty], nt, 0u);
let llfdecl = decl_fn(ccx.llmod, "_rust_main",
lib::llvm::LLVMCCallConv, llfty);
@ -5729,7 +5729,7 @@ fn native_fn_wrapper_type(cx: @crate_ctxt, sp: span, ty_param_count: uint,
alt ty::struct(cx.tcx, x) {
ty::ty_native_fn(abi, args, out) {
check non_ty_var(cx, out);
ret type_of_fn(cx, sp, ast::proto_fn, false, false, args, out,
ret type_of_fn(cx, sp, ast::proto_shared, false, false, args, out,
ty_param_count);
}
}

View file

@ -340,7 +340,7 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
let nil_res = ty::mk_nil(ccx.tcx);
// FIXME: Silly check -- mk_nil should have a postcondition
check non_ty_var(ccx, nil_res);
let f_t = type_of_fn(ccx, sp, ast::proto_fn, false, false,
let f_t = type_of_fn(ccx, sp, ast::proto_shared, false, false,
[{mode: ast::by_ref, ty: inner_t}],
nil_res, params);
ret trans::get_extern_const(ccx.externs, ccx.llmod,

View file

@ -52,7 +52,7 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
let lltop = bcx.llbb;
// Both regular arguments and type parameters are handled here.
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>,
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>,
ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args,
ty_params);
let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id);

View file

@ -1013,7 +1013,7 @@ fn type_kind(cx: ctxt, ty: t) -> ast::kind {
ast::proto_iter. { ast::kind_shared }
ast::proto_block. { ast::kind_pinned }
ast::proto_closure. { ast::kind_shared }
ast::proto_fn. { ast::kind_shared }
ast::proto_shared. { ast::kind_shared }
ast::proto_bare. { ast::kind_unique }
};
}
@ -1616,7 +1616,7 @@ fn ty_fn_args(cx: ctxt, fty: t) -> [arg] {
fn ty_fn_proto(cx: ctxt, fty: t) -> ast::proto {
alt struct(cx, fty) {
ty::ty_fn(p, _, _, _, _) { ret p; }
ty::ty_native_fn(_, _, _) { ret ast::proto_fn; }
ty::ty_native_fn(_, _, _) { ret ast::proto_shared; }
_ { cx.sess.bug("ty_fn_proto() called on non-fn type"); }
}
}
@ -2031,7 +2031,7 @@ mod unify {
// Every function type is a subtype of block
false
}
ast::proto_closure. | ast::proto_fn. {
ast::proto_closure. | ast::proto_shared. {
a_proto == ast::proto_block
}
ast::proto_bare. {

View file

@ -479,7 +479,7 @@ mod write {
fn proto_to_ty_proto(proto: ast::proto) -> ast::proto {
ret alt proto {
ast::proto_iter. | ast::proto_block. | ast::proto_bare. { proto }
_ { ast::proto_fn }
_ { ast::proto_shared }
};
}
@ -612,7 +612,7 @@ mod collect {
}
let t_fn =
ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj.ty,
ty::mk_fn(cx.tcx, ast::proto_shared, t_inputs, t_obj.ty,
ast::return_val, []);
let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
cx.tcx.tcache.insert(local_def(ctor_id), tpt);
@ -723,7 +723,7 @@ mod collect {
let tag_t = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
// FIXME: this will be different for constrained types
result_ty =
ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t,
ty::mk_fn(cx.tcx, ast::proto_shared, args, tag_t,
ast::return_val, []);
}
let tpt = {kinds: ty_param_kinds(ty_params), ty: result_ty};
@ -793,10 +793,11 @@ mod collect {
ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
mk_ty_params(cx, tps));
let t_ctor =
ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], t_res,
ty::mk_fn(cx.tcx, ast::proto_shared, [t_arg], t_res,
ast::return_val, []);
let t_dtor =
ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], ty::mk_nil(cx.tcx),
ty::mk_fn(cx.tcx, ast::proto_shared, [t_arg],
ty::mk_nil(cx.tcx),
ast::return_val, []);
write::ty_only(cx.tcx, it.id, t_res);
write::ty_only(cx.tcx, ctor_id, t_ctor);
@ -2091,7 +2092,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
constrs = constrs_;
}
ty::ty_native_fn(_, arg_tys_, rt_) {
proto = ast::proto_fn;
proto = ast::proto_shared;
arg_tys = arg_tys_;
rt = rt_;
cf = ast::return_val;
@ -2116,7 +2117,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
fn lower_bound_proto(proto: ast::proto) -> ast::proto {
// FIXME: This is right for bare fns, possibly not others
alt proto {
ast::proto_bare. { ast::proto_fn }
ast::proto_bare. { ast::proto_shared }
_ { proto }
}
}
@ -2567,7 +2568,7 @@ fn check_const(ccx: @crate_ctxt, _sp: span, e: @ast::expr, id: ast::node_id) {
let fcx: @fn_ctxt =
@{ret_ty: rty,
purity: ast::pure_fn,
proto: ast::proto_fn,
proto: ast::proto_shared,
var_bindings: ty::unify::mk_var_bindings(),
locals: new_int_hash::<int>(),
local_names: new_int_hash::<ast::ident>(),

View file

@ -105,11 +105,10 @@ tag _auth { auth_unsafe; }
tag proto {
proto_iter;
proto_fn;
proto_shared;
proto_block;
// FIXME: Merge with proto_shared
proto_closure;
// Functions without an environment. Eventually, this will
// merge with proto_fn.
proto_bare;
}

View file

@ -1901,7 +1901,7 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
il: ast::il_normal,
cf: ast::return_val,
constraints: []};
let f = {decl: decl, proto: ast::proto_fn, body: dtor};
let f = {decl: decl, proto: ast::proto_shared, body: dtor};
ret mk_item(p, lo, dtor.span.hi, ident,
ast::item_res(f, p.get_id(), ty_params, p.get_id()), attrs);
}
@ -2140,7 +2140,7 @@ fn parse_fn_item_proto(p: parser) -> ast::proto {
ast::proto_bare
} else if p.peek() == token::AT {
p.bump();
ast::proto_fn
ast::proto_shared
} else {
ast::proto_bare
}
@ -2152,7 +2152,7 @@ fn parse_fn_ty_proto(p: parser) -> ast::proto {
ast::proto_bare
} else if p.peek() == token::AT {
p.bump();
ast::proto_fn
ast::proto_shared
} else {
ast::proto_bare
}
@ -2164,7 +2164,7 @@ fn parse_fn_anon_proto(p: parser) -> ast::proto {
ast::proto_bare
} else if p.peek() == token::AT {
p.bump();
ast::proto_fn
ast::proto_shared
} else {
ast::proto_bare
}

View file

@ -1643,7 +1643,7 @@ fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str {
fn proto_to_str(p: ast::proto) -> str {
ret alt p {
ast::proto_fn. { "fn@" }
ast::proto_shared. { "fn@" }
ast::proto_iter. { "iter" }
ast::proto_block. { "block" }
ast::proto_closure. { "lambda" }

View file

@ -129,7 +129,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
fn_to_str(cx, proto, none, inputs, output, cf, constrs)
}
ty_native_fn(_, inputs, output) {
fn_to_str(cx, ast::proto_fn, none, inputs, output,
fn_to_str(cx, ast::proto_shared, none, inputs, output,
ast::return_val, [])
}
ty_obj(meths) {