about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-26 00:57:14 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-26 00:59:41 -0700
commitb0db13956f4f106c4bf5a9210c7df439b34506a4 (patch)
treee130bec88faad321a847c33b0e343b0b92612a74 /src
parent1b60bba141c54f374d3378aa229c756d4a8f7f3d (diff)
Revert "Use typestate constraints for trans_be"
This reverts commit 1b60bba141c54f374d3378aa229c756d4a8f7f3d.
(Need a snapshot first)
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs15
-rw-r--r--src/comp/syntax/ast_util.rs4
2 files changed, 6 insertions, 13 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 16ec18e2bd6..bae944659d9 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -4450,14 +4450,7 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) ->
       ast::expr_cont. { ret trans_cont(e.span, cx); }
       ast::expr_ret(ex) { ret trans_ret(cx, ex); }
       ast::expr_put(ex) { ret trans_put(cx, ex); }
-      ast::expr_be(ex) {
-        // Ideally, the expr_be tag would have a precondition
-        // that is_call_expr(ex) -- but we don't support that
-        // yet
-        // FIXME
-        check ast_util::is_call_expr(ex);
-        ret trans_be(cx, ex);
-      }
+      ast::expr_be(ex) { ret trans_be(cx, ex); }
       ast::expr_anon_obj(anon_obj) {
         ret trans_anon_obj(cx, e.span, anon_obj, e.id);
       }
@@ -4783,10 +4776,10 @@ fn trans_ret(cx: &@block_ctxt, e: &option::t<@ast::expr>) -> result {
 
 fn build_return(bcx: &@block_ctxt) { bld::Br(bcx, bcx_fcx(bcx).llreturn); }
 
-// fn trans_be(cx: &@block_ctxt, e: &@ast::expr) -> result {
-fn trans_be(cx: &@block_ctxt, e: &@ast::expr)
-    : ast_util::is_call_expr(e) -> result {
+fn trans_be(cx: &@block_ctxt, e: &@ast::expr) -> result {
+    // FIXME: This should be a typestate precondition
 
+    assert (ast_util::is_call_expr(e));
     // FIXME: Turn this into a real tail call once
     // calling convention issues are settled
 
diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs
index 15f41af5cac..517e252dd9c 100644
--- a/src/comp/syntax/ast_util.rs
+++ b/src/comp/syntax/ast_util.rs
@@ -167,8 +167,8 @@ fn is_exported(i: ident, m: _mod) -> bool {
     ret count == 0u && !nonlocal;
 }
 
-pure fn is_call_expr(e: @expr) -> bool {
-    alt e.node { expr_call(_, _) { true } _ { false } }
+fn is_call_expr(e: @expr) -> bool {
+    alt e.node { expr_call(_, _) { ret true; } _ { ret false; } }
 }
 
 fn is_constraint_arg(e: @expr) -> bool {