Refactor ast.local to make room for initialization via recv
This commit is contained in:
parent
ef1bcdea70
commit
71f058499a
6 changed files with 29 additions and 17 deletions
|
|
@ -194,10 +194,18 @@ tag stmt_ {
|
|||
stmt_crate_directive(@crate_directive);
|
||||
}
|
||||
|
||||
tag init_op {
|
||||
init_assign;
|
||||
init_recv;
|
||||
}
|
||||
|
||||
type initializer = rec(init_op op,
|
||||
@expr expr);
|
||||
|
||||
type local = rec(option.t[@ty] ty,
|
||||
bool infer,
|
||||
ident ident,
|
||||
option.t[@expr] init,
|
||||
option.t[initializer] init,
|
||||
def_id id,
|
||||
ann ann);
|
||||
|
||||
|
|
|
|||
|
|
@ -1364,13 +1364,14 @@ impure fn parse_expr_inner(parser p) -> @ast.expr {
|
|||
}
|
||||
}
|
||||
|
||||
impure fn parse_initializer(parser p) -> option.t[@ast.expr] {
|
||||
impure fn parse_initializer(parser p) -> option.t[ast.initializer] {
|
||||
if (p.peek() == token.EQ) {
|
||||
p.bump();
|
||||
ret some(parse_expr(p));
|
||||
ret some(rec(op = ast.init_assign,
|
||||
expr = parse_expr(p)));
|
||||
}
|
||||
|
||||
ret none[@ast.expr];
|
||||
ret none[ast.initializer];
|
||||
}
|
||||
|
||||
impure fn parse_pat(parser p) -> @ast.pat {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue