Skip to content

Commit

Permalink
Clean up YieldFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Aug 25, 2017
1 parent c711531 commit 5366135
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/librustc/middle/region.rs
Expand Up @@ -1175,13 +1175,18 @@ struct YieldFinder<'a> {

impl<'a> YieldFinder<'a> {
fn lookup<F: FnOnce(&mut Self)>(&mut self, id: NodeId, f: F) {
if let Some(result) = self.cache.get(&id) {
self.result = *result;
// Don't traverse further if we found a yield expression
if self.result.is_some() {
return;
}
if self.result.is_some() {

// See if there's an entry in the cache
if let Some(result) = self.cache.get(&id) {
self.result = *result;
return;
}

// Otherwise calculate the result and insert it into the cache
f(self);
self.cache.insert(id, self.result);
}
Expand Down

0 comments on commit 5366135

Please sign in to comment.