Remove effect system from src.
This commit is contained in:
parent
d9d5eb82a7
commit
d2bd07dcb0
83 changed files with 507 additions and 1037 deletions
|
|
@ -61,7 +61,6 @@ type ast_fold[ENV] =
|
|||
vec[ast.ty_method] meths) -> @ty) fold_ty_obj,
|
||||
|
||||
(fn(&ENV e, &span sp,
|
||||
ast.effect eff,
|
||||
ast.proto proto,
|
||||
vec[rec(ast.mode mode, @ty ty)] inputs,
|
||||
@ty output) -> @ty) fold_ty_fn,
|
||||
|
|
@ -299,7 +298,7 @@ type ast_fold[ENV] =
|
|||
ast.proto proto,
|
||||
&block body) -> ast._fn) fold_fn,
|
||||
|
||||
(fn(&ENV e, ast.effect effect,
|
||||
(fn(&ENV e,
|
||||
vec[arg] inputs,
|
||||
@ty output) -> ast.fn_decl) fold_fn_decl,
|
||||
|
||||
|
|
@ -398,12 +397,12 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
|
|||
case (ast.ty_obj(?meths)) {
|
||||
let vec[ast.ty_method] meths_ = vec();
|
||||
for (ast.ty_method m in meths) {
|
||||
auto tfn = fold_ty_fn(env_, fld, t.span, m.effect, m.proto,
|
||||
auto tfn = fold_ty_fn(env_, fld, t.span, m.proto,
|
||||
m.inputs, m.output);
|
||||
alt (tfn.node) {
|
||||
case (ast.ty_fn(?eff, ?p, ?ins, ?out)) {
|
||||
case (ast.ty_fn(?p, ?ins, ?out)) {
|
||||
_vec.push[ast.ty_method]
|
||||
(meths_, rec(effect=eff, proto=p, inputs=ins,
|
||||
(meths_, rec(proto=p, inputs=ins,
|
||||
output=out with m));
|
||||
}
|
||||
}
|
||||
|
|
@ -416,8 +415,8 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
|
|||
ret fld.fold_ty_path(env_, t.span, pth_, ref_opt);
|
||||
}
|
||||
|
||||
case (ast.ty_fn(?eff, ?proto, ?inputs, ?output)) {
|
||||
ret fold_ty_fn(env_, fld, t.span, eff, proto, inputs, output);
|
||||
case (ast.ty_fn(?proto, ?inputs, ?output)) {
|
||||
ret fold_ty_fn(env_, fld, t.span, proto, inputs, output);
|
||||
}
|
||||
|
||||
case (ast.ty_chan(?ty)) {
|
||||
|
|
@ -433,7 +432,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
|
|||
}
|
||||
|
||||
fn fold_ty_fn[ENV](&ENV env, ast_fold[ENV] fld, &span sp,
|
||||
ast.effect eff, ast.proto proto,
|
||||
ast.proto proto,
|
||||
vec[rec(ast.mode mode, @ty ty)] inputs,
|
||||
@ty output) -> @ty {
|
||||
auto output_ = fold_ty(env, fld, output);
|
||||
|
|
@ -443,7 +442,7 @@ fn fold_ty_fn[ENV](&ENV env, ast_fold[ENV] fld, &span sp,
|
|||
auto input_ = rec(ty=ty_ with input);
|
||||
inputs_ += vec(input_);
|
||||
}
|
||||
ret fld.fold_ty_fn(env, sp, eff, proto, inputs_, output_);
|
||||
ret fld.fold_ty_fn(env, sp, proto, inputs_, output_);
|
||||
}
|
||||
|
||||
fn fold_decl[ENV](&ENV env, ast_fold[ENV] fld, @decl d) -> @decl {
|
||||
|
|
@ -894,7 +893,7 @@ fn fold_fn_decl[ENV](&ENV env, ast_fold[ENV] fld,
|
|||
inputs += vec(fold_arg(env, fld, a));
|
||||
}
|
||||
auto output = fold_ty[ENV](env, fld, decl.output);
|
||||
ret fld.fold_fn_decl(env, decl.effect, inputs, output);
|
||||
ret fld.fold_fn_decl(env, inputs, output);
|
||||
}
|
||||
|
||||
fn fold_fn[ENV](&ENV env, ast_fold[ENV] fld, &ast._fn f) -> ast._fn {
|
||||
|
|
@ -1187,10 +1186,10 @@ fn identity_fold_ty_obj[ENV](&ENV env, &span sp,
|
|||
}
|
||||
|
||||
fn identity_fold_ty_fn[ENV](&ENV env, &span sp,
|
||||
ast.effect eff, ast.proto proto,
|
||||
ast.proto proto,
|
||||
vec[rec(ast.mode mode, @ty ty)] inputs,
|
||||
@ty output) -> @ty {
|
||||
ret @respan(sp, ast.ty_fn(eff, proto, inputs, output));
|
||||
ret @respan(sp, ast.ty_fn(proto, inputs, output));
|
||||
}
|
||||
|
||||
fn identity_fold_ty_path[ENV](&ENV env, &span sp, ast.path p,
|
||||
|
|
@ -1530,10 +1529,9 @@ fn identity_fold_block[ENV](&ENV e, &span sp, &ast.block_ blk) -> block {
|
|||
}
|
||||
|
||||
fn identity_fold_fn_decl[ENV](&ENV e,
|
||||
ast.effect effect,
|
||||
vec[arg] inputs,
|
||||
@ty output) -> ast.fn_decl {
|
||||
ret rec(effect=effect, inputs=inputs, output=output);
|
||||
ret rec(inputs=inputs, output=output);
|
||||
}
|
||||
|
||||
fn identity_fold_fn[ENV](&ENV e,
|
||||
|
|
@ -1638,7 +1636,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
|
|||
fold_ty_tup = bind identity_fold_ty_tup[ENV](_,_,_),
|
||||
fold_ty_rec = bind identity_fold_ty_rec[ENV](_,_,_),
|
||||
fold_ty_obj = bind identity_fold_ty_obj[ENV](_,_,_),
|
||||
fold_ty_fn = bind identity_fold_ty_fn[ENV](_,_,_,_,_,_),
|
||||
fold_ty_fn = bind identity_fold_ty_fn[ENV](_,_,_,_,_),
|
||||
fold_ty_path = bind identity_fold_ty_path[ENV](_,_,_,_),
|
||||
fold_ty_chan = bind identity_fold_ty_chan[ENV](_,_,_),
|
||||
fold_ty_port = bind identity_fold_ty_port[ENV](_,_,_),
|
||||
|
|
@ -1708,7 +1706,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
|
|||
bind identity_fold_native_item_ty[ENV](_,_,_,_),
|
||||
fold_item_tag = bind identity_fold_item_tag[ENV](_,_,_,_,_,_,_),
|
||||
fold_item_obj = bind identity_fold_item_obj[ENV](_,_,_,_,_,_,_),
|
||||
|
||||
|
||||
fold_view_item_use =
|
||||
bind identity_fold_view_item_use[ENV](_,_,_,_,_,_),
|
||||
fold_view_item_import =
|
||||
|
|
@ -1720,7 +1718,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
|
|||
|
||||
fold_block = bind identity_fold_block[ENV](_,_,_),
|
||||
fold_fn = bind identity_fold_fn[ENV](_,_,_,_),
|
||||
fold_fn_decl = bind identity_fold_fn_decl[ENV](_,_,_,_),
|
||||
fold_fn_decl = bind identity_fold_fn_decl[ENV](_,_,_),
|
||||
fold_mod = bind identity_fold_mod[ENV](_,_),
|
||||
fold_native_mod = bind identity_fold_native_mod[ENV](_,_),
|
||||
fold_crate = bind identity_fold_crate[ENV](_,_,_,_),
|
||||
|
|
|
|||
|
|
@ -521,8 +521,8 @@ fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn)
|
|||
ret buckets;
|
||||
}
|
||||
|
||||
impure fn encode_index[T](&ebml.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
|
||||
impure fn(io.writer, &T) write_fn) {
|
||||
fn encode_index[T](&ebml.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
|
||||
fn(io.writer, &T) write_fn) {
|
||||
auto writer = io.new_writer_(ebml_w.writer);
|
||||
|
||||
ebml.start_tag(ebml_w, tag_index);
|
||||
|
|
@ -553,16 +553,16 @@ impure fn encode_index[T](&ebml.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
|
|||
}
|
||||
|
||||
|
||||
impure fn write_str(io.writer writer, &str s) {
|
||||
fn write_str(io.writer writer, &str s) {
|
||||
writer.write_str(s);
|
||||
}
|
||||
|
||||
impure fn write_int(io.writer writer, &int n) {
|
||||
fn write_int(io.writer writer, &int n) {
|
||||
writer.write_be_uint(n as uint, 4u);
|
||||
}
|
||||
|
||||
|
||||
impure fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate)
|
||||
fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate)
|
||||
-> ValueRef {
|
||||
auto string_w = io.string_writer();
|
||||
auto buf_w = string_w.get_writer().get_buf_writer();
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ tag sty {
|
|||
ty_task;
|
||||
ty_tup(vec[mt]);
|
||||
ty_rec(vec[field]);
|
||||
ty_fn(ast.proto, vec[arg], @t); // TODO: effect
|
||||
ty_native_fn(ast.native_abi, vec[arg], @t); // TODO: effect
|
||||
ty_fn(ast.proto, vec[arg], @t);
|
||||
ty_native_fn(ast.native_abi, vec[arg], @t);
|
||||
ty_obj(vec[method]);
|
||||
ty_var(int); // ephemeral type var
|
||||
ty_local(ast.def_id); // type of a local var
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty.t {
|
|||
sty = ty.ty_rec(flds);
|
||||
}
|
||||
|
||||
case (ast.ty_fn(_, ?proto, ?inputs, ?output)) {
|
||||
case (ast.ty_fn(?proto, ?inputs, ?output)) {
|
||||
auto f = bind ast_arg_to_arg(getter, _);
|
||||
auto i = _vec.map[ast.ty_arg, arg](f, inputs);
|
||||
sty = ty.ty_fn(proto, i, ast_ty_to_ty(getter, output));
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ fn mk_fn_info(_fn f) -> fn_info {
|
|||
ret res;
|
||||
}
|
||||
|
||||
/* extends mk_fn_info to an item, side-effecting the map fi from
|
||||
/* extends mk_fn_info to an item, side-effecting the map fi from
|
||||
function IDs to fn_info maps */
|
||||
fn mk_fn_info_item_fn(&_fn_info_map fi, &span sp, ident i, &ast._fn f,
|
||||
vec[ast.ty_param] ty_params, def_id id, ann a) -> @item {
|
||||
|
|
@ -888,14 +888,14 @@ fn find_pre_post_expr(&_fn_info_map fm, &fn_info enclosing, &expr e) -> () {
|
|||
}
|
||||
}
|
||||
|
||||
impure fn gen(&fn_info enclosing, &ann a, def_id id) -> bool {
|
||||
fn gen(&fn_info enclosing, &ann a, def_id id) -> bool {
|
||||
check(enclosing.contains_key(id));
|
||||
let uint i = (enclosing.get(id))._0;
|
||||
|
||||
ret set_in_postcond(i, (ann_to_ts_ann_fail_more(a)).conditions);
|
||||
}
|
||||
|
||||
impure fn gen_poststate(&fn_info enclosing, &ann a, def_id id) -> bool {
|
||||
fn gen_poststate(&fn_info enclosing, &ann a, def_id id) -> bool {
|
||||
check(enclosing.contains_key(id));
|
||||
let uint i = (enclosing.get(id))._0;
|
||||
|
||||
|
|
@ -976,7 +976,7 @@ fn find_pre_post_state_item(_fn_info_map fm, @item i) -> bool {
|
|||
fail;
|
||||
}
|
||||
|
||||
impure fn set_prestate_ann(ann a, prestate pre) -> bool {
|
||||
fn set_prestate_ann(ann a, prestate pre) -> bool {
|
||||
alt (a) {
|
||||
case (ann_type(_,_,?ts_a)) {
|
||||
check (! is_none[@ts_ann](ts_a));
|
||||
|
|
@ -990,7 +990,7 @@ impure fn set_prestate_ann(ann a, prestate pre) -> bool {
|
|||
}
|
||||
|
||||
|
||||
impure fn extend_prestate_ann(ann a, prestate pre) -> bool {
|
||||
fn extend_prestate_ann(ann a, prestate pre) -> bool {
|
||||
alt (a) {
|
||||
case (ann_type(_,_,?ts_a)) {
|
||||
check (! is_none[@ts_ann](ts_a));
|
||||
|
|
@ -1003,7 +1003,7 @@ impure fn extend_prestate_ann(ann a, prestate pre) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
impure fn set_poststate_ann(ann a, poststate post) -> bool {
|
||||
fn set_poststate_ann(ann a, poststate post) -> bool {
|
||||
alt (a) {
|
||||
case (ann_type(_,_,?ts_a)) {
|
||||
check (! is_none[@ts_ann](ts_a));
|
||||
|
|
@ -1016,7 +1016,7 @@ impure fn set_poststate_ann(ann a, poststate post) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
impure fn extend_poststate_ann(ann a, poststate post) -> bool {
|
||||
fn extend_poststate_ann(ann a, poststate post) -> bool {
|
||||
alt (a) {
|
||||
case (ann_type(_,_,?ts_a)) {
|
||||
check (! is_none[@ts_ann](ts_a));
|
||||
|
|
@ -1029,7 +1029,7 @@ impure fn extend_poststate_ann(ann a, poststate post) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
impure fn set_pre_and_post(&ann a, pre_and_post pp) -> () {
|
||||
fn set_pre_and_post(&ann a, pre_and_post pp) -> () {
|
||||
alt (a) {
|
||||
case (ann_type(_,_,?ts_a)) {
|
||||
check (! is_none[@ts_ann](ts_a));
|
||||
|
|
@ -1068,7 +1068,7 @@ fn find_pre_post_state_exprs(&_fn_info_map fm,
|
|||
ret changed;
|
||||
}
|
||||
|
||||
impure fn pure_exp(&ann a, &prestate p) -> bool {
|
||||
fn pure_exp(&ann a, &prestate p) -> bool {
|
||||
auto changed = false;
|
||||
changed = extend_prestate_ann(a, p) || changed;
|
||||
changed = extend_poststate_ann(a, p) || changed;
|
||||
|
|
@ -1363,7 +1363,7 @@ fn fixed_point_states(_fn_info_map fm, fn_info f_info,
|
|||
}
|
||||
}
|
||||
|
||||
impure fn check_states_expr(fn_info enclosing, &expr e) -> () {
|
||||
fn check_states_expr(fn_info enclosing, &expr e) -> () {
|
||||
let precond prec = expr_precond(e);
|
||||
let prestate pres = expr_prestate(e);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue