diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-13 16:45:50 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-14 01:47:56 +0300 |
| commit | 6a045b9d1c3c6419d1e4f9cfcd1d81359d0859f8 (patch) | |
| tree | d4125d9d79590564df85a5eee575ec3174cb2a89 /src/libsyntax/parse | |
| parent | 222cd73b8a422d2c4124375f6aaffd2663bb9718 (diff) | |
| download | rust-6a045b9d1c3c6419d1e4f9cfcd1d81359d0859f8.tar.gz rust-6a045b9d1c3c6419d1e4f9cfcd1d81359d0859f8.zip | |
Move tracking of the next NodeId from syntax's ParseSess to rustc's Session.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 8c9ce5f78d4..e207b197e83 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -18,7 +18,7 @@ use parse::parser::Parser; use ptr::P; use str::char_at; -use std::cell::{Cell, RefCell}; +use std::cell::RefCell; use std::fs::File; use std::io::Read; use std::iter; @@ -44,14 +44,12 @@ pub struct ParseSess { pub span_diagnostic: SpanHandler, // better be the same as the one in the reader! /// Used to determine and report recursive mod inclusions included_mod_stack: RefCell<Vec<PathBuf>>, - pub node_id: Cell<ast::NodeId>, } pub fn new_parse_sess() -> ParseSess { ParseSess { span_diagnostic: mk_span_handler(default_handler(Auto, None, true), CodeMap::new()), included_mod_stack: RefCell::new(Vec::new()), - node_id: Cell::new(1), } } @@ -59,23 +57,6 @@ pub fn new_parse_sess_special_handler(sh: SpanHandler) -> ParseSess { ParseSess { span_diagnostic: sh, included_mod_stack: RefCell::new(Vec::new()), - node_id: Cell::new(1), - } -} - -impl ParseSess { - pub fn next_node_id(&self) -> ast::NodeId { - self.reserve_node_ids(1) - } - pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId { - let v = self.node_id.get(); - - match v.checked_add(count) { - Some(next) => { self.node_id.set(next); } - None => panic!("Input too large, ran out of node ids!") - } - - v } } |
