about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/front/ast.rs7
-rw-r--r--src/comp/middle/tstate/pre_post_conditions.rs15
-rw-r--r--src/comp/middle/tstate/states.rs9
3 files changed, 16 insertions, 15 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index bfe7d576cfd..c601d799214 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -301,6 +301,13 @@ tag lit_ {
     lit_bool(bool);
 }
 
+fn is_path(&@expr e) -> bool {
+    ret alt (e.node) {
+        case (expr_path(_)) { true }
+        case (_) { false }
+    };
+}
+
 
 // NB: If you change this, you'll probably want to change the corresponding
 // type structure in middle/ty.rs as well.
diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs
index e5eaadbb283..672894c0675 100644
--- a/src/comp/middle/tstate/pre_post_conditions.rs
+++ b/src/comp/middle/tstate/pre_post_conditions.rs
@@ -367,11 +367,12 @@ fn find_pre_post_expr(&fn_ctxt fcx, @expr e) {
                 }
                 case (_) { find_pre_post_exprs(fcx, [lhs, rhs], e.id); }
             }
-            forget_in_postcond(fcx, e.id, rhs.id);
+            if (is_path(rhs)) {
+                forget_in_postcond(fcx, e.id, rhs.id);
+            }
         }
         case (expr_swap(?lhs, ?rhs)) {
             // Both sides must already be initialized
-            
             find_pre_post_exprs(fcx, [lhs, rhs], e.id);
             forget_in_postcond_still_init(fcx, e.id, lhs.id);
             forget_in_postcond_still_init(fcx, e.id, rhs.id);
@@ -591,14 +592,10 @@ fn find_pre_post_stmt(&fn_ctxt fcx, &stmt s) {
                                 rec(id=alocal.node.id, 
                                     c=ninit(alocal.node.ident)));
                             
-                            alt (an_init.op) {
-                                case (init_move) {
-                                    forget_in_postcond(fcx, id,
-                                                       an_init.expr.id);
-                                }
-                                case (_) { /* nothing gets deinitialized */ } 
+                            if (an_init.op == init_move &&
+                                is_path(an_init.expr)) {
+                                forget_in_postcond(fcx, id, an_init.expr.id);
                             }
-
                         }
                         case (none) {
                             clear_pp(node_id_to_ts_ann(fcx.ccx,
diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs
index 8af52ed83a0..386d1cff8a2 100644
--- a/src/comp/middle/tstate/states.rs
+++ b/src/comp/middle/tstate/states.rs
@@ -633,12 +633,9 @@ fn find_pre_post_state_stmt(&fn_ctxt fcx, &prestate pres, @stmt s) -> bool {
 
                             auto post = tritv_clone(expr_poststate(fcx.ccx,
                                                       an_init.expr));
-                            alt (an_init.op) {
-                                case (init_move) {
-                                    clear_in_poststate_expr(fcx, an_init.expr,
-                                                            post);
-                                }
-                                case (_) { /* nothing gets deinitialized */ } 
+                            if (an_init.op == init_move) {
+                                clear_in_poststate_expr(fcx, an_init.expr,
+                                                        post);
                             }
 
                             set_in_poststate_ident(fcx, alocal.node.id,