librustc: De-@mut the parse session

This commit is contained in:
Patrick Walton 2013-12-27 11:56:29 -08:00
parent f553701da6
commit 3aa19a6b86
8 changed files with 48 additions and 49 deletions

View file

@ -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 {

View file

@ -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());

View file

@ -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));