Skip to content

Renamed syntax::ast::ident -> Ident #8920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ impl Session_ {
}

// pointless function, now...
pub fn str_of(@self, id: ast::ident) -> @str {
pub fn str_of(@self, id: ast::Ident) -> @str {
token::ident_to_str(&id)
}

// pointless function, now...
pub fn ident_of(@self, st: &str) -> ast::ident {
pub fn ident_of(@self, st: &str) -> ast::Ident {
token::str_to_ident(st)
}

Expand Down
8 changes: 4 additions & 4 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type node_id_gen = @fn() -> ast::NodeId;

struct Test {
span: Span,
path: ~[ast::ident],
path: ~[ast::Ident],
bench: bool,
ignore: bool,
should_fail: bool
Expand All @@ -39,7 +39,7 @@ struct Test {
struct TestCtxt {
sess: session::Session,
crate: @ast::Crate,
path: ~[ast::ident],
path: ~[ast::Ident],
ext_cx: @ExtCtxt,
testfns: ~[Test]
}
Expand Down Expand Up @@ -383,7 +383,7 @@ fn nospan<T>(t: T) -> codemap::Spanned<T> {
codemap::Spanned { node: t, span: dummy_sp() }
}

fn path_node(ids: ~[ast::ident]) -> ast::Path {
fn path_node(ids: ~[ast::Ident]) -> ast::Path {
ast::Path {
span: dummy_sp(),
global: false,
Expand All @@ -395,7 +395,7 @@ fn path_node(ids: ~[ast::ident]) -> ast::Path {
}
}

fn path_node_global(ids: ~[ast::ident]) -> ast::Path {
fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
ast::Path {
span: dummy_sp(),
global: true,
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/metadata/csearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use syntax::ast_map;
use syntax::diagnostic::expect;

pub struct StaticMethodInfo {
ident: ast::ident,
ident: ast::Ident,
def_id: ast::def_id,
purity: ast::purity
}
Expand All @@ -52,7 +52,7 @@ pub fn each_lang_item(cstore: @mut cstore::CStore,
/// Iterates over each child of the given item.
pub fn each_child_of_item(cstore: @mut cstore::CStore,
def_id: ast::def_id,
callback: &fn(decoder::DefLike, ast::ident)) {
callback: &fn(decoder::DefLike, ast::Ident)) {
let crate_data = cstore::get_crate_data(cstore, def_id.crate);
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
cstore::get_crate_data(cstore, cnum)
Expand All @@ -68,7 +68,7 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore,
pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore,
cnum: ast::CrateNum,
callback: &fn(decoder::DefLike,
ast::ident)) {
ast::Ident)) {
let crate_data = cstore::get_crate_data(cstore, cnum);
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
cstore::get_crate_data(cstore, cnum)
Expand Down Expand Up @@ -129,7 +129,7 @@ pub fn get_method(tcx: ty::ctxt, def: ast::def_id) -> ty::Method {

pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
def: ast::def_id)
-> (ast::ident, ast::explicit_self_)
-> (ast::Ident, ast::explicit_self_)
{
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node)
Expand All @@ -156,7 +156,7 @@ pub fn get_supertraits(tcx: ty::ctxt, def: ast::def_id) -> ~[@ty::TraitRef] {
}

pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::def_id)
-> Option<ast::ident> {
-> Option<ast::Ident> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_type_name_if_impl(cdata, def.node)
}
Expand Down Expand Up @@ -245,7 +245,7 @@ pub fn get_impl_vtables(tcx: ty::ctxt,

pub fn get_impl_method(cstore: @mut cstore::CStore,
def: ast::def_id,
mname: ast::ident)
mname: ast::Ident)
-> Option<ast::def_id> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impl_method(cstore.intr, cdata, def.node, mname)
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ fn item_path(item_doc: ebml::Doc) -> ast_map::path {
return result;
}

fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident {
fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::Ident {
let name = reader::get_doc(item, tag_paths_data_name);
let string = name.as_str_slice();
match intr.find_equiv(&string) {
None => token::str_to_ident(string),
Some(val) => ast::new_ident(val),
Some(val) => ast::Ident::new(val),
}
}

Expand Down Expand Up @@ -452,7 +452,7 @@ pub fn get_impl_vtables(cdata: Cmd,


pub fn get_impl_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId,
name: ast::ident) -> Option<ast::def_id> {
name: ast::Ident) -> Option<ast::def_id> {
let items = reader::get_doc(reader::Doc(cdata.data), tag_items);
let mut found = None;
do reader::tagged_docs(find_item(id, items), tag_item_impl_method) |mid| {
Expand Down Expand Up @@ -706,7 +706,7 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
cdata: Cmd,
item_doc: ebml::Doc,
get_crate_data: GetCrateDataCb,
callback: &fn(DefLike, ast::ident)) {
callback: &fn(DefLike, ast::Ident)) {
// Iterate over all children.
let _ = do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| {
let child_def_id = reader::with_doc_data(child_info_doc,
Expand Down Expand Up @@ -829,7 +829,7 @@ pub fn each_child_of_item(intr: @ident_interner,
cdata: Cmd,
id: ast::NodeId,
get_crate_data: GetCrateDataCb,
callback: &fn(DefLike, ast::ident)) {
callback: &fn(DefLike, ast::Ident)) {
// Find the item.
let root_doc = reader::Doc(cdata.data);
let items = reader::get_doc(root_doc, tag_items);
Expand All @@ -849,7 +849,7 @@ pub fn each_child_of_item(intr: @ident_interner,
pub fn each_top_level_item_of_crate(intr: @ident_interner,
cdata: Cmd,
get_crate_data: GetCrateDataCb,
callback: &fn(DefLike, ast::ident)) {
callback: &fn(DefLike, ast::Ident)) {
let root_doc = reader::Doc(cdata.data);
let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);
let crate_items_doc = reader::get_doc(misc_info_doc,
Expand Down Expand Up @@ -995,7 +995,7 @@ pub fn get_impl(intr: @ident_interner, cdata: Cmd, impl_id: ast::NodeId,
pub fn get_method_name_and_explicit_self(
intr: @ident_interner,
cdata: Cmd,
id: ast::NodeId) -> (ast::ident, ast::explicit_self_)
id: ast::NodeId) -> (ast::Ident, ast::explicit_self_)
{
let method_doc = lookup_item(id, cdata.data);
let name = item_name(intr, method_doc);
Expand Down Expand Up @@ -1093,7 +1093,7 @@ pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
}

pub fn get_type_name_if_impl(cdata: Cmd,
node_id: ast::NodeId) -> Option<ast::ident> {
node_id: ast::NodeId) -> Option<ast::Ident> {
let item = lookup_item(node_id, cdata.data);
if item_family(item) != Impl {
return None;
Expand Down Expand Up @@ -1352,7 +1352,7 @@ pub fn get_crate_attributes(data: @~[u8]) -> ~[ast::Attribute] {
#[deriving(Clone)]
pub struct CrateDep {
cnum: ast::CrateNum,
name: ast::ident,
name: ast::Ident,
vers: @str,
hash: @str
}
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ pub fn reachable(ecx: &EncodeContext, id: NodeId) -> bool {

fn encode_name(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
name: ident) {
name: Ident) {
ebml_w.wr_tagged_str(tag_paths_data_name, ecx.tcx.sess.str_of(name));
}

fn encode_impl_type_basename(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
name: ident) {
name: Ident) {
ebml_w.wr_tagged_str(tag_item_impl_type_basename,
ecx.tcx.sess.str_of(name));
}
Expand All @@ -135,9 +135,9 @@ struct entry<T> {
}

fn add_to_index(ebml_w: &mut writer::Encoder,
path: &[ident],
path: &[Ident],
index: &mut ~[entry<~str>],
name: ident) {
name: Ident) {
let mut full_path = ~[];
full_path.push_all(path);
full_path.push(name);
Expand Down Expand Up @@ -379,7 +379,7 @@ fn encode_reexported_static_method(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
exp: &middle::resolve::Export2,
method_def_id: def_id,
method_ident: ident) {
method_ident: Ident) {
debug!("(encode reexported static method) %s::%s",
exp.name, ecx.tcx.sess.str_of(method_ident));
ebml_w.start_tag(tag_items_data_item_reexport);
Expand Down Expand Up @@ -541,7 +541,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
md: &_mod,
id: NodeId,
path: &[ast_map::path_elt],
name: ident,
name: Ident,
vis: visibility) {
ebml_w.start_tag(tag_items_data_item);
encode_def_id(ebml_w, local_def(id));
Expand Down Expand Up @@ -700,7 +700,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
fn encode_info_for_struct_ctor(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
path: &[ast_map::path_elt],
name: ast::ident,
name: ast::Ident,
ctor_id: NodeId,
index: @mut ~[entry<i64>]) {
index.push(entry { val: ctor_id as i64, pos: ebml_w.writer.tell() });
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ fn scan<R>(st: &mut PState, is_last: &fn(char) -> bool,
return op(st.data.slice(start_pos, end_pos));
}

pub fn parse_ident(st: &mut PState, last: char) -> ast::ident {
pub fn parse_ident(st: &mut PState, last: char) -> ast::Ident {
fn is_last(b: char, c: char) -> bool { return c == b; }
return parse_ident_(st, |a| is_last(last, a) );
}

fn parse_ident_(st: &mut PState, is_last: @fn(char) -> bool) ->
ast::ident {
ast::Ident {
let rslt = scan(st, is_last, str::from_bytes);
return st.tcx.sess.ident_of(rslt);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn parse_trait_ref_data(data: &[u8], crate_num: int, pos: uint, tcx: ty::ctx
}

fn parse_path(st: &mut PState) -> @ast::Path {
let mut idents: ~[ast::ident] = ~[];
let mut idents: ~[ast::Ident] = ~[];
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
idents.push(parse_ident_(st, is_last));
loop {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ trait fake_ext_ctxt {
fn cfg(&self) -> ast::CrateConfig;
fn parse_sess(&self) -> @mut parse::ParseSess;
fn call_site(&self) -> Span;
fn ident_of(&self, st: &str) -> ast::ident;
fn ident_of(&self, st: &str) -> ast::Ident;
}

#[cfg(test)]
Expand All @@ -1273,7 +1273,7 @@ impl fake_ext_ctxt for fake_session {
expn_info: None
}
}
fn ident_of(&self, st: &str) -> ast::ident {
fn ident_of(&self, st: &str) -> ast::Ident {
token::str_to_ident(st)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ impl CFGBuilder {

fn find_scope(&self,
expr: @ast::expr,
label: Option<ast::ident>) -> LoopScope {
label: Option<ast::Ident>) -> LoopScope {
match label {
None => {
return *self.loop_scopes.last();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {

fn find_scope<'a>(&self,
expr: @ast::expr,
label: Option<ast::ident>,
label: Option<ast::Ident>,
loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
let index = match label {
None => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ fn lint_path_statement() -> @mut OuterLint {
}

fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) {
fn is_camel_case(cx: ty::ctxt, ident: ast::ident) -> bool {
fn is_camel_case(cx: ty::ctxt, ident: ast::Ident) -> bool {
let ident = cx.sess.str_of(ident);
assert!(!ident.is_empty());
let ident = ident.trim_chars(&'_');
Expand All @@ -1044,7 +1044,7 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) {
!ident.contains_char('_')
}

fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: Span) {
fn check_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
if !is_camel_case(cx.tcx, ident) {
cx.span_lint(
non_camel_case_types, span,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ enum LocalKind {

struct LocalInfo {
id: NodeId,
ident: ident,
ident: Ident,
is_mutbl: bool,
kind: LocalKind,
}

enum VarKind {
Arg(NodeId, ident),
Arg(NodeId, Ident),
Local(LocalInfo),
ImplicitRet
}
Expand Down Expand Up @@ -756,7 +756,7 @@ impl Liveness {
}

pub fn find_loop_scope(&self,
opt_label: Option<ident>,
opt_label: Option<Ident>,
id: NodeId,
sp: Span)
-> NodeId {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub enum InteriorKind {

#[deriving(Eq, IterBytes)]
pub enum FieldName {
NamedField(ast::ident),
NamedField(ast::Ident),
PositionalField(uint)
}

Expand Down Expand Up @@ -613,7 +613,7 @@ impl mem_categorization_ctxt {
pub fn cat_field<N:ast_node>(&self,
node: N,
base_cmt: cmt,
f_name: ast::ident,
f_name: ast::Ident,
f_ty: ty::t)
-> cmt {
@cmt_ {
Expand Down Expand Up @@ -1058,7 +1058,7 @@ impl mem_categorization_ctxt {
/// an enum to determine which variant is in use.
pub fn field_mutbl(tcx: ty::ctxt,
base_ty: ty::t,
f_name: ast::ident,
f_name: ast::Ident,
node_id: ast::NodeId)
-> Option<ast::mutability> {
// Need to refactor so that struct/enum fields can be treated uniformly.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/pat_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use syntax::ast::*;
use syntax::ast_util::{path_to_ident, walk_pat};
use syntax::codemap::Span;

pub type PatIdMap = HashMap<ident, NodeId>;
pub type PatIdMap = HashMap<Ident, NodeId>;

// This is used because same-named variables in alternative patterns need to
// use the NodeId of their namesake in the first pattern.
Expand Down
Loading