Further work on typestate. Handles expr_rec and expr_assign now.
Also changed the ts_ann field on statements to be an ann instead, which explains most of the changes. As well, got rid of the "warning: no type for expression" error by filling in annotations for local decls in typeck (not sure whether this was my fault or not). Finally, in bitv, added a clone() function to copy a bit vector, and fixed is_true, is_false, and to_str to not be nonsense.
This commit is contained in:
parent
87d17c3a2c
commit
d7e8818414
8 changed files with 547 additions and 251 deletions
|
@ -11,7 +11,7 @@ import util.common;
|
|||
import util.common.filename;
|
||||
import util.common.span;
|
||||
import util.common.new_str_hash;
|
||||
import util.typestate_ann.ts_ann;
|
||||
import util.common.plain_ann;
|
||||
|
||||
tag restriction {
|
||||
UNRESTRICTED;
|
||||
|
@ -1562,14 +1562,15 @@ impure fn parse_source_stmt(parser p) -> @ast.stmt {
|
|||
|
||||
case (token.LET) {
|
||||
auto decl = parse_let(p);
|
||||
ret @spanned(lo, decl.span.hi,
|
||||
ast.stmt_decl(decl, none[@ts_ann]));
|
||||
auto hi = p.get_span();
|
||||
ret @spanned
|
||||
(lo, decl.span.hi, ast.stmt_decl(decl, plain_ann()));
|
||||
}
|
||||
|
||||
case (token.AUTO) {
|
||||
auto decl = parse_auto(p);
|
||||
ret @spanned(lo, decl.span.hi,
|
||||
ast.stmt_decl(decl, none[@ts_ann]));
|
||||
auto hi = p.get_span();
|
||||
ret @spanned(lo, decl.span.hi, ast.stmt_decl(decl, plain_ann()));
|
||||
}
|
||||
|
||||
case (_) {
|
||||
|
@ -1578,12 +1579,13 @@ impure fn parse_source_stmt(parser p) -> @ast.stmt {
|
|||
auto i = parse_item(p);
|
||||
auto hi = i.span.hi;
|
||||
auto decl = @spanned(lo, hi, ast.decl_item(i));
|
||||
ret @spanned(lo, hi, ast.stmt_decl(decl, none[@ts_ann]));
|
||||
ret @spanned(lo, hi, ast.stmt_decl(decl, plain_ann()));
|
||||
|
||||
} else {
|
||||
// Remainder are line-expr stmts.
|
||||
auto e = parse_expr(p);
|
||||
ret @spanned(lo, e.span.hi, ast.stmt_expr(e, none[@ts_ann]));
|
||||
auto hi = p.get_span();
|
||||
ret @spanned(lo, e.span.hi, ast.stmt_expr(e, plain_ann()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue