libsyntax: Renamed types, traits and enum variants to CamelCase.
This commit is contained in:
parent
63ba93f91d
commit
6b221768cf
142 changed files with 4221 additions and 4324 deletions
|
@ -16,7 +16,7 @@ use syntax::ast;
|
|||
use syntax::attr;
|
||||
use syntax::codemap::DUMMY_SP;
|
||||
use syntax::codemap;
|
||||
use syntax::fold::ast_fold;
|
||||
use syntax::fold::Folder;
|
||||
use syntax::fold;
|
||||
use syntax::opt_vec;
|
||||
use syntax::util::small_vector::SmallVector;
|
||||
|
@ -55,41 +55,41 @@ struct StandardLibraryInjector {
|
|||
sess: Session,
|
||||
}
|
||||
|
||||
impl fold::ast_fold for StandardLibraryInjector {
|
||||
impl fold::Folder for StandardLibraryInjector {
|
||||
fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
|
||||
let mut vis = ~[ast::view_item {
|
||||
node: ast::view_item_extern_mod(self.sess.ident_of("std"),
|
||||
Some((format!("std\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
let mut vis = ~[ast::ViewItem {
|
||||
node: ast::ViewItemExternMod(self.sess.ident_of("std"),
|
||||
Some((format!("std\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
attrs: ~[],
|
||||
vis: ast::private,
|
||||
vis: ast::Private,
|
||||
span: DUMMY_SP
|
||||
}];
|
||||
|
||||
if use_uv(&crate) && !self.sess.building_library.get() {
|
||||
vis.push(ast::view_item {
|
||||
node: ast::view_item_extern_mod(self.sess.ident_of("green"),
|
||||
Some((format!("green\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
vis.push(ast::ViewItem {
|
||||
node: ast::ViewItemExternMod(self.sess.ident_of("green"),
|
||||
Some((format!("green\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
attrs: ~[],
|
||||
vis: ast::private,
|
||||
vis: ast::Private,
|
||||
span: DUMMY_SP
|
||||
});
|
||||
vis.push(ast::view_item {
|
||||
node: ast::view_item_extern_mod(self.sess.ident_of("rustuv"),
|
||||
Some((format!("rustuv\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
vis.push(ast::ViewItem {
|
||||
node: ast::ViewItemExternMod(self.sess.ident_of("rustuv"),
|
||||
Some((format!("rustuv\\#{}", VERSION).to_managed(),
|
||||
ast::CookedStr)),
|
||||
ast::DUMMY_NODE_ID),
|
||||
attrs: ~[],
|
||||
vis: ast::private,
|
||||
vis: ast::Private,
|
||||
span: DUMMY_SP
|
||||
});
|
||||
}
|
||||
|
||||
vis.push_all(crate.module.view_items);
|
||||
let mut new_module = ast::_mod {
|
||||
let mut new_module = ast::Mod {
|
||||
view_items: vis,
|
||||
..crate.module.clone()
|
||||
};
|
||||
|
@ -106,7 +106,7 @@ impl fold::ast_fold for StandardLibraryInjector {
|
|||
}
|
||||
}
|
||||
|
||||
fn fold_item(&mut self, item: @ast::item) -> SmallVector<@ast::item> {
|
||||
fn fold_item(&mut self, item: @ast::Item) -> SmallVector<@ast::Item> {
|
||||
if !no_prelude(item.attrs) {
|
||||
// only recur if there wasn't `#[no_implicit_prelude];`
|
||||
// on this item, i.e. this means that the prelude is not
|
||||
|
@ -117,7 +117,7 @@ impl fold::ast_fold for StandardLibraryInjector {
|
|||
}
|
||||
}
|
||||
|
||||
fn fold_mod(&mut self, module: &ast::_mod) -> ast::_mod {
|
||||
fn fold_mod(&mut self, module: &ast::Mod) -> ast::Mod {
|
||||
let prelude_path = ast::Path {
|
||||
span: DUMMY_SP,
|
||||
global: false,
|
||||
|
@ -135,19 +135,18 @@ impl fold::ast_fold for StandardLibraryInjector {
|
|||
],
|
||||
};
|
||||
|
||||
let vp = @spanned(ast::view_path_glob(prelude_path,
|
||||
ast::DUMMY_NODE_ID));
|
||||
let vi2 = ast::view_item {
|
||||
node: ast::view_item_use(~[vp]),
|
||||
let vp = @spanned(ast::ViewPathGlob(prelude_path, ast::DUMMY_NODE_ID));
|
||||
let vi2 = ast::ViewItem {
|
||||
node: ast::ViewItemUse(~[vp]),
|
||||
attrs: ~[],
|
||||
vis: ast::private,
|
||||
vis: ast::Private,
|
||||
span: DUMMY_SP,
|
||||
};
|
||||
|
||||
let vis = vec::append(~[vi2], module.view_items);
|
||||
|
||||
// FIXME #2543: Bad copy.
|
||||
let new_module = ast::_mod {
|
||||
let new_module = ast::Mod {
|
||||
view_items: vis,
|
||||
..(*module).clone()
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue