Skip to content

typestate_check can now handle expr_block, expr_if, and expr_binary #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/comp/front/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ tag block_index_entry {
}
type block_ = rec(vec[@stmt] stmts,
option.t[@expr] expr,
hashmap[ident,block_index_entry] index);
hashmap[ident,block_index_entry] index,
ann a); /* ann is only meaningful for the ts_ann field */

type variant_def = tup(def_id /* tag */, def_id /* variant */);

Expand Down
2 changes: 1 addition & 1 deletion src/comp/front/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ fn index_block(vec[@ast.stmt] stmts, option.t[@ast.expr] expr) -> ast.block_ {
for (@ast.stmt s in stmts) {
ast.index_stmt(index, s);
}
ret rec(stmts=stmts, expr=expr, index=index);
ret rec(stmts=stmts, expr=expr, index=index, a=ast.ann_none);
}

fn index_arm(@ast.pat pat) -> hashmap[ast.ident,ast.def_id] {
Expand Down
3 changes: 2 additions & 1 deletion src/comp/middle/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block {
}
}

ret respan(blk.span, rec(stmts=stmts, expr=expr, index=index));
auto aa = fld.fold_ann(env, blk.node.a);
ret respan(blk.span, rec(stmts=stmts, expr=expr, index=index, a=aa));
}

fn fold_arm[ENV](&ENV env, ast_fold[ENV] fld, &arm a) -> arm {
Expand Down
6 changes: 4 additions & 2 deletions src/comp/middle/typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,8 @@ mod Pushdown {
auto e_1 = pushdown_expr(fcx, expected, e_0);
auto block_ = rec(stmts=bloc.node.stmts,
expr=some[@ast.expr](e_1),
index=bloc.node.index);
index=bloc.node.index,
a=boring_ann());
ret fold.respan[ast.block_](bloc.span, block_);
}
case (none[@ast.expr]) {
Expand Down Expand Up @@ -2569,7 +2570,8 @@ fn check_block(&@fn_ctxt fcx, &ast.block block) -> ast.block {

ret fold.respan[ast.block_](block.span,
rec(stmts=stmts, expr=expr,
index=block.node.index));
index=block.node.index,
a=boring_ann()));
}

fn check_const(&@crate_ctxt ccx, &span sp, ast.ident ident, @ast.ty t,
Expand Down
Loading