diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-12-27 11:56:29 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-01-03 14:01:56 -0800 |
| commit | 3aa19a6b86ef8317cd95fd517dcc24216d857eb1 (patch) | |
| tree | 459ee753848f275e46afb61fb0fc155c4cee9344 /src/libsyntax/ext | |
| parent | f553701da64dd70d1fa6b757208f012dbad118d7 (diff) | |
| download | rust-3aa19a6b86ef8317cd95fd517dcc24216d857eb1.tar.gz rust-3aa19a6b86ef8317cd95fd517dcc24216d857eb1.zip | |
librustc: De-`@mut` the parse session
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 17 |
3 files changed, 13 insertions, 14 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 03e028ea1f1..b4888f1092f 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -284,7 +284,7 @@ pub fn syntax_expander_table() -> SyntaxEnv { // when a macro expansion occurs, the resulting nodes have the backtrace() // -> expn_info of their expansion context stored into their span. pub struct ExtCtxt { - parse_sess: @mut parse::ParseSess, + parse_sess: @parse::ParseSess, cfg: ast::CrateConfig, backtrace: Option<@ExpnInfo>, @@ -293,7 +293,7 @@ pub struct ExtCtxt { } impl ExtCtxt { - pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig) + pub fn new(parse_sess: @parse::ParseSess, cfg: ast::CrateConfig) -> ExtCtxt { ExtCtxt { parse_sess: parse_sess, @@ -320,7 +320,7 @@ impl ExtCtxt { } pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm } - pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess } + pub fn parse_sess(&self) -> @parse::ParseSess { self.parse_sess } pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() } pub fn call_site(&self) -> Span { match self.backtrace { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 1d9620d405f..b8e39f80d47 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -889,7 +889,7 @@ impl ast_fold for Injector { // add a bunch of macros as though they were placed at the head of the // program (ick). This should run before cfg stripping. -pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, +pub fn inject_std_macros(parse_sess: @parse::ParseSess, cfg: ast::CrateConfig, c: Crate) -> Crate { @@ -939,7 +939,7 @@ impl<'a> ast_fold for MacroExpander<'a> { } } -pub fn expand_crate(parse_sess: @mut parse::ParseSess, +pub fn expand_crate(parse_sess: @parse::ParseSess, cfg: ast::CrateConfig, c: Crate) -> Crate { let mut cx = ExtCtxt::new(parse_sess, cfg.clone()); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 4d2923f391e..004fd3e325b 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -188,9 +188,9 @@ pub enum named_match { pub type earley_item = ~MatcherPos; -pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match]) +pub fn nameize(p_s: @ParseSess, ms: &[matcher], res: &[@named_match]) -> HashMap<Ident,@named_match> { - fn n_rec(p_s: @mut ParseSess, m: &matcher, res: &[@named_match], + fn n_rec(p_s: @ParseSess, m: &matcher, res: &[@named_match], ret_val: &mut HashMap<Ident, @named_match>) { match *m { codemap::Spanned {node: match_tok(_), .. } => (), @@ -222,7 +222,7 @@ pub enum parse_result { } pub fn parse_or_else( - sess: @mut ParseSess, + sess: @ParseSess, cfg: ast::CrateConfig, rdr: @mut reader, ms: ~[matcher] @@ -243,12 +243,11 @@ pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { } } -pub fn parse( - sess: @mut ParseSess, - cfg: ast::CrateConfig, - rdr: @mut reader, - ms: &[matcher] -) -> parse_result { +pub fn parse(sess: @ParseSess, + cfg: ast::CrateConfig, + rdr: @mut reader, + ms: &[matcher]) + -> parse_result { let mut cur_eis = ~[]; cur_eis.push(initial_matcher_pos(ms.to_owned(), None, rdr.peek().sp.lo)); |
