diff options
| author | Tim Chevalier <[email protected]> | 2011-04-12 19:03:52 -0700 |
|---|---|---|
| committer | Tim Chevalier <[email protected]> | 2011-04-12 19:03:52 -0700 |
| commit | 63e87c102d7b57b697fe274c64b9c895113e9171 (patch) | |
| tree | b349625cabef2df8754b228b5126e7ade1c80788 /src/comp/front | |
| parent | Finish the majority of statement -> expression rearrangement in manual. (diff) | |
| download | rust-63e87c102d7b57b697fe274c64b9c895113e9171.tar.xz rust-63e87c102d7b57b697fe274c64b9c895113e9171.zip | |
typestate_check can now handle expr_block, expr_if, and expr_binary
(caveat for the latter: it assumes that binary operations are strict;
a TODO is to detect or and and and correctly reflect that they're lazy
in the second argument). I had to add an ann field to ast.block,
resulting in the usual boilerplate changes.
Test cases that currently work (if you uncomment the typestate pass
in the driver) (all these are under test/compile-fail):
fru-typestate
ret-uninit
use-uninit
use-uninit-2
use-uninit-3
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 3 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index dfc69695..b0035ba6 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -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 */); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 85badb1e..ab44f638 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -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] { |