Last active
December 20, 2015 07:29
-
-
Save kemurphy/6093683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let replace_id = @mut None; | |
let rewriter = @fold::AstFoldFns { | |
fold_expr: do fold::wrap |e, fld| { | |
match fold_expr(e, fld, self.def_map, replace_id) { | |
Some(f) => { | |
debug!("Rewriting: wrote expr_struct"); | |
f | |
} | |
None => fold::noop_fold_expr(e, fld) | |
} | |
}, | |
new_id: |id| replace_id.get_or_default(id), | |
.. *fold::default_ast_fold() | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut replace_id = None; | |
let rewriter = @fold::AstFoldFns { | |
fold_expr: do fold::wrap |e, fld| { | |
match fold_expr(e, fld, self.def_map, &mut replace_id) { | |
Some(f) => { | |
debug!("Rewriting: wrote expr_struct"); | |
f | |
} | |
None => fold::noop_fold_expr(e, fld) | |
} | |
}, | |
new_id: |id| replace_id.get_or_default(id), | |
.. *fold::default_ast_fold() | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment