about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-27 11:56:29 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-03 14:01:56 -0800
commit3aa19a6b86ef8317cd95fd517dcc24216d857eb1 (patch)
tree459ee753848f275e46afb61fb0fc155c4cee9344 /src/libsyntax/parse
parentf553701da64dd70d1fa6b757208f012dbad118d7 (diff)
downloadrust-3aa19a6b86ef8317cd95fd517dcc24216d857eb1.tar.gz
rust-3aa19a6b86ef8317cd95fd517dcc24216d857eb1.zip
librustc: De-`@mut` the parse session
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/mod.rs50
-rw-r--r--src/libsyntax/parse/parser.rs6
2 files changed, 28 insertions, 28 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index b6139f0ae99..a20265e6d36 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -47,9 +47,9 @@ pub struct ParseSess {
     included_mod_stack: RefCell<~[Path]>,
 }
 
-pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
+pub fn new_parse_sess(demitter: Option<@Emitter>) -> @ParseSess {
     let cm = @CodeMap::new();
-    @mut ParseSess {
+    @ParseSess {
         cm: cm,
         span_diagnostic: mk_span_handler(mk_handler(demitter), cm),
         included_mod_stack: RefCell::new(~[]),
@@ -58,8 +58,8 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
 
 pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
                                       cm: @codemap::CodeMap)
-                                   -> @mut ParseSess {
-    @mut ParseSess {
+                                   -> @ParseSess {
+    @ParseSess {
         cm: cm,
         span_diagnostic: sh,
         included_mod_stack: RefCell::new(~[]),
@@ -74,7 +74,7 @@ pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
 pub fn parse_crate_from_file(
     input: &Path,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> ast::Crate {
     new_parser_from_file(sess, /*bad*/ cfg.clone(), input).parse_crate_mod()
     // why is there no p.abort_if_errors here?
@@ -83,7 +83,7 @@ pub fn parse_crate_from_file(
 pub fn parse_crate_attrs_from_file(
     input: &Path,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> ~[ast::Attribute] {
     let mut parser = new_parser_from_file(sess, cfg, input);
     let (inner, _) = parser.parse_inner_attrs_and_next();
@@ -94,7 +94,7 @@ pub fn parse_crate_from_source_str(
     name: @str,
     source: @str,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> ast::Crate {
     let mut p = new_parser_from_source_str(sess,
                                            /*bad*/ cfg.clone(),
@@ -107,7 +107,7 @@ pub fn parse_crate_attrs_from_source_str(
     name: @str,
     source: @str,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> ~[ast::Attribute] {
     let mut p = new_parser_from_source_str(sess,
                                            /*bad*/ cfg.clone(),
@@ -121,7 +121,7 @@ pub fn parse_expr_from_source_str(
     name: @str,
     source: @str,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> @ast::Expr {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_expr(), p)
@@ -132,7 +132,7 @@ pub fn parse_item_from_source_str(
     source: @str,
     cfg: ast::CrateConfig,
     attrs: ~[ast::Attribute],
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> Option<@ast::item> {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_item(attrs),p)
@@ -142,7 +142,7 @@ pub fn parse_meta_from_source_str(
     name: @str,
     source: @str,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> @ast::MetaItem {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_meta_item(),p)
@@ -153,7 +153,7 @@ pub fn parse_stmt_from_source_str(
     source: @str,
     cfg: ast::CrateConfig,
     attrs: ~[ast::Attribute],
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> @ast::Stmt {
     let mut p = new_parser_from_source_str(
         sess,
@@ -168,7 +168,7 @@ pub fn parse_tts_from_source_str(
     name: @str,
     source: @str,
     cfg: ast::CrateConfig,
-    sess: @mut ParseSess
+    sess: @ParseSess
 ) -> ~[ast::token_tree] {
     let mut p = new_parser_from_source_str(
         sess,
@@ -192,7 +192,7 @@ pub fn parse_from_source_str<T>(
                              ss: codemap::FileSubstr,
                              source: @str,
                              cfg: ast::CrateConfig,
-                             sess: @mut ParseSess)
+                             sess: @ParseSess)
                              -> T {
     let mut p = new_parser_from_source_substr(sess, cfg, name, ss, source);
     let r = f(&mut p);
@@ -203,7 +203,7 @@ pub fn parse_from_source_str<T>(
 }
 
 // Create a new parser from a source string
-pub fn new_parser_from_source_str(sess: @mut ParseSess,
+pub fn new_parser_from_source_str(sess: @ParseSess,
                                   cfg: ast::CrateConfig,
                                   name: @str,
                                   source: @str)
@@ -213,7 +213,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
 
 // Create a new parser from a source string where the origin
 // is specified as a substring of another file.
-pub fn new_parser_from_source_substr(sess: @mut ParseSess,
+pub fn new_parser_from_source_substr(sess: @ParseSess,
                                   cfg: ast::CrateConfig,
                                   name: @str,
                                   ss: codemap::FileSubstr,
@@ -225,7 +225,7 @@ pub fn new_parser_from_source_substr(sess: @mut ParseSess,
 /// Create a new parser, handling errors as appropriate
 /// if the file doesn't exist
 pub fn new_parser_from_file(
-    sess: @mut ParseSess,
+    sess: @ParseSess,
     cfg: ast::CrateConfig,
     path: &Path
 ) -> Parser {
@@ -236,7 +236,7 @@ pub fn new_parser_from_file(
 /// the file at the given path to the codemap, and return a parser.
 /// On an error, use the given span as the source of the problem.
 pub fn new_sub_parser_from_file(
-    sess: @mut ParseSess,
+    sess: @ParseSess,
     cfg: ast::CrateConfig,
     path: &Path,
     sp: Span
@@ -245,7 +245,7 @@ pub fn new_sub_parser_from_file(
 }
 
 /// Given a filemap and config, return a parser
-pub fn filemap_to_parser(sess: @mut ParseSess,
+pub fn filemap_to_parser(sess: @ParseSess,
                          filemap: @FileMap,
                          cfg: ast::CrateConfig) -> Parser {
     tts_to_parser(sess,filemap_to_tts(sess,filemap),cfg)
@@ -253,7 +253,7 @@ pub fn filemap_to_parser(sess: @mut ParseSess,
 
 // must preserve old name for now, because quote! from the *existing*
 // compiler expands into it
-pub fn new_parser_from_tts(sess: @mut ParseSess,
+pub fn new_parser_from_tts(sess: @ParseSess,
                      cfg: ast::CrateConfig,
                      tts: ~[ast::token_tree]) -> Parser {
     tts_to_parser(sess,tts,cfg)
@@ -264,7 +264,7 @@ pub fn new_parser_from_tts(sess: @mut ParseSess,
 
 /// Given a session and a path and an optional span (for error reporting),
 /// add the path to the session's codemap and return the new filemap.
-pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>)
+pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
     -> @FileMap {
     let err = |msg: &str| {
         match spanopt {
@@ -293,20 +293,20 @@ pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>)
 
 // given a session and a string, add the string to
 // the session's codemap and return the new filemap
-pub fn string_to_filemap(sess: @mut ParseSess, source: @str, path: @str)
+pub fn string_to_filemap(sess: @ParseSess, source: @str, path: @str)
     -> @FileMap {
     sess.cm.new_filemap(path, source)
 }
 
 // given a session and a string and a path and a FileSubStr, add
 // the string to the CodeMap and return the new FileMap
-pub fn substring_to_filemap(sess: @mut ParseSess, source: @str, path: @str,
+pub fn substring_to_filemap(sess: @ParseSess, source: @str, path: @str,
                            filesubstr: FileSubstr) -> @FileMap {
     sess.cm.new_filemap_w_substr(path,filesubstr,source)
 }
 
 // given a filemap, produce a sequence of token-trees
-pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
+pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap)
     -> ~[ast::token_tree] {
     // it appears to me that the cfg doesn't matter here... indeed,
     // parsing tt's probably shouldn't require a parser at all.
@@ -317,7 +317,7 @@ pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
 }
 
 // given tts and cfg, produce a parser
-pub fn tts_to_parser(sess: @mut ParseSess,
+pub fn tts_to_parser(sess: @ParseSess,
                      tts: ~[ast::token_tree],
                      cfg: ast::CrateConfig) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index ed149c1a73e..0d7e31e1861 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -286,8 +286,8 @@ struct ParsedItemsAndViewItems {
 
 /* ident is handled by common.rs */
 
-pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
-           -> Parser {
+pub fn Parser(sess: @ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
+              -> Parser {
     let tok0 = rdr.next_token();
     let interner = get_ident_interner();
     let span = tok0.sp;
@@ -324,7 +324,7 @@ pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
 }
 
 pub struct Parser {
-    sess: @mut ParseSess,
+    sess: @ParseSess,
     cfg: CrateConfig,
     // the current token:
     token: token::Token,