aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-02-01 16:26:49 -0800
committerGraydon Hoare <[email protected]>2011-02-01 16:26:49 -0800
commitb3689e7c209d6caf6a0a551b9fbfe87942be723d (patch)
tree6dc351ce45a13fb6416664f3ec708d0fa6b8f134
parentImplement 'else if' (diff)
downloadrust-b3689e7c209d6caf6a0a551b9fbfe87942be723d.tar.xz
rust-b3689e7c209d6caf6a0a551b9fbfe87942be723d.zip
Pick up case for expr_block from brson's other branch.
-rw-r--r--src/comp/middle/typeck.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 7112e982..725c02fd 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -1333,6 +1333,21 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
ast.expr_alt(expr_1, arms_1, ann));
}
+ case (ast.expr_block(?b, _)) {
+ auto b_0 = check_block(fcx, b);
+ auto ann;
+ alt (b_0.node.expr) {
+ case (some[@ast.expr](?expr)) {
+ ann = ast.ann_type(expr_ty(expr));
+ }
+ case (none[@ast.expr]) {
+ ann = ast.ann_type(plain_ty(ty.ty_nil));
+ }
+ }
+ ret @fold.respan[ast.expr_](expr.span,
+ ast.expr_block(b_0, ann));
+ }
+
case (ast.expr_bind(?f, ?args, _)) {
auto f_0 = check_expr(fcx, f);
auto t_0 = expr_ty(f_0);