Fix fold bug on expr_unary.
This commit is contained in:
parent
df5f8f3e37
commit
cdcab742a7
2 changed files with 3 additions and 1 deletions
|
@ -404,7 +404,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
|
||||||
|
|
||||||
case (ast.expr_unary(?op, ?a, ?t)) {
|
case (ast.expr_unary(?op, ?a, ?t)) {
|
||||||
auto aa = fold_expr(env_, fld, a);
|
auto aa = fold_expr(env_, fld, a);
|
||||||
ret fld.fold_expr_unary(env_, e.span, op, a, t);
|
ret fld.fold_expr_unary(env_, e.span, op, aa, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
case (ast.expr_lit(?lit, ?t)) {
|
case (ast.expr_lit(?lit, ?t)) {
|
||||||
|
|
|
@ -271,6 +271,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty {
|
||||||
|
|
||||||
case (ast.ty_path(?path, ?def)) {
|
case (ast.ty_path(?path, ?def)) {
|
||||||
auto def_id;
|
auto def_id;
|
||||||
|
check (def != none[ast.def]);
|
||||||
alt (option.get[ast.def](def)) {
|
alt (option.get[ast.def](def)) {
|
||||||
case (ast.def_ty(?id)) { def_id = id; }
|
case (ast.def_ty(?id)) { def_id = id; }
|
||||||
case (_) { fail; }
|
case (_) { fail; }
|
||||||
|
@ -1247,6 +1248,7 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
|
||||||
|
|
||||||
case (ast.expr_name(?name, ?defopt, _)) {
|
case (ast.expr_name(?name, ?defopt, _)) {
|
||||||
auto t = plain_ty(ty_nil);
|
auto t = plain_ty(ty_nil);
|
||||||
|
check (defopt != none[ast.def]);
|
||||||
alt (option.get[ast.def](defopt)) {
|
alt (option.get[ast.def](defopt)) {
|
||||||
case (ast.def_arg(?id)) {
|
case (ast.def_arg(?id)) {
|
||||||
check (fcx.locals.contains_key(id));
|
check (fcx.locals.contains_key(id));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue