Register new snapshots
This commit is contained in:
parent
e02313a172
commit
817576ee70
32 changed files with 32 additions and 1663 deletions
|
|
@ -804,7 +804,7 @@ pub fn new_sctable_internal() -> SCTable {
|
|||
|
||||
// fetch the SCTable from TLS, create one if it doesn't yet exist.
|
||||
pub fn get_sctable() -> @mut SCTable {
|
||||
static sctable_key: local_data::Key<@@mut SCTable> = &local_data::Key;
|
||||
local_data_key!(sctable_key: @@mut SCTable)
|
||||
match local_data::get(sctable_key, |k| k.map_move(|k| *k)) {
|
||||
None => {
|
||||
let new_table = @@mut new_sctable_internal();
|
||||
|
|
@ -841,7 +841,7 @@ pub type ResolveTable = HashMap<(Name,SyntaxContext),Name>;
|
|||
// okay, I admit, putting this in TLS is not so nice:
|
||||
// fetch the SCTable from TLS, create one if it doesn't yet exist.
|
||||
pub fn get_resolve_table() -> @mut ResolveTable {
|
||||
static resolve_table_key: local_data::Key<@@mut ResolveTable> = &local_data::Key;
|
||||
local_data_key!(resolve_table_key: @@mut ResolveTable)
|
||||
match local_data::get(resolve_table_key, |k| k.map(|&k| *k)) {
|
||||
None => {
|
||||
let new_table = @@mut HashMap::new();
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ fn diagnosticcolor(lvl: level) -> term::color::Color {
|
|||
}
|
||||
|
||||
fn print_maybe_styled(msg: &str, color: term::attr::Attr) {
|
||||
static tls_terminal: local_data::Key<@Option<term::Terminal>> = &local_data::Key;
|
||||
local_data_key!(tls_terminal: @Option<term::Terminal>)
|
||||
|
||||
let stderr = io::stderr();
|
||||
|
||||
|
|
|
|||
|
|
@ -644,25 +644,11 @@ impl AstBuilder for @ExtCtxt {
|
|||
|
||||
self.expr(span, ast::ExprFnBlock(fn_decl, blk))
|
||||
}
|
||||
#[cfg(stage0)]
|
||||
fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::Expr {
|
||||
let ext_cx = *self;
|
||||
let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone()));
|
||||
quote_expr!(|| $blk_e )
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::Expr {
|
||||
let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone()));
|
||||
quote_expr!(*self, || $blk_e )
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::Expr {
|
||||
let ext_cx = *self;
|
||||
let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone()));
|
||||
quote_expr!(|$ident| $blk_e )
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::Expr {
|
||||
let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone()));
|
||||
quote_expr!(*self, |$ident| $blk_e )
|
||||
|
|
|
|||
|
|
@ -22,18 +22,6 @@ use ext::build::AstBuilder;
|
|||
|
||||
use std::os;
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub fn expand_option_env(ext_cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
|
||||
-> base::MacResult {
|
||||
let var = get_single_str_from_tts(ext_cx, sp, tts, "option_env!");
|
||||
|
||||
let e = match os::getenv(var) {
|
||||
None => quote_expr!(::std::option::None::<&'static str>),
|
||||
Some(s) => quote_expr!(::std::option::Some($s))
|
||||
};
|
||||
MRExpr(e)
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
pub fn expand_option_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
|
||||
-> base::MacResult {
|
||||
let var = get_single_str_from_tts(cx, sp, tts, "option_env!");
|
||||
|
|
|
|||
|
|
@ -863,9 +863,7 @@ pub fn std_macros() -> @str {
|
|||
|
||||
use super::*;
|
||||
|
||||
static key: ::std::local_data::Key<
|
||||
@::std::condition::Handler<$input, $out>> =
|
||||
&::std::local_data::Key;
|
||||
local_data_key!(key: @::std::condition::Handler<$input, $out>)
|
||||
|
||||
pub static cond :
|
||||
::std::condition::Condition<$input,$out> =
|
||||
|
|
@ -884,9 +882,7 @@ pub fn std_macros() -> @str {
|
|||
|
||||
use super::*;
|
||||
|
||||
static key: ::std::local_data::Key<
|
||||
@::std::condition::Handler<$input, $out>> =
|
||||
&::std::local_data::Key;
|
||||
local_data_key!(key: @::std::condition::Handler<$input, $out>)
|
||||
|
||||
pub static cond :
|
||||
::std::condition::Condition<$input,$out> =
|
||||
|
|
@ -975,8 +971,6 @@ pub fn std_macros() -> @str {
|
|||
($($arg:tt)*) => (::std::io::println(format!($($arg)*)))
|
||||
)
|
||||
|
||||
// NOTE: use this after a snapshot lands to abstract the details
|
||||
// of the TLS interface.
|
||||
macro_rules! local_data_key (
|
||||
($name:ident: $ty:ty) => (
|
||||
static $name: ::std::local_data::Key<$ty> = &::std::local_data::Key;
|
||||
|
|
|
|||
|
|
@ -490,8 +490,7 @@ fn mk_fresh_ident_interner() -> @ident_interner {
|
|||
// if an interner exists in TLS, return it. Otherwise, prepare a
|
||||
// fresh one.
|
||||
pub fn get_ident_interner() -> @ident_interner {
|
||||
static key: local_data::Key<@@::parse::token::ident_interner> =
|
||||
&local_data::Key;
|
||||
local_data_key!(key: @@::parse::token::ident_interner)
|
||||
match local_data::get(key, |k| k.map_move(|k| *k)) {
|
||||
Some(interner) => *interner,
|
||||
None => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue