Skip to content

Commit

Permalink
Modernized a few more types in syntax::ast
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimundi committed Sep 3, 2013
1 parent 58decdd commit 7419085
Show file tree
Hide file tree
Showing 114 changed files with 3,808 additions and 3,803 deletions.
8 changes: 4 additions & 4 deletions src/librustc/front/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ fn fold_item_underscore(cx: @Context, item: &ast::item_,
fold::noop_fold_item_underscore(&item, fld)
}

fn filter_stmt(cx: @Context, stmt: @ast::stmt) ->
Option<@ast::stmt> {
fn filter_stmt(cx: @Context, stmt: @ast::Stmt) ->
Option<@ast::Stmt> {
match stmt.node {
ast::stmt_decl(decl, _) => {
ast::StmtDecl(decl, _) => {
match decl.node {
ast::decl_item(item) => {
ast::DeclItem(item) => {
if item_in_cfg(cx, item) {
option::Some(stmt)
} else { option::None }
Expand Down
30 changes: 15 additions & 15 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,29 +441,29 @@ fn is_extra(cx: &TestCtxt) -> bool {
}
}

fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
debug!("building test vector from %u tests", cx.testfns.len());
let mut descs = ~[];
for test in cx.testfns.iter() {
descs.push(mk_test_desc_and_fn_rec(cx, test));
}

let sess = cx.sess;
let inner_expr = @ast::expr {
let inner_expr = @ast::Expr {
id: sess.next_node_id(),
node: ast::expr_vec(descs, ast::m_imm),
node: ast::ExprVec(descs, ast::MutImmutable),
span: dummy_sp(),
};

@ast::expr {
@ast::Expr {
id: sess.next_node_id(),
node: ast::expr_vstore(inner_expr, ast::expr_vstore_slice),
node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
span: dummy_sp(),
}
}

#[cfg(stage0)]
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
let span = test.span;
let path = test.path.clone();

Expand All @@ -474,17 +474,17 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path).to_managed()));

let name_expr = @ast::expr {
let name_expr = @ast::Expr {
id: cx.sess.next_node_id(),
node: ast::expr_lit(@name_lit),
node: ast::ExprLit(@name_lit),
span: span
};

let fn_path = path_node_global(path);

let fn_expr = @ast::expr {
let fn_expr = @ast::Expr {
id: cx.sess.next_node_id(),
node: ast::expr_path(fn_path),
node: ast::ExprPath(fn_path),
span: span,
};

Expand Down Expand Up @@ -519,7 +519,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
e
}
#[cfg(not(stage0))]
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
let span = test.span;
let path = test.path.clone();

Expand All @@ -528,17 +528,17 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path).to_managed()));

let name_expr = @ast::expr {
let name_expr = @ast::Expr {
id: cx.sess.next_node_id(),
node: ast::expr_lit(@name_lit),
node: ast::ExprLit(@name_lit),
span: span
};

let fn_path = path_node_global(path);

let fn_expr = @ast::expr {
let fn_expr = @ast::Expr {
id: cx.sess.next_node_id(),
node: ast::expr_path(fn_path),
node: ast::ExprPath(fn_path),
span: span,
};

Expand Down
70 changes: 35 additions & 35 deletions src/librustc/metadata/csearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ use syntax::diagnostic::expect;

pub struct StaticMethodInfo {
ident: ast::Ident,
def_id: ast::def_id,
def_id: ast::DefId,
purity: ast::purity
}

pub fn get_symbol(cstore: @mut cstore::CStore, def: ast::def_id) -> ~str {
pub fn get_symbol(cstore: @mut cstore::CStore, def: ast::DefId) -> ~str {
let cdata = cstore::get_crate_data(cstore, def.crate).data;
return decoder::get_symbol(cdata, def.node);
}

pub fn get_type_param_count(cstore: @mut cstore::CStore, def: ast::def_id)
pub fn get_type_param_count(cstore: @mut cstore::CStore, def: ast::DefId)
-> uint {
let cdata = cstore::get_crate_data(cstore, def.crate).data;
return decoder::get_type_param_count(cdata, def.node);
Expand All @@ -51,7 +51,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,
def_id: ast::DefId,
callback: &fn(decoder::DefLike, ast::Ident)) {
let crate_data = cstore::get_crate_data(cstore, def_id.crate);
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
Expand Down Expand Up @@ -79,7 +79,7 @@ pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore,
callback)
}

pub fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {
pub fn get_item_path(tcx: ty::ctxt, def: ast::DefId) -> ast_map::path {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
let path = decoder::get_item_path(cdata, def.node);
Expand All @@ -92,14 +92,14 @@ pub fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {

pub enum found_ast {
found(ast::inlined_item),
found_parent(ast::def_id, ast::inlined_item),
found_parent(ast::DefId, ast::inlined_item),
not_found,
}

// Finds the AST for this item in the crate metadata, if any. If the item was
// not marked for inlining, then the AST will not be present and hence none
// will be returned.
pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::def_id,
pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::DefId,
decode_inlined_item: decoder::decode_inlined_item)
-> found_ast {
let cstore = tcx.cstore;
Expand All @@ -108,102 +108,102 @@ pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::def_id,
decode_inlined_item)
}

pub fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id)
pub fn get_enum_variants(tcx: ty::ctxt, def: ast::DefId)
-> ~[@ty::VariantInfo] {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
return decoder::get_enum_variants(cstore.intr, cdata, def.node, tcx)
}

/// Returns information about the given implementation.
pub fn get_impl(tcx: ty::ctxt, impl_def_id: ast::def_id)
pub fn get_impl(tcx: ty::ctxt, impl_def_id: ast::DefId)
-> ty::Impl {
let cdata = cstore::get_crate_data(tcx.cstore, impl_def_id.crate);
decoder::get_impl(tcx.cstore.intr, cdata, impl_def_id.node, tcx)
}

pub fn get_method(tcx: ty::ctxt, def: ast::def_id) -> ty::Method {
pub fn get_method(tcx: ty::ctxt, def: ast::DefId) -> ty::Method {
let cdata = cstore::get_crate_data(tcx.cstore, def.crate);
decoder::get_method(tcx.cstore.intr, cdata, def.node, tcx)
}

pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
def: ast::def_id)
def: ast::DefId)
-> (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)
}

pub fn get_trait_method_def_ids(cstore: @mut cstore::CStore,
def: ast::def_id) -> ~[ast::def_id] {
def: ast::DefId) -> ~[ast::DefId] {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_trait_method_def_ids(cdata, def.node)
}

pub fn get_provided_trait_methods(tcx: ty::ctxt,
def: ast::def_id)
def: ast::DefId)
-> ~[@ty::Method] {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_provided_trait_methods(cstore.intr, cdata, def.node, tcx)
}

pub fn get_supertraits(tcx: ty::ctxt, def: ast::def_id) -> ~[@ty::TraitRef] {
pub fn get_supertraits(tcx: ty::ctxt, def: ast::DefId) -> ~[@ty::TraitRef] {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_supertraits(cdata, def.node, tcx)
}

pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::def_id)
pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::DefId)
-> Option<ast::Ident> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_type_name_if_impl(cdata, def.node)
}

pub fn get_static_methods_if_impl(cstore: @mut cstore::CStore,
def: ast::def_id)
def: ast::DefId)
-> Option<~[StaticMethodInfo]> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_static_methods_if_impl(cstore.intr, cdata, def.node)
}

pub fn get_item_attrs(cstore: @mut cstore::CStore,
def_id: ast::def_id,
def_id: ast::DefId,
f: &fn(~[@ast::MetaItem])) {
let cdata = cstore::get_crate_data(cstore, def_id.crate);
decoder::get_item_attrs(cdata, def_id.node, f)
}

pub fn get_struct_fields(cstore: @mut cstore::CStore,
def: ast::def_id)
def: ast::DefId)
-> ~[ty::field_ty] {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_struct_fields(cstore.intr, cdata, def.node)
}

pub fn get_type(tcx: ty::ctxt,
def: ast::def_id)
def: ast::DefId)
-> ty::ty_param_bounds_and_ty {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_type(cdata, def.node, tcx)
}

pub fn get_trait_def(tcx: ty::ctxt, def: ast::def_id) -> ty::TraitDef {
pub fn get_trait_def(tcx: ty::ctxt, def: ast::DefId) -> ty::TraitDef {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_trait_def(cdata, def.node, tcx)
}

pub fn get_region_param(cstore: @mut metadata::cstore::CStore,
def: ast::def_id) -> Option<ty::region_variance> {
def: ast::DefId) -> Option<ty::region_variance> {
let cdata = cstore::get_crate_data(cstore, def.crate);
return decoder::get_region_param(cdata, def.node);
}

pub fn get_field_type(tcx: ty::ctxt, class_id: ast::def_id,
def: ast::def_id) -> ty::ty_param_bounds_and_ty {
pub fn get_field_type(tcx: ty::ctxt, class_id: ast::DefId,
def: ast::DefId) -> ty::ty_param_bounds_and_ty {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, class_id.crate);
let all_items = reader::get_doc(reader::Doc(cdata.data), tag_items);
Expand All @@ -229,30 +229,30 @@ pub fn get_field_type(tcx: ty::ctxt, class_id: ast::def_id,
// Given a def_id for an impl, return the trait it implements,
// if there is one.
pub fn get_impl_trait(tcx: ty::ctxt,
def: ast::def_id) -> Option<@ty::TraitRef> {
def: ast::DefId) -> Option<@ty::TraitRef> {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impl_trait(cdata, def.node, tcx)
}

// Given a def_id for an impl, return information about its vtables
pub fn get_impl_vtables(tcx: ty::ctxt,
def: ast::def_id) -> typeck::impl_res {
def: ast::DefId) -> typeck::impl_res {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impl_vtables(cdata, def.node, tcx)
}

pub fn get_impl_method(cstore: @mut cstore::CStore,
def: ast::def_id,
def: ast::DefId,
mname: ast::Ident)
-> Option<ast::def_id> {
-> Option<ast::DefId> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impl_method(cstore.intr, cdata, def.node, mname)
}

pub fn get_item_visibility(cstore: @mut cstore::CStore,
def_id: ast::def_id)
def_id: ast::DefId)
-> ast::visibility {
let cdata = cstore::get_crate_data(cstore, def_id.crate);
decoder::get_item_visibility(cdata, def_id.node)
Expand All @@ -267,21 +267,21 @@ pub fn get_link_args_for_crate(cstore: @mut cstore::CStore,

pub fn each_impl(cstore: @mut cstore::CStore,
crate_num: ast::CrateNum,
callback: &fn(ast::def_id)) {
callback: &fn(ast::DefId)) {
let cdata = cstore::get_crate_data(cstore, crate_num);
decoder::each_impl(cdata, callback)
}

pub fn each_implementation_for_type(cstore: @mut cstore::CStore,
def_id: ast::def_id,
callback: &fn(ast::def_id)) {
def_id: ast::DefId,
callback: &fn(ast::DefId)) {
let cdata = cstore::get_crate_data(cstore, def_id.crate);
decoder::each_implementation_for_type(cdata, def_id.node, callback)
}

pub fn each_implementation_for_trait(cstore: @mut cstore::CStore,
def_id: ast::def_id,
callback: &fn(ast::def_id)) {
def_id: ast::DefId,
callback: &fn(ast::DefId)) {
let cdata = cstore::get_crate_data(cstore, def_id.crate);
decoder::each_implementation_for_trait(cdata, def_id.node, callback)
}
Expand All @@ -290,9 +290,9 @@ pub fn each_implementation_for_trait(cstore: @mut cstore::CStore,
/// default method or an implementation of a trait method), returns the ID of
/// the trait that the method belongs to. Otherwise, returns `None`.
pub fn get_trait_of_method(cstore: @mut cstore::CStore,
def_id: ast::def_id,
def_id: ast::DefId,
tcx: ty::ctxt)
-> Option<ast::def_id> {
-> Option<ast::DefId> {
let cdata = cstore::get_crate_data(cstore, def_id.crate);
decoder::get_trait_of_method(cdata, def_id.node, tcx)
}
Expand Down
Loading

5 comments on commit 7419085

@bors
Copy link
Contributor

@bors bors commented on 7419085 Sep 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at Kimundi@7419085

@bors
Copy link
Contributor

@bors bors commented on 7419085 Sep 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Kimundi/rust/master = 7419085 into auto

@bors
Copy link
Contributor

@bors bors commented on 7419085 Sep 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kimundi/rust/master = 7419085 merged ok, testing candidate = d252d81

@bors
Copy link
Contributor

@bors bors commented on 7419085 Sep 3, 2013

@bors
Copy link
Contributor

@bors bors commented on 7419085 Sep 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = d252d81

Please sign in to comment.