Add _mutable unop.
This commit is contained in:
parent
2bba49a9fe
commit
9ae89bd404
4 changed files with 14 additions and 0 deletions
|
|
@ -106,6 +106,7 @@ tag unop {
|
|||
bitnot;
|
||||
not;
|
||||
neg;
|
||||
_mutable;
|
||||
}
|
||||
|
||||
tag mode {
|
||||
|
|
|
|||
|
|
@ -811,6 +811,13 @@ impure fn parse_prefix_expr(parser p) -> @ast.expr {
|
|||
ex = ast.expr_unary(ast.box, e, ast.ann_none);
|
||||
}
|
||||
|
||||
case (token.MUTABLE) {
|
||||
p.bump();
|
||||
auto e = parse_prefix_expr(p);
|
||||
hi = e.span;
|
||||
ex = ast.expr_unary(ast._mutable, e, ast.ann_none);
|
||||
}
|
||||
|
||||
case (_) {
|
||||
ret parse_dot_or_call_expr(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1834,6 +1834,9 @@ fn trans_unary(@block_ctxt cx, ast.unop op,
|
|||
}
|
||||
ret res(sub.bcx, val);
|
||||
}
|
||||
case (ast._mutable) {
|
||||
ret trans_expr(cx, e);
|
||||
}
|
||||
}
|
||||
fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1229,6 +1229,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
|
|||
}
|
||||
}
|
||||
}
|
||||
case (ast._mutable) {
|
||||
oper_t = @rec(mut=ast.mut with *oper_t);
|
||||
}
|
||||
case (_) { oper_t = strip_boxes(oper_t); }
|
||||
}
|
||||
ret @fold.respan[ast.expr_](expr.span,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue