Remove syntax and syntax_pos thread locals
This commit is contained in:
parent
fab632f975
commit
cbdf4ec03e
29 changed files with 1212 additions and 998 deletions
|
@ -35,10 +35,13 @@ use std::ops::{Add, Sub};
|
|||
use std::path::PathBuf;
|
||||
|
||||
use rustc_data_structures::stable_hasher::StableHasher;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::sync::{Lrc, Lock};
|
||||
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
#[macro_use]
|
||||
extern crate scoped_tls;
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
extern crate serialize;
|
||||
|
@ -54,6 +57,24 @@ pub use span_encoding::{Span, DUMMY_SP};
|
|||
|
||||
pub mod symbol;
|
||||
|
||||
pub struct Globals {
|
||||
symbol_interner: Lock<symbol::Interner>,
|
||||
span_interner: Lock<span_encoding::SpanInterner>,
|
||||
hygiene_data: Lock<hygiene::HygieneData>,
|
||||
}
|
||||
|
||||
impl Globals {
|
||||
pub fn new() -> Globals {
|
||||
Globals {
|
||||
symbol_interner: Lock::new(symbol::Interner::fresh()),
|
||||
span_interner: Lock::new(span_encoding::SpanInterner::default()),
|
||||
hygiene_data: Lock::new(hygiene::HygieneData::new()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scoped_thread_local!(pub static GLOBALS: Globals);
|
||||
|
||||
/// Differentiates between real files and common virtual files
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
|
||||
pub enum FileName {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue