Fix match_refs and let_returns in layout, address review changes

This commit is contained in:
Manish Goregaokar 2015-09-04 10:51:24 +05:30
parent 5c24da3e2d
commit 8e2c37a542
12 changed files with 54 additions and 62 deletions

View file

@ -63,13 +63,13 @@ struct State {
impl Scope {
pub fn new(name: String) -> Scope {
STATE_KEY.with(|ref r| {
match &mut *r.borrow_mut() {
&mut Some(ref mut state) => {
match *r.borrow_mut() {
Some(ref mut state) => {
let flow_trace = json::encode(&flow::base(&*state.flow_root)).unwrap();
let data = box ScopeData::new(name.clone(), flow_trace);
state.scope_stack.push(data);
}
&mut None => {}
None => {}
}
});
Scope
@ -80,14 +80,14 @@ impl Scope {
impl Drop for Scope {
fn drop(&mut self) {
STATE_KEY.with(|ref r| {
match &mut *r.borrow_mut() {
&mut Some(ref mut state) => {
match *r.borrow_mut() {
Some(ref mut state) => {
let mut current_scope = state.scope_stack.pop().unwrap();
current_scope.post = json::encode(&flow::base(&*state.flow_root)).unwrap();
let previous_scope = state.scope_stack.last_mut().unwrap();
previous_scope.children.push(current_scope);
}
&mut None => {}
None => {}
}
});
}