rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and clean::ExternMod to clean::ExternCrate
This commit is contained in:
parent
28e7631d8b
commit
2271860af1
16 changed files with 29 additions and 29 deletions
|
@ -134,7 +134,7 @@ impl Visitor<()> for Context {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ViewItemExternMod(..) => {
|
ast::ViewItemExternCrate(..) => {
|
||||||
for attr in i.attrs.iter() {
|
for attr in i.attrs.iter() {
|
||||||
if attr.name().get() == "phase"{
|
if attr.name().get() == "phase"{
|
||||||
self.gate_feature("phase", attr.span,
|
self.gate_feature("phase", attr.span,
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub fn with_version(krate: &str) -> Option<(InternedString, ast::StrStyle)> {
|
||||||
impl fold::Folder for StandardLibraryInjector {
|
impl fold::Folder for StandardLibraryInjector {
|
||||||
fn fold_crate(&mut self, krate: ast::Crate) -> ast::Crate {
|
fn fold_crate(&mut self, krate: ast::Crate) -> ast::Crate {
|
||||||
let mut vis = vec!(ast::ViewItem {
|
let mut vis = vec!(ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(token::str_to_ident("std"),
|
node: ast::ViewItemExternCrate(token::str_to_ident("std"),
|
||||||
with_version("std"),
|
with_version("std"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: vec!(
|
attrs: vec!(
|
||||||
|
@ -90,7 +90,7 @@ impl fold::Folder for StandardLibraryInjector {
|
||||||
|
|
||||||
if use_uv(&krate) && !self.sess.building_library.get() {
|
if use_uv(&krate) && !self.sess.building_library.get() {
|
||||||
vis.push(ast::ViewItem {
|
vis.push(ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(token::str_to_ident("green"),
|
node: ast::ViewItemExternCrate(token::str_to_ident("green"),
|
||||||
with_version("green"),
|
with_version("green"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
|
@ -98,7 +98,7 @@ impl fold::Folder for StandardLibraryInjector {
|
||||||
span: DUMMY_SP
|
span: DUMMY_SP
|
||||||
});
|
});
|
||||||
vis.push(ast::ViewItem {
|
vis.push(ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(token::str_to_ident("rustuv"),
|
node: ast::ViewItemExternCrate(token::str_to_ident("rustuv"),
|
||||||
with_version("rustuv"),
|
with_version("rustuv"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
|
|
|
@ -306,7 +306,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
|
||||||
path_node(~[id_test]),
|
path_node(~[id_test]),
|
||||||
ast::DUMMY_NODE_ID))))
|
ast::DUMMY_NODE_ID))))
|
||||||
} else {
|
} else {
|
||||||
ast::ViewItemExternMod(id_test,
|
ast::ViewItemExternCrate(id_test,
|
||||||
with_version("test"),
|
with_version("test"),
|
||||||
ast::DUMMY_NODE_ID)
|
ast::DUMMY_NODE_ID)
|
||||||
};
|
};
|
||||||
|
|
|
@ -167,7 +167,7 @@ struct CrateInfo {
|
||||||
|
|
||||||
fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
|
fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
|
||||||
match i.node {
|
match i.node {
|
||||||
ast::ViewItemExternMod(ident, ref path_opt, id) => {
|
ast::ViewItemExternCrate(ident, ref path_opt, id) => {
|
||||||
let ident = token::get_ident(ident);
|
let ident = token::get_ident(ident);
|
||||||
debug!("resolving extern crate stmt. ident: {:?} path_opt: {:?}",
|
debug!("resolving extern crate stmt. ident: {:?} path_opt: {:?}",
|
||||||
ident, path_opt);
|
ident, path_opt);
|
||||||
|
|
|
@ -845,7 +845,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
|
||||||
|
|
||||||
fn visit_view_item(&mut self, a: &ast::ViewItem, _: ()) {
|
fn visit_view_item(&mut self, a: &ast::ViewItem, _: ()) {
|
||||||
match a.node {
|
match a.node {
|
||||||
ast::ViewItemExternMod(..) => {}
|
ast::ViewItemExternCrate(..) => {}
|
||||||
ast::ViewItemUse(ref uses) => {
|
ast::ViewItemUse(ref uses) => {
|
||||||
for vpath in uses.iter() {
|
for vpath in uses.iter() {
|
||||||
match vpath.node {
|
match vpath.node {
|
||||||
|
@ -976,7 +976,7 @@ impl Visitor<()> for SanePrivacyVisitor {
|
||||||
reachable");
|
reachable");
|
||||||
} else {
|
} else {
|
||||||
match i.node {
|
match i.node {
|
||||||
ast::ViewItemExternMod(..) => {
|
ast::ViewItemExternCrate(..) => {
|
||||||
self.tcx.sess.span_err(i.span, "`pub` visibility \
|
self.tcx.sess.span_err(i.span, "`pub` visibility \
|
||||||
is not allowed");
|
is not allowed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1516,7 +1516,7 @@ impl Resolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewItemExternMod(name, _, node_id) => {
|
ViewItemExternCrate(name, _, node_id) => {
|
||||||
// n.b. we don't need to look at the path option here, because cstore already did
|
// n.b. we don't need to look at the path option here, because cstore already did
|
||||||
match self.session.cstore.find_extern_mod_stmt_cnum(node_id) {
|
match self.session.cstore.find_extern_mod_stmt_cnum(node_id) {
|
||||||
Some(crate_id) => {
|
Some(crate_id) => {
|
||||||
|
@ -5415,7 +5415,7 @@ impl Resolver {
|
||||||
if vi.span == DUMMY_SP { return }
|
if vi.span == DUMMY_SP { return }
|
||||||
|
|
||||||
match vi.node {
|
match vi.node {
|
||||||
ViewItemExternMod(..) => {} // ignore
|
ViewItemExternCrate(..) => {} // ignore
|
||||||
ViewItemUse(ref path) => {
|
ViewItemUse(ref path) => {
|
||||||
for p in path.iter() {
|
for p in path.iter() {
|
||||||
match p.node {
|
match p.node {
|
||||||
|
|
|
@ -1066,19 +1066,19 @@ impl Clean<Item> for ast::ViewItem {
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable)]
|
#[deriving(Clone, Encodable, Decodable)]
|
||||||
pub enum ViewItemInner {
|
pub enum ViewItemInner {
|
||||||
ExternMod(~str, Option<~str>, ast::NodeId),
|
ExternCrate(~str, Option<~str>, ast::NodeId),
|
||||||
Import(~[ViewPath])
|
Import(~[ViewPath])
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<ViewItemInner> for ast::ViewItem_ {
|
impl Clean<ViewItemInner> for ast::ViewItem_ {
|
||||||
fn clean(&self) -> ViewItemInner {
|
fn clean(&self) -> ViewItemInner {
|
||||||
match self {
|
match self {
|
||||||
&ast::ViewItemExternMod(ref i, ref p, ref id) => {
|
&ast::ViewItemExternCrate(ref i, ref p, ref id) => {
|
||||||
let string = match *p {
|
let string = match *p {
|
||||||
None => None,
|
None => None,
|
||||||
Some((ref x, _)) => Some(x.get().to_owned()),
|
Some((ref x, _)) => Some(x.get().to_owned()),
|
||||||
};
|
};
|
||||||
ExternMod(i.clean(), string, *id)
|
ExternCrate(i.clean(), string, *id)
|
||||||
}
|
}
|
||||||
&ast::ViewItemUse(ref vp) => {
|
&ast::ViewItemUse(ref vp) => {
|
||||||
Import(vp.clean().move_iter().collect())
|
Import(vp.clean().move_iter().collect())
|
||||||
|
|
|
@ -960,8 +960,8 @@ fn item_module(w: &mut Writer, cx: &Context,
|
||||||
match (&i1.inner, &i2.inner) {
|
match (&i1.inner, &i2.inner) {
|
||||||
(&clean::ViewItemItem(ref a), &clean::ViewItemItem(ref b)) => {
|
(&clean::ViewItemItem(ref a), &clean::ViewItemItem(ref b)) => {
|
||||||
match (&a.inner, &b.inner) {
|
match (&a.inner, &b.inner) {
|
||||||
(&clean::ExternMod(..), _) => Less,
|
(&clean::ExternCrate(..), _) => Less,
|
||||||
(_, &clean::ExternMod(..)) => Greater,
|
(_, &clean::ExternCrate(..)) => Greater,
|
||||||
_ => idx1.cmp(&idx2),
|
_ => idx1.cmp(&idx2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1056,7 @@ fn item_module(w: &mut Writer, cx: &Context,
|
||||||
|
|
||||||
clean::ViewItemItem(ref item) => {
|
clean::ViewItemItem(ref item) => {
|
||||||
match item.inner {
|
match item.inner {
|
||||||
clean::ExternMod(ref name, ref src, _) => {
|
clean::ExternCrate(ref name, ref src, _) => {
|
||||||
try!(write!(w, "<tr><td><code>extern crate {}",
|
try!(write!(w, "<tr><td><code>extern crate {}",
|
||||||
name.as_slice()));
|
name.as_slice()));
|
||||||
match *src {
|
match *src {
|
||||||
|
|
|
@ -147,7 +147,7 @@ impl<'a> RustdocVisitor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ViewItemExternMod(..) => item.clone()
|
ast::ViewItemExternCrate(..) => item.clone()
|
||||||
};
|
};
|
||||||
om.view_items.push(item);
|
om.view_items.push(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ pub enum ViewItem_ {
|
||||||
// optional (InternedString,StrStyle): if present, this is a location
|
// optional (InternedString,StrStyle): if present, this is a location
|
||||||
// (containing arbitrary characters) from which to fetch the crate sources
|
// (containing arbitrary characters) from which to fetch the crate sources
|
||||||
// For example, extern crate whatever = "github.com/mozilla/rust"
|
// For example, extern crate whatever = "github.com/mozilla/rust"
|
||||||
ViewItemExternMod(Ident, Option<(InternedString,StrStyle)>, NodeId),
|
ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
|
||||||
ViewItemUse(Vec<@ViewPath> ),
|
ViewItemUse(Vec<@ViewPath> ),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
|
||||||
|
|
||||||
fn visit_view_item(&mut self, view_item: &ViewItem, env: ()) {
|
fn visit_view_item(&mut self, view_item: &ViewItem, env: ()) {
|
||||||
match view_item.node {
|
match view_item.node {
|
||||||
ViewItemExternMod(_, _, node_id) => {
|
ViewItemExternCrate(_, _, node_id) => {
|
||||||
self.operation.visit_id(node_id)
|
self.operation.visit_id(node_id)
|
||||||
}
|
}
|
||||||
ViewItemUse(ref view_paths) => {
|
ViewItemUse(ref view_paths) => {
|
||||||
|
|
|
@ -424,7 +424,7 @@ pub fn expand_view_item(vi: &ast::ViewItem,
|
||||||
fld: &mut MacroExpander)
|
fld: &mut MacroExpander)
|
||||||
-> ast::ViewItem {
|
-> ast::ViewItem {
|
||||||
match vi.node {
|
match vi.node {
|
||||||
ast::ViewItemExternMod(..) => {
|
ast::ViewItemExternCrate(..) => {
|
||||||
let should_load = vi.attrs.iter().any(|attr| {
|
let should_load = vi.attrs.iter().any(|attr| {
|
||||||
attr.name().get() == "phase" &&
|
attr.name().get() == "phase" &&
|
||||||
attr.meta_item_list().map_or(false, |phases| {
|
attr.meta_item_list().map_or(false, |phases| {
|
||||||
|
@ -446,7 +446,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) {
|
||||||
let MacroCrate { lib, cnum } = fld.cx.ecfg.loader.load_crate(krate);
|
let MacroCrate { lib, cnum } = fld.cx.ecfg.loader.load_crate(krate);
|
||||||
|
|
||||||
let crate_name = match krate.node {
|
let crate_name = match krate.node {
|
||||||
ast::ViewItemExternMod(name, _, _) => name,
|
ast::ViewItemExternCrate(name, _, _) => name,
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
let name = format!("<{} macros>", token::get_ident(crate_name));
|
let name = format!("<{} macros>", token::get_ident(crate_name));
|
||||||
|
|
|
@ -514,8 +514,8 @@ fn fold_variant_arg_<T: Folder>(va: &VariantArg, folder: &mut T) -> VariantArg {
|
||||||
pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
|
pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
|
||||||
-> ViewItem{
|
-> ViewItem{
|
||||||
let inner_view_item = match vi.node {
|
let inner_view_item = match vi.node {
|
||||||
ViewItemExternMod(ref ident, ref string, node_id) => {
|
ViewItemExternCrate(ref ident, ref string, node_id) => {
|
||||||
ViewItemExternMod(ident.clone(),
|
ViewItemExternCrate(ident.clone(),
|
||||||
(*string).clone(),
|
(*string).clone(),
|
||||||
folder.new_id(node_id))
|
folder.new_id(node_id))
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ use ast::{TyInfer, TypeMethod};
|
||||||
use ast::{TyNil, TyParam, TyParamBound, TyPath, TyPtr, TyRptr};
|
use ast::{TyNil, TyParam, TyParamBound, TyPath, TyPtr, TyRptr};
|
||||||
use ast::{TyTup, TyU32, TyUniq, TyVec, UnUniq};
|
use ast::{TyTup, TyU32, TyUniq, TyVec, UnUniq};
|
||||||
use ast::{UnnamedField, UnsafeBlock, UnsafeFn, ViewItem};
|
use ast::{UnnamedField, UnsafeBlock, UnsafeFn, ViewItem};
|
||||||
use ast::{ViewItem_, ViewItemExternMod, ViewItemUse};
|
use ast::{ViewItem_, ViewItemExternCrate, ViewItemUse};
|
||||||
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
||||||
use ast::Visibility;
|
use ast::Visibility;
|
||||||
use ast;
|
use ast;
|
||||||
|
@ -4361,7 +4361,7 @@ impl Parser {
|
||||||
};
|
};
|
||||||
|
|
||||||
IoviViewItem(ast::ViewItem {
|
IoviViewItem(ast::ViewItem {
|
||||||
node: ViewItemExternMod(ident, maybe_path, ast::DUMMY_NODE_ID),
|
node: ViewItemExternCrate(ident, maybe_path, ast::DUMMY_NODE_ID),
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
vis: visibility,
|
vis: visibility,
|
||||||
span: mk_sp(lo, self.last_span.hi)
|
span: mk_sp(lo, self.last_span.hi)
|
||||||
|
@ -5017,11 +5017,11 @@ impl Parser {
|
||||||
// `extern crate` must precede `use`.
|
// `extern crate` must precede `use`.
|
||||||
extern_mod_allowed = false;
|
extern_mod_allowed = false;
|
||||||
}
|
}
|
||||||
ViewItemExternMod(..) if !extern_mod_allowed => {
|
ViewItemExternCrate(..) if !extern_mod_allowed => {
|
||||||
self.span_err(view_item.span,
|
self.span_err(view_item.span,
|
||||||
"\"extern crate\" declarations are not allowed here");
|
"\"extern crate\" declarations are not allowed here");
|
||||||
}
|
}
|
||||||
ViewItemExternMod(..) => {}
|
ViewItemExternCrate(..) => {}
|
||||||
}
|
}
|
||||||
view_items.push(view_item);
|
view_items.push(view_item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2065,7 +2065,7 @@ pub fn print_view_item(s: &mut State, item: &ast::ViewItem) -> io::IoResult<()>
|
||||||
try!(print_outer_attributes(s, item.attrs.as_slice()));
|
try!(print_outer_attributes(s, item.attrs.as_slice()));
|
||||||
try!(print_visibility(s, item.vis));
|
try!(print_visibility(s, item.vis));
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::ViewItemExternMod(id, ref optional_path, _) => {
|
ast::ViewItemExternCrate(id, ref optional_path, _) => {
|
||||||
try!(head(s, "extern crate"));
|
try!(head(s, "extern crate"));
|
||||||
try!(print_ident(s, id));
|
try!(print_ident(s, id));
|
||||||
for &(ref p, style) in optional_path.iter() {
|
for &(ref p, style) in optional_path.iter() {
|
||||||
|
|
|
@ -148,7 +148,7 @@ pub fn walk_mod<E: Clone, V: Visitor<E>>(visitor: &mut V, module: &Mod, env: E)
|
||||||
|
|
||||||
pub fn walk_view_item<E: Clone, V: Visitor<E>>(visitor: &mut V, vi: &ViewItem, env: E) {
|
pub fn walk_view_item<E: Clone, V: Visitor<E>>(visitor: &mut V, vi: &ViewItem, env: E) {
|
||||||
match vi.node {
|
match vi.node {
|
||||||
ViewItemExternMod(name, _, _) => {
|
ViewItemExternCrate(name, _, _) => {
|
||||||
visitor.visit_ident(vi.span, name, env)
|
visitor.visit_ident(vi.span, name, env)
|
||||||
}
|
}
|
||||||
ViewItemUse(ref paths) => {
|
ViewItemUse(ref paths) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue