Rename pkgid variables

This commit is contained in:
Luis de Bethencourt 2013-12-27 19:14:01 -05:00
parent aa5d779a35
commit 4bc09713df
9 changed files with 24 additions and 24 deletions

View file

@ -475,7 +475,7 @@ pub fn build_link_meta(sess: Session,
truncated_hash_result(symbol_hasher).to_managed()
}
let pkgid = match attr::find_pkgid(attrs) {
let crateid = match attr::find_crateid(attrs) {
None => {
let stem = session::expect(
sess,

View file

@ -1030,12 +1030,12 @@ pub fn build_output_filenames(input: &input,
str_input(_) => @"rust_out"
};
// If a pkgid is present, we use it as the link name
let pkgid = attr::find_pkgid(attrs);
match pkgid {
// If a crateid is present, we use it as the link name
let crateid = attr::find_crateid(attrs);
match crateid {
None => {}
Some(pkgid) => {
stem = pkgid.name.to_managed()
Some(crateid) => {
stem = crateid.name.to_managed()
}
}

View file

@ -385,7 +385,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {
}
fn is_extra(crate: &ast::Crate) -> bool {
match attr::find_pkgid(crate.attrs) {
match attr::find_crateid(crate.attrs) {
Some(ref s) if "extra" == s.name => true,
_ => false
}

View file

@ -292,18 +292,18 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
let t_outputs = d::build_output_filenames(&input, &odir, &ofile,
attrs, sess);
if crate_id || crate_name {
let pkgid = match attr::find_pkgid(attrs) {
Some(pkgid) => pkgid,
let crateid = match attr::find_crateid(attrs) {
Some(crateid) => crateid,
None => {
sess.fatal("No crate_id and --crate-id or \
--crate-name requested")
}
};
if crate_id {
println(pkgid.to_str());
println(crateid.to_str());
}
if crate_name {
println(pkgid.name);
println(crateid.name);
}
}

View file

@ -138,15 +138,15 @@ fn visit_view_item(e: &mut Env, i: &ast::view_item) {
ident, path_opt);
let (name, version) = match path_opt {
Some((path_str, _)) => {
let pkgid: Option<PkgId> = from_str(path_str);
match pkgid {
let crateid: Option<PkgId> = from_str(path_str);
match crateid {
None => (@"", @""),
Some(pkgid) => {
let version = match pkgid.version {
Some(crateid) => {
let version = match crateid.version {
None => @"",
Some(ref ver) => ver.to_managed(),
};
(pkgid.name.to_managed(), version)
(crateid.name.to_managed(), version)
}
}
}
@ -282,7 +282,7 @@ fn resolve_crate(e: &mut Env,
} = load_ctxt.load_library_crate();
let attrs = decoder::get_crate_attributes(metadata.as_slice());
let pkgid = attr::find_pkgid(attrs).unwrap();
let crateid = attr::find_crateid(attrs).unwrap();
let hash = decoder::get_crate_hash(metadata.as_slice());
// Claim this crate number and cache it

View file

@ -1173,7 +1173,7 @@ pub fn get_crate_hash(data: &[u8]) -> @str {
pub fn get_crate_vers(data: &[u8]) -> @str {
let attrs = decoder::get_crate_attributes(data);
match attr::find_pkgid(attrs) {
match attr::find_crateid(attrs) {
None => @"0.0",
Some(pkgid) => pkgid.version_or_default().to_managed(),
}

View file

@ -165,7 +165,7 @@ impl Context {
}
let data = lib.metadata.as_slice();
let attrs = decoder::get_crate_attributes(data);
match attr::find_pkgid(attrs) {
match attr::find_crateid(attrs) {
None => {}
Some(pkgid) => {
note_pkgid_attr(self.sess.diagnostic(), &pkgid);
@ -241,7 +241,7 @@ fn crate_matches(crate_data: &[u8],
version: @str,
hash: @str) -> bool {
let attrs = decoder::get_crate_attributes(crate_data);
match attr::find_pkgid(attrs) {
match attr::find_crateid(attrs) {
None => false,
Some(pkgid) => {
if !hash.is_empty() {

View file

@ -73,7 +73,7 @@ pub struct Crate {
impl Clean<Crate> for visit_ast::RustdocVisitor {
fn clean(&self) -> Crate {
use syntax::attr::find_pkgid;
use syntax::attr::find_crateid;
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
let mut externs = HashMap::new();
@ -82,7 +82,7 @@ impl Clean<Crate> for visit_ast::RustdocVisitor {
});
Crate {
name: match find_pkgid(self.attrs) {
name: match find_crateid(self.attrs) {
Some(n) => n.name,
None => fail!("rustdoc requires a `crate_id` crate attribute"),
},

View file

@ -234,10 +234,10 @@ pub fn find_linkage_metas(attrs: &[Attribute]) -> ~[@MetaItem] {
result
}
pub fn find_pkgid(attrs: &[Attribute]) -> Option<PkgId> {
pub fn find_crateid(attrs: &[Attribute]) -> Option<CrateId> {
match first_attr_value_str_by_name(attrs, "crate_id") {
None => None,
Some(id) => from_str::<PkgId>(id),
Some(id) => from_str::<CrateId>(id),
}
}