about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-02-17 17:07:51 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-02-17 23:09:20 -0500
commit91fae2791292c7374143e82814a375a12bfd4e83 (patch)
tree3dfb15c581a44de87b3b87a17417d0a99ddc7f1b /src/libsyntax
parenta6945f2a45d56ef692cd8f2955dcef4e4c10d50a (diff)
downloadrust-91fae2791292c7374143e82814a375a12bfd4e83.tar.gz
rust-91fae2791292c7374143e82814a375a12bfd4e83.zip
Modernize bitv mut fields and explicit self
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index c690c89c025..a7f01d75648 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -43,13 +43,13 @@ use ext::base::ext_ctxt;
 use ext::pipes::proto::protocol;
 
 use core::str;
-use std::bitv::{Bitv};
+use std::bitv::Bitv;
 
 pub fn analyze(proto: protocol, _cx: ext_ctxt) {
     debug!("initializing colive analysis");
     let num_states = proto.num_states();
-    let colive = do (copy proto.states).map_to_vec |state| {
-        let bv = ~Bitv(num_states, false);
+    let mut colive = do (copy proto.states).map_to_vec |state| {
+        let mut bv = ~Bitv::new(num_states, false);
         for state.reachable |s| {
             bv.set(s.id, true);
         }
@@ -61,15 +61,19 @@ pub fn analyze(proto: protocol, _cx: ext_ctxt) {
     while changed {
         changed = false;
         debug!("colive iteration %?", i);
+        let mut new_colive = ~[];
         for colive.eachi |i, this_colive| {
+            let mut result = ~this_colive.clone();
             let this = proto.get_state_by_id(i);
             for this_colive.ones |j| {
                 let next = proto.get_state_by_id(j);
                 if this.dir == next.dir {
-                    changed = changed || this_colive.union(colive[j]);
+                    changed = result.union(colive[j]) || changed;
                 }
             }
+            new_colive.push(result)
         }
+        colive = new_colive;
         i += 1;
     }