diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-05-02 18:33:33 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-05-10 02:46:18 -0400 |
| commit | 5eb6d19803ebcb5279f8a42b584a4d81152fa82d (patch) | |
| tree | f64e9e944ccaaf83b8a993c0ce1c404f22c9cd41 /src/libsyntax/ext/pipes | |
| parent | 3ce9dba6775c7e1dbfb510626c073a8f926b6880 (diff) | |
syntax: Use the new `for` protocol
Diffstat (limited to 'src/libsyntax/ext/pipes')
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 647c7741bd8..7c78ec066d0 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -100,6 +100,7 @@ pub impl state_ { /// Iterate over the states that can be reached in one message /// from this state. + #[cfg(stage0)] fn reachable(&self, f: &fn(state) -> bool) { for self.messages.each |m| { match *m { @@ -111,6 +112,21 @@ pub impl state_ { } } } + /// Iterate over the states that can be reached in one message + /// from this state. + #[cfg(not(stage0))] + fn reachable(&self, f: &fn(state) -> bool) -> bool { + for self.messages.each |m| { + match *m { + message(_, _, _, _, Some(next_state { state: ref id, _ })) => { + let state = self.proto.get_state((*id)); + if !f(state) { return false; } + } + _ => () + } + } + return true; + } } pub type protocol = @mut protocol_; |
