auto merge of #8107 : michaelwoerister/rust/end_of_spanned, r=cmr

Contiunation of naming cleanup in `libsyntax::ast`:
```rust
ast::node_id => ast::NodeId
ast::local_crate => ast::LOCAL_CRATE
ast::crate_node_id => ast::CRATE_NODE_ID
ast::blk_check_mode => ast::BlockCheckMode
ast::ty_field => ast::TypeField
ast::ty_method => ast::TypeMethod
```
Also moved span field directly into `TypeField` struct and cleaned up overlooked `ast::CrateConfig` renamings from last pull request.

Cheers,
Michael
This commit is contained in:
bors 2013-07-30 01:37:17 -07:00
commit d75ab4a5d7
83 changed files with 713 additions and 718 deletions

View file

@ -201,7 +201,7 @@ pub struct CrateAnalysis {
exp_map2: middle::resolve::ExportMap2,
ty_cx: ty::ctxt,
maps: astencode::Maps,
reachable: @mut HashSet<ast::node_id>
reachable: @mut HashSet<ast::NodeId>
}
/// Run the resolution, typechecking, region checking and other

View file

@ -18,7 +18,7 @@ use metadata::filesearch;
use metadata;
use middle::lint;
use syntax::ast::node_id;
use syntax::ast::NodeId;
use syntax::ast::{int_ty, uint_ty, float_ty};
use syntax::codemap::span;
use syntax::diagnostic;
@ -189,13 +189,13 @@ pub struct Session_ {
parse_sess: @mut ParseSess,
codemap: @codemap::CodeMap,
// For a library crate, this is always none
entry_fn: @mut Option<(node_id, codemap::span)>,
entry_fn: @mut Option<(NodeId, codemap::span)>,
entry_type: @mut Option<EntryFnType>,
span_diagnostic: @diagnostic::span_handler,
filesearch: @filesearch::FileSearch,
building_library: @mut bool,
working_dir: Path,
lints: @mut HashMap<ast::node_id, ~[(lint::lint, codemap::span, ~str)]>,
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::span, ~str)]>,
}
pub type Session = @Session_;
@ -248,7 +248,7 @@ impl Session_ {
}
pub fn add_lint(@self,
lint: lint::lint,
id: ast::node_id,
id: ast::NodeId,
sp: span,
msg: ~str) {
match self.lints.find_mut(&id) {
@ -257,7 +257,7 @@ impl Session_ {
}
self.lints.insert(id, ~[(lint, sp, msg)]);
}
pub fn next_node_id(@self) -> ast::node_id {
pub fn next_node_id(@self) -> ast::NodeId {
return syntax::parse::next_node_id(self.parse_sess);
}
pub fn diagnostic(@self) -> @diagnostic::span_handler {

View file

@ -25,7 +25,7 @@ use syntax::print::pprust;
use syntax::{ast, ast_util};
use syntax::attr::AttrMetaMethods;
type node_id_gen = @fn() -> ast::node_id;
type node_id_gen = @fn() -> ast::NodeId;
struct Test {
span: span,

View file

@ -44,7 +44,7 @@ pub fn get_type_param_count(cstore: @mut cstore::CStore, def: ast::def_id)
/// Iterates over all the language items in the given crate.
pub fn each_lang_item(cstore: @mut cstore::CStore,
cnum: ast::CrateNum,
f: &fn(ast::node_id, uint) -> bool) -> bool {
f: &fn(ast::NodeId, uint) -> bool) -> bool {
let crate_data = cstore::get_crate_data(cstore, cnum);
decoder::each_lang_item(crate_data, f)
}

View file

@ -43,8 +43,8 @@ pub struct CStore {
intr: @ident_interner
}
// Map from node_id's of local extern mod statements to crate numbers
type extern_mod_crate_map = HashMap<ast::node_id, ast::CrateNum>;
// Map from NodeId's of local extern mod statements to crate numbers
type extern_mod_crate_map = HashMap<ast::NodeId, ast::CrateNum>;
pub fn mk_cstore(intr: @ident_interner) -> CStore {
return CStore {
@ -125,13 +125,13 @@ pub fn get_used_link_args<'a>(cstore: &'a CStore) -> &'a [@str] {
}
pub fn add_extern_mod_stmt_cnum(cstore: &mut CStore,
emod_id: ast::node_id,
emod_id: ast::NodeId,
cnum: ast::CrateNum) {
cstore.extern_mod_crate_map.insert(emod_id, cnum);
}
pub fn find_extern_mod_stmt_cnum(cstore: &CStore,
emod_id: ast::node_id)
emod_id: ast::NodeId)
-> Option<ast::CrateNum> {
cstore.extern_mod_crate_map.find(&emod_id).map_consume(|x| *x)
}

View file

@ -361,7 +361,7 @@ pub fn lookup_def(cnum: ast::CrateNum, data: @~[u8], did_: ast::def_id) ->
}
pub fn get_trait_def(cdata: cmd,
item_id: ast::node_id,
item_id: ast::NodeId,
tcx: ty::ctxt) -> ty::TraitDef
{
let item_doc = lookup_item(item_id, cdata.data);
@ -375,7 +375,7 @@ pub fn get_trait_def(cdata: cmd,
}
}
pub fn get_type(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
-> ty::ty_param_bounds_and_ty {
let item = lookup_item(id, cdata.data);
@ -392,19 +392,19 @@ pub fn get_type(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
}
}
pub fn get_region_param(cdata: cmd, id: ast::node_id)
pub fn get_region_param(cdata: cmd, id: ast::NodeId)
-> Option<ty::region_variance> {
let item = lookup_item(id, cdata.data);
return item_ty_region_param(item);
}
pub fn get_type_param_count(data: @~[u8], id: ast::node_id) -> uint {
pub fn get_type_param_count(data: @~[u8], id: ast::NodeId) -> uint {
item_ty_param_count(lookup_item(id, data))
}
pub fn get_impl_trait(cdata: cmd,
id: ast::node_id,
id: ast::NodeId,
tcx: ty::ctxt) -> Option<@ty::TraitRef>
{
let item_doc = lookup_item(id, cdata.data);
@ -414,7 +414,7 @@ pub fn get_impl_trait(cdata: cmd,
}
pub fn get_impl_vtables(cdata: cmd,
id: ast::node_id,
id: ast::NodeId,
tcx: ty::ctxt) -> typeck::impl_res
{
let item_doc = lookup_item(id, cdata.data);
@ -428,7 +428,7 @@ pub fn get_impl_vtables(cdata: cmd,
}
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
name: ast::ident) -> Option<ast::def_id> {
let items = reader::get_doc(reader::Doc(cdata.data), tag_items);
let mut found = None;
@ -442,7 +442,7 @@ pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
found
}
pub fn get_symbol(data: @~[u8], id: ast::node_id) -> ~str {
pub fn get_symbol(data: @~[u8], id: ast::NodeId) -> ~str {
return item_symbol(lookup_item(id, data));
}
@ -462,7 +462,7 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
}
/// Iterates over the language items in the given crate.
pub fn each_lang_item(cdata: cmd, f: &fn(ast::node_id, uint) -> bool) -> bool {
pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool {
let root = reader::Doc(cdata.data);
let lang_items = reader::get_doc(root, tag_lang_items);
for reader::tagged_docs(lang_items, tag_lang_items_item) |item_doc| {
@ -470,7 +470,7 @@ pub fn each_lang_item(cdata: cmd, f: &fn(ast::node_id, uint) -> bool) -> bool {
let id = reader::doc_as_u32(id_doc) as uint;
let node_id_doc = reader::get_doc(item_doc,
tag_lang_items_item_node_id);
let node_id = reader::doc_as_u32(node_id_doc) as ast::node_id;
let node_id = reader::doc_as_u32(node_id_doc) as ast::NodeId;
if !f(node_id, id) {
return false;
@ -716,7 +716,7 @@ pub fn each_path(intr: @ident_interner,
context.each_child_of_module_or_crate(crate_items_doc)
}
pub fn get_item_path(cdata: cmd, id: ast::node_id) -> ast_map::path {
pub fn get_item_path(cdata: cmd, id: ast::NodeId) -> ast_map::path {
item_path(lookup_item(id, cdata.data))
}
@ -727,7 +727,7 @@ pub type decode_inlined_item<'self> = &'self fn(
par_doc: ebml::Doc) -> Option<ast::inlined_item>;
pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
id: ast::node_id,
id: ast::NodeId,
decode_inlined_item: decode_inlined_item)
-> csearch::found_ast {
debug!("Looking up item: %d", id);
@ -754,7 +754,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
}
}
pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
tcx: ty::ctxt) -> ~[@ty::VariantInfo] {
let data = cdata.data;
let items = reader::get_doc(reader::Doc(data), tag_items);
@ -833,7 +833,7 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
}
/// Returns information about the given implementation.
pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::node_id,
pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId,
tcx: ty::ctxt)
-> ty::Impl {
let data = cdata.data;
@ -851,7 +851,7 @@ pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::node_id,
pub fn get_method_name_and_explicit_self(
intr: @ident_interner,
cdata: cmd,
id: ast::node_id) -> (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);
@ -859,7 +859,7 @@ pub fn get_method_name_and_explicit_self(
(name, explicit_self)
}
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
tcx: ty::ctxt) -> ty::Method
{
let method_doc = lookup_item(id, cdata.data);
@ -892,7 +892,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
}
pub fn get_trait_method_def_ids(cdata: cmd,
id: ast::node_id) -> ~[ast::def_id] {
id: ast::NodeId) -> ~[ast::def_id] {
let data = cdata.data;
let item = lookup_item(id, data);
let mut result = ~[];
@ -903,7 +903,7 @@ pub fn get_trait_method_def_ids(cdata: cmd,
}
pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
id: ast::node_id, tcx: ty::ctxt) ->
id: ast::NodeId, tcx: ty::ctxt) ->
~[@ty::Method] {
let data = cdata.data;
let item = lookup_item(id, data);
@ -922,7 +922,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
}
/// Returns the supertraits of the given trait.
pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
-> ~[@ty::TraitRef] {
let mut results = ~[];
let item_doc = lookup_item(id, cdata.data);
@ -933,7 +933,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
}
pub fn get_type_name_if_impl(cdata: cmd,
node_id: ast::node_id) -> 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;
@ -948,7 +948,7 @@ pub fn get_type_name_if_impl(cdata: cmd,
pub fn get_static_methods_if_impl(intr: @ident_interner,
cdata: cmd,
node_id: ast::node_id)
node_id: ast::NodeId)
-> Option<~[StaticMethodInfo]> {
let item = lookup_item(node_id, cdata.data);
if item_family(item) != Impl {
@ -992,7 +992,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
}
pub fn get_item_attrs(cdata: cmd,
node_id: ast::node_id,
node_id: ast::NodeId,
f: &fn(~[@ast::MetaItem])) {
let item = lookup_item(node_id, cdata.data);
@ -1012,7 +1012,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility {
}
}
pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId)
-> ~[ty::field_ty] {
let data = cdata.data;
let item = lookup_item(id, data);
@ -1040,7 +1040,7 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
result
}
pub fn get_item_visibility(cdata: cmd, id: ast::node_id)
pub fn get_item_visibility(cdata: cmd, id: ast::NodeId)
-> ast::visibility {
item_visibility(lookup_item(id, cdata.data))
}
@ -1068,7 +1068,7 @@ fn read_path(d: ebml::Doc) -> (~str, uint) {
}
fn describe_def(items: ebml::Doc, id: ast::def_id) -> ~str {
if id.crate != ast::local_crate { return ~"external"; }
if id.crate != ast::LOCAL_CRATE { return ~"external"; }
let it = match maybe_find_item(id.node, items) {
Some(it) => it,
None => fail!("describe_def: item not found %?", id)
@ -1260,7 +1260,7 @@ pub fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8],
// then we must translate the crate number from that encoded in the external
// crate to the correct local crate number.
pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
if did.crate == ast::local_crate {
if did.crate == ast::LOCAL_CRATE {
return ast::def_id { crate: cdata.cnum, node: did.node };
}

View file

@ -58,12 +58,12 @@ pub struct EncodeParams<'self> {
diag: @span_handler,
tcx: ty::ctxt,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'self HashMap<ast::node_id, ~str>,
discrim_symbols: &'self HashMap<ast::node_id, @str>,
item_symbols: &'self HashMap<ast::NodeId, ~str>,
discrim_symbols: &'self HashMap<ast::NodeId, @str>,
link_meta: &'self LinkMeta,
cstore: @mut cstore::CStore,
encode_inlined_item: encode_inlined_item<'self>,
reachable: @mut HashSet<ast::node_id>,
reachable: @mut HashSet<ast::NodeId>,
}
struct Stats {
@ -86,16 +86,16 @@ pub struct EncodeContext<'self> {
tcx: ty::ctxt,
stats: @mut Stats,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'self HashMap<ast::node_id, ~str>,
discrim_symbols: &'self HashMap<ast::node_id, @str>,
item_symbols: &'self HashMap<ast::NodeId, ~str>,
discrim_symbols: &'self HashMap<ast::NodeId, @str>,
link_meta: &'self LinkMeta,
cstore: &'self cstore::CStore,
encode_inlined_item: encode_inlined_item<'self>,
type_abbrevs: abbrev_map,
reachable: @mut HashSet<ast::node_id>,
reachable: @mut HashSet<ast::NodeId>,
}
pub fn reachable(ecx: &EncodeContext, id: node_id) -> bool {
pub fn reachable(ecx: &EncodeContext, id: NodeId) -> bool {
ecx.reachable.contains(&id)
}
@ -275,7 +275,7 @@ fn encode_method_fty(ecx: &EncodeContext,
fn encode_symbol(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
id: node_id) {
id: NodeId) {
ebml_w.start_tag(tag_items_data_item_symbol);
match ecx.item_symbols.find(&id) {
Some(x) => {
@ -292,7 +292,7 @@ fn encode_symbol(ecx: &EncodeContext,
fn encode_discriminant(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
id: node_id) {
id: NodeId) {
ebml_w.start_tag(tag_items_data_item_symbol);
ebml_w.writer.write(ecx.discrim_symbols.get_copy(&id).as_bytes());
ebml_w.end_tag();
@ -316,7 +316,7 @@ fn encode_parent_item(ebml_w: &mut writer::Encoder, id: def_id) {
fn encode_enum_variant_info(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
id: node_id,
id: NodeId,
variants: &[variant],
path: &[ast_map::path_elt],
index: @mut ~[entry<int>],
@ -326,7 +326,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
let mut disr_val = 0;
let mut i = 0;
let vi = ty::enum_variants(ecx.tcx,
ast::def_id { crate: local_crate, node: id });
ast::def_id { crate: LOCAL_CRATE, node: id });
for variants.iter().advance |variant| {
let def_id = local_def(variant.node.id);
index.push(entry {val: variant.node.id, pos: ebml_w.writer.tell()});
@ -481,7 +481,7 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
/// * For enums, iterates through the node IDs of the variants.
///
/// * For newtype structs, iterates through the node ID of the constructor.
fn each_auxiliary_node_id(item: @item, callback: &fn(node_id) -> bool)
fn each_auxiliary_node_id(item: @item, callback: &fn(NodeId) -> bool)
-> bool {
let mut continue = true;
match item.node {
@ -512,7 +512,7 @@ fn each_auxiliary_node_id(item: @item, callback: &fn(node_id) -> bool)
fn encode_reexports(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
id: node_id,
id: NodeId,
path: &[ast_map::path_elt]) {
debug!("(encoding info for module) encoding reexports for %d", id);
match ecx.reexports2.find(&id) {
@ -542,7 +542,7 @@ fn encode_reexports(ecx: &EncodeContext,
fn encode_info_for_mod(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
md: &_mod,
id: node_id,
id: NodeId,
path: &[ast_map::path_elt],
name: ident,
vis: visibility) {
@ -710,7 +710,7 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
path: &[ast_map::path_elt],
name: ast::ident,
ctor_id: node_id,
ctor_id: NodeId,
index: @mut ~[entry<int>]) {
index.push(entry { val: ctor_id, pos: ebml_w.writer.tell() });
@ -755,7 +755,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
m: &ty::Method,
impl_path: &[ast_map::path_elt],
is_default_impl: bool,
parent_id: node_id,
parent_id: NodeId,
ast_method_opt: Option<@method>) {
debug!("encode_info_for_method: %? %s", m.def_id,
@ -1081,7 +1081,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
// Now output the method info for each method.
let r = ty::trait_method_def_ids(tcx, def_id);
for r.iter().enumerate().advance |(i, &method_def_id)| {
assert_eq!(method_def_id.crate, ast::local_crate);
assert_eq!(method_def_id.crate, ast::LOCAL_CRATE);
let method_ty = ty::method(tcx, method_def_id);
@ -1186,11 +1186,11 @@ fn encode_info_for_items(ecx: &EncodeContext,
-> ~[entry<int>] {
let index = @mut ~[];
ebml_w.start_tag(tag_items_data);
index.push(entry { val: crate_node_id, pos: ebml_w.writer.tell() });
index.push(entry { val: CRATE_NODE_ID, pos: ebml_w.writer.tell() });
encode_info_for_mod(ecx,
ebml_w,
&crate.module,
crate_node_id,
CRATE_NODE_ID,
[],
syntax::parse::token::special_idents::invalid,
public);
@ -1458,7 +1458,7 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
let def_id = match def_id {
Some(id) => id, None => { loop }
};
if def_id.crate != local_crate {
if def_id.crate != LOCAL_CRATE {
loop;
}

View file

@ -165,7 +165,7 @@ fn reserve_id_range(sess: Session,
}
impl ExtendedDecodeContext {
pub fn tr_id(&self, id: ast::node_id) -> ast::node_id {
pub fn tr_id(&self, id: ast::NodeId) -> ast::NodeId {
/*!
* Translates an internal id, meaning a node id that is known
* to refer to some part of the item currently being inlined,
@ -212,8 +212,8 @@ impl ExtendedDecodeContext {
* refer to the current crate and to the new, inlined node-id.
*/
assert_eq!(did.crate, ast::local_crate);
ast::def_id { crate: ast::local_crate, node: self.tr_id(did.node) }
assert_eq!(did.crate, ast::LOCAL_CRATE);
ast::def_id { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) }
}
pub fn tr_span(&self, _span: span) -> span {
codemap::dummy_sp() // FIXME (#1972): handle span properly
@ -802,7 +802,7 @@ impl ebml_writer_helpers for writer::Encoder {
trait write_tag_and_id {
fn tag(&mut self, tag_id: c::astencode_tag, f: &fn(&mut Self));
fn id(&mut self, id: ast::node_id);
fn id(&mut self, id: ast::NodeId);
}
impl write_tag_and_id for writer::Encoder {
@ -814,7 +814,7 @@ impl write_tag_and_id for writer::Encoder {
self.end_tag();
}
fn id(&mut self, id: ast::node_id) {
fn id(&mut self, id: ast::NodeId) {
self.wr_tagged_u64(c::tag_table_id as uint, id as u64)
}
}
@ -833,7 +833,7 @@ fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
let ecx_ptr : *() = unsafe { cast::transmute(ecx) };
ast_util::visit_ids_for_inlined_item(
ii,
|id: ast::node_id| {
|id: ast::NodeId| {
// Note: this will cause a copy of ebml_w, which is bad as
// it is mutable. But I believe it's harmless since we generate
// balanced EBML.
@ -848,7 +848,7 @@ fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
fn encode_side_tables_for_id(ecx: &e::EncodeContext,
maps: Maps,
ebml_w: &mut writer::Encoder,
id: ast::node_id) {
id: ast::NodeId) {
let tcx = ecx.tcx;
debug!("Encoding side tables for id %d", id);
@ -903,7 +903,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
}
}
let lid = ast::def_id { crate: ast::local_crate, node: id };
let lid = ast::def_id { crate: ast::LOCAL_CRATE, node: id };
{
let r = tcx.tcache.find(&lid);
for r.iter().advance |&tpbt| {
@ -1181,7 +1181,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
}
c::tag_table_tcache => {
let tpbt = val_dsr.read_ty_param_bounds_and_ty(xcx);
let lid = ast::def_id { crate: ast::local_crate, node: id };
let lid = ast::def_id { crate: ast::LOCAL_CRATE, node: id };
dcx.tcx.tcache.insert(lid, tpbt);
}
c::tag_table_param_defs => {

View file

@ -37,7 +37,7 @@ struct CheckLoanCtxt<'self> {
dfcx_loans: &'self LoanDataFlow,
move_data: @move_data::FlowedMoveData,
all_loans: &'self [Loan],
reported: @mut HashSet<ast::node_id>,
reported: @mut HashSet<ast::NodeId>,
}
pub fn check_loans(bccx: @BorrowckCtxt,
@ -73,7 +73,7 @@ impl<'self> CheckLoanCtxt<'self> {
pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
pub fn each_issued_loan(&self,
scope_id: ast::node_id,
scope_id: ast::NodeId,
op: &fn(&Loan) -> bool)
-> bool {
//! Iterates over each loan that has been issued
@ -92,7 +92,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
pub fn each_in_scope_loan(&self,
scope_id: ast::node_id,
scope_id: ast::NodeId,
op: &fn(&Loan) -> bool)
-> bool {
//! Like `each_issued_loan()`, but only considers loans that are
@ -110,7 +110,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
pub fn each_in_scope_restriction(&self,
scope_id: ast::node_id,
scope_id: ast::NodeId,
loan_path: @LoanPath,
op: &fn(&Loan, &Restriction) -> bool)
-> bool {
@ -129,7 +129,7 @@ impl<'self> CheckLoanCtxt<'self> {
return true;
}
pub fn loans_generated_by(&self, scope_id: ast::node_id) -> ~[uint] {
pub fn loans_generated_by(&self, scope_id: ast::NodeId) -> ~[uint] {
//! Returns a vector of the loans that are generated as
//! we encounter `scope_id`.
@ -140,7 +140,7 @@ impl<'self> CheckLoanCtxt<'self> {
return result;
}
pub fn check_for_conflicting_loans(&self, scope_id: ast::node_id) {
pub fn check_for_conflicting_loans(&self, scope_id: ast::NodeId) {
//! Checks to see whether any of the loans that are issued
//! by `scope_id` conflict with loans that have already been
//! issued when we enter `scope_id` (for example, we do not
@ -256,7 +256,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
pub fn check_if_path_is_moved(&self,
id: ast::node_id,
id: ast::NodeId,
span: span,
use_kind: MovedValueUseKind,
lp: @LoanPath) {
@ -561,7 +561,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
}
fn check_move_out_from_id(&self, id: ast::node_id, span: span) {
fn check_move_out_from_id(&self, id: ast::NodeId, span: span) {
for self.move_data.each_path_moved_by(id) |_, move_path| {
match self.analyze_move_out_from(id, move_path) {
MoveOk => {}
@ -581,7 +581,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
pub fn analyze_move_out_from(&self,
expr_id: ast::node_id,
expr_id: ast::NodeId,
move_path: @LoanPath) -> MoveError {
debug!("analyze_move_out_from(expr_id=%?, move_path=%s)",
expr_id, move_path.repr(self.tcx()));
@ -600,7 +600,7 @@ impl<'self> CheckLoanCtxt<'self> {
pub fn check_call(&self,
_expr: @ast::expr,
_callee: Option<@ast::expr>,
_callee_id: ast::node_id,
_callee_id: ast::NodeId,
_callee_span: span,
_args: &[@ast::expr]) {
// NB: This call to check for conflicting loans is not truly
@ -617,7 +617,7 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
id: ast::node_id,
id: ast::NodeId,
(this, visitor): (CheckLoanCtxt<'a>,
visit::vt<CheckLoanCtxt<'a>>)) {
match *fk {
@ -636,7 +636,7 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
visit::visit_fn(fk, decl, body, sp, id, (this, visitor));
fn check_captured_variables(this: CheckLoanCtxt,
closure_id: ast::node_id,
closure_id: ast::NodeId,
span: span) {
let cap_vars = this.bccx.capture_map.get(&closure_id);
for cap_vars.iter().advance |cap_var| {
@ -654,7 +654,7 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
return;
fn check_by_move_capture(this: CheckLoanCtxt,
closure_id: ast::node_id,
closure_id: ast::NodeId,
cap_var: &moves::CaptureVar,
move_path: @LoanPath) {
let move_err = this.analyze_move_out_from(closure_id, move_path);

View file

@ -24,9 +24,9 @@ use util::ppaux::{UserString};
pub fn gather_decl(bccx: @BorrowckCtxt,
move_data: &mut MoveData,
decl_id: ast::node_id,
decl_id: ast::NodeId,
_decl_span: span,
var_id: ast::node_id) {
var_id: ast::NodeId) {
let loan_path = @LpVar(var_id);
move_data.add_move(bccx.tcx, loan_path, decl_id, Declared);
}
@ -49,7 +49,7 @@ pub fn gather_move_from_pat(bccx: @BorrowckCtxt,
fn gather_move_from_expr_or_pat(bccx: @BorrowckCtxt,
move_data: &mut MoveData,
move_id: ast::node_id,
move_id: ast::NodeId,
move_kind: MoveKind,
cmt: mc::cmt) {
if !check_is_legal_to_move_from(bccx, cmt, cmt) {
@ -85,10 +85,10 @@ pub fn gather_captures(bccx: @BorrowckCtxt,
pub fn gather_assignment(bccx: @BorrowckCtxt,
move_data: &mut MoveData,
assignment_id: ast::node_id,
assignment_id: ast::NodeId,
assignment_span: span,
assignee_loan_path: @LoanPath,
assignee_id: ast::node_id) {
assignee_id: ast::NodeId) {
move_data.add_assignment(bccx.tcx,
assignee_loan_path,
assignment_id,

View file

@ -21,8 +21,8 @@ use syntax::codemap::span;
use util::ppaux::{note_and_explain_region};
pub fn guarantee_lifetime(bccx: @BorrowckCtxt,
item_scope_id: ast::node_id,
root_scope_id: ast::node_id,
item_scope_id: ast::NodeId,
root_scope_id: ast::NodeId,
span: span,
cmt: mc::cmt,
loan_region: ty::Region,
@ -46,11 +46,11 @@ struct GuaranteeLifetimeContext {
bccx: @BorrowckCtxt,
// the node id of the function body for the enclosing item
item_scope_id: ast::node_id,
item_scope_id: ast::NodeId,
// the node id of the innermost loop / function body; this is the
// longest scope for which we can root managed boxes
root_scope_id: ast::node_id,
root_scope_id: ast::NodeId,
span: span,
loan_region: ty::Region,
@ -63,7 +63,7 @@ impl GuaranteeLifetimeContext {
self.bccx.tcx
}
fn check(&self, cmt: mc::cmt, discr_scope: Option<ast::node_id>) {
fn check(&self, cmt: mc::cmt, discr_scope: Option<ast::NodeId>) {
//! Main routine. Walks down `cmt` until we find the "guarantor".
match cmt.cat {
@ -189,7 +189,7 @@ impl GuaranteeLifetimeContext {
cmt_base: mc::cmt,
derefs: uint,
ptr_mutbl: ast::mutability,
discr_scope: Option<ast::node_id>) {
discr_scope: Option<ast::NodeId>) {
debug!("check_root(cmt_deref=%s, cmt_base=%s, derefs=%?, ptr_mutbl=%?, \
discr_scope=%?)",
cmt_deref.repr(self.tcx()),

View file

@ -68,8 +68,8 @@ struct GatherLoanCtxt {
id_range: id_range,
move_data: @mut move_data::MoveData,
all_loans: @mut ~[Loan],
item_ub: ast::node_id,
repeating_ids: ~[ast::node_id]
item_ub: ast::NodeId,
repeating_ids: ~[ast::NodeId]
}
pub fn gather_loans(bccx: @BorrowckCtxt,
@ -111,7 +111,7 @@ fn gather_loans_in_fn(fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
id: ast::node_id,
id: ast::NodeId,
(this, v): (@mut GatherLoanCtxt,
visit::vt<@mut GatherLoanCtxt>)) {
match fk {
@ -294,11 +294,11 @@ fn gather_loans_in_expr(ex: @ast::expr,
impl GatherLoanCtxt {
pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
pub fn push_repeating_id(&mut self, id: ast::node_id) {
pub fn push_repeating_id(&mut self, id: ast::NodeId) {
self.repeating_ids.push(id);
}
pub fn pop_repeating_id(&mut self, id: ast::node_id) {
pub fn pop_repeating_id(&mut self, id: ast::NodeId) {
let popped = self.repeating_ids.pop();
assert_eq!(id, popped);
}
@ -369,7 +369,7 @@ impl GatherLoanCtxt {
// also entail "rooting" GC'd pointers, which means ensuring
// dynamically that they are not freed.
pub fn guarantee_valid(&mut self,
borrow_id: ast::node_id,
borrow_id: ast::NodeId,
borrow_span: span,
cmt: mc::cmt,
req_mutbl: ast::mutability,
@ -559,9 +559,9 @@ impl GatherLoanCtxt {
}
pub fn compute_gen_scope(&self,
borrow_id: ast::node_id,
loan_scope: ast::node_id)
-> ast::node_id {
borrow_id: ast::NodeId,
loan_scope: ast::NodeId)
-> ast::NodeId {
//! Determine when to introduce the loan. Typically the loan
//! is introduced at the point of the borrow, but in some cases,
//! notably method arguments, the loan may be introduced only
@ -575,8 +575,8 @@ impl GatherLoanCtxt {
}
}
pub fn compute_kill_scope(&self, loan_scope: ast::node_id, lp: @LoanPath)
-> ast::node_id {
pub fn compute_kill_scope(&self, loan_scope: ast::NodeId, lp: @LoanPath)
-> ast::NodeId {
//! Determine when the loan restrictions go out of scope.
//! This is either when the lifetime expires or when the
//! local variable which roots the loan-path goes out of scope,
@ -633,7 +633,7 @@ impl GatherLoanCtxt {
fn gather_pat(&mut self,
discr_cmt: mc::cmt,
root_pat: @ast::pat,
arm_match_ids: Option<(ast::node_id, ast::node_id)>) {
arm_match_ids: Option<(ast::NodeId, ast::NodeId)>) {
/*!
* Walks patterns, examining the bindings to determine if they
* cause borrows (`ref` bindings, vector patterns) or

View file

@ -117,7 +117,7 @@ fn borrowck_fn(fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
id: ast::node_id,
id: ast::NodeId,
(this, v): (@BorrowckCtxt,
visit::vt<@BorrowckCtxt>)) {
match fk {
@ -185,7 +185,7 @@ pub struct BorrowStats {
guaranteed_paths: uint
}
pub type LoanMap = @mut HashMap<ast::node_id, @Loan>;
pub type LoanMap = @mut HashMap<ast::NodeId, @Loan>;
// The keys to the root map combine the `id` of the deref expression
// with the number of types that it is *autodereferenced*. So, for
@ -212,7 +212,7 @@ pub type LoanMap = @mut HashMap<ast::node_id, @Loan>;
// auto-slice.
#[deriving(Eq, IterBytes)]
pub struct root_map_key {
id: ast::node_id,
id: ast::NodeId,
derefs: uint
}
@ -238,14 +238,14 @@ pub struct Loan {
cmt: mc::cmt,
mutbl: ast::mutability,
restrictions: ~[Restriction],
gen_scope: ast::node_id,
kill_scope: ast::node_id,
gen_scope: ast::NodeId,
kill_scope: ast::NodeId,
span: span,
}
#[deriving(Eq, IterBytes)]
pub enum LoanPath {
LpVar(ast::node_id), // `x` in doc.rs
LpVar(ast::NodeId), // `x` in doc.rs
LpExtend(@LoanPath, mc::MutabilityCategory, LoanPathElem)
}
@ -256,7 +256,7 @@ pub enum LoanPathElem {
}
impl LoanPath {
pub fn node_id(&self) -> ast::node_id {
pub fn node_id(&self) -> ast::NodeId {
match *self {
LpVar(local_id) => local_id,
LpExtend(base, _, _) => base.node_id()
@ -376,7 +376,7 @@ impl BitAnd<RestrictionSet,RestrictionSet> for RestrictionSet {
// uncovered after a certain number of auto-derefs.
pub struct RootInfo {
scope: ast::node_id,
scope: ast::NodeId,
freeze: Option<DynaFreezeKind> // Some() if we should freeze box at runtime
}
@ -440,12 +440,12 @@ impl BorrowckCtxt {
self.tcx.region_maps.is_subregion_of(r_sub, r_sup)
}
pub fn is_subscope_of(&self, r_sub: ast::node_id, r_sup: ast::node_id)
pub fn is_subscope_of(&self, r_sub: ast::NodeId, r_sup: ast::NodeId)
-> bool {
self.tcx.region_maps.is_subscope_of(r_sub, r_sup)
}
pub fn is_move(&self, id: ast::node_id) -> bool {
pub fn is_move(&self, id: ast::NodeId) -> bool {
self.moves_map.contains(&id)
}
@ -477,7 +477,7 @@ impl BorrowckCtxt {
}
pub fn cat_def(&self,
id: ast::node_id,
id: ast::NodeId,
span: span,
ty: ty::t,
def: ast::def)
@ -485,7 +485,7 @@ impl BorrowckCtxt {
mc::cat_def(self.tcx, self.method_map, id, span, ty, def)
}
pub fn cat_discr(&self, cmt: mc::cmt, match_id: ast::node_id) -> mc::cmt {
pub fn cat_discr(&self, cmt: mc::cmt, match_id: ast::NodeId) -> mc::cmt {
@mc::cmt_ {cat:mc::cat_discr(cmt, match_id),
mutbl:cmt.mutbl.inherit(),
..*cmt}

View file

@ -49,7 +49,7 @@ pub struct MoveData {
/// assigned dataflow bits, but we track them because they still
/// kill move bits.
path_assignments: ~[Assignment],
assignee_ids: HashSet<ast::node_id>,
assignee_ids: HashSet<ast::NodeId>,
}
pub struct FlowedMoveData {
@ -118,7 +118,7 @@ pub struct Move {
path: MovePathIndex,
/// id of node that is doing the move.
id: ast::node_id,
id: ast::NodeId,
/// Kind of move, for error messages.
kind: MoveKind,
@ -132,7 +132,7 @@ pub struct Assignment {
path: MovePathIndex,
/// id where assignment occurs
id: ast::node_id,
id: ast::NodeId,
/// span of node where assignment occurs
span: span,
@ -296,7 +296,7 @@ impl MoveData {
pub fn add_move(&mut self,
tcx: ty::ctxt,
lp: @LoanPath,
id: ast::node_id,
id: ast::NodeId,
kind: MoveKind) {
/*!
* Adds a new move entry for a move of `lp` that occurs at
@ -325,9 +325,9 @@ impl MoveData {
pub fn add_assignment(&mut self,
tcx: ty::ctxt,
lp: @LoanPath,
assign_id: ast::node_id,
assign_id: ast::NodeId,
span: span,
assignee_id: ast::node_id) {
assignee_id: ast::NodeId) {
/*!
* Adds a new record for an assignment to `lp` that occurs at
* location `id` with the given `span`.
@ -460,7 +460,7 @@ impl MoveData {
fn kill_moves(&self,
path: MovePathIndex,
kill_id: ast::node_id,
kill_id: ast::NodeId,
dfcx_moves: &mut MoveDataFlow) {
for self.each_applicable_move(path) |move_index| {
dfcx_moves.add_kill(kill_id, *move_index);
@ -499,7 +499,7 @@ impl FlowedMoveData {
}
pub fn each_path_moved_by(&self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(&Move, @LoanPath) -> bool)
-> bool {
/*!
@ -517,7 +517,7 @@ impl FlowedMoveData {
}
pub fn each_move_of(&self,
id: ast::node_id,
id: ast::NodeId,
loan_path: @LoanPath,
f: &fn(&Move, @LoanPath) -> bool)
-> bool {
@ -573,7 +573,7 @@ impl FlowedMoveData {
}
pub fn is_assignee(&self,
id: ast::node_id)
id: ast::NodeId)
-> bool {
//! True if `id` is the id of the LHS of an assignment
@ -581,7 +581,7 @@ impl FlowedMoveData {
}
pub fn each_assignment_of(&self,
id: ast::node_id,
id: ast::NodeId,
loan_path: @LoanPath,
f: &fn(&Assignment) -> bool)
-> bool {

View file

@ -20,13 +20,13 @@ use syntax::opt_vec;
struct CFGBuilder {
tcx: ty::ctxt,
method_map: typeck::method_map,
exit_map: HashMap<ast::node_id, CFGIndex>,
exit_map: HashMap<ast::NodeId, CFGIndex>,
graph: CFGGraph,
loop_scopes: ~[LoopScope],
}
struct LoopScope {
loop_id: ast::node_id, // id of loop/while node
loop_id: ast::NodeId, // id of loop/while node
continue_index: CFGIndex, // where to go on a `loop`
break_index: CFGIndex, // where to go on a `break
}
@ -454,7 +454,7 @@ impl CFGBuilder {
self.add_node(0, preds)
}
fn add_node(&mut self, id: ast::node_id, preds: &[CFGIndex]) -> CFGIndex {
fn add_node(&mut self, id: ast::NodeId, preds: &[CFGIndex]) -> CFGIndex {
assert!(!self.exit_map.contains_key(&id));
let node = self.graph.add_node(CFGNodeData {id: id});
self.exit_map.insert(id, node);

View file

@ -25,18 +25,18 @@ use syntax::opt_vec::OptVec;
mod construct;
pub struct CFG {
exit_map: HashMap<ast::node_id, CFGIndex>,
exit_map: HashMap<ast::NodeId, CFGIndex>,
graph: CFGGraph,
entry: CFGIndex,
exit: CFGIndex,
}
pub struct CFGNodeData {
id: ast::node_id
id: ast::NodeId
}
pub struct CFGEdgeData {
exiting_scopes: OptVec<ast::node_id>
exiting_scopes: OptVec<ast::NodeId>
}
pub type CFGIndex = graph::NodeIndex;
@ -58,4 +58,4 @@ impl CFG {
blk: &ast::Block) -> CFG {
construct::construct(tcx, method_map, blk)
}
}
}

View file

@ -200,7 +200,7 @@ struct env {
sess: Session,
ast_map: ast_map::map,
def_map: resolve::DefMap,
idstack: @mut ~[node_id]
idstack: @mut ~[NodeId]
}
// Make sure a const item doesn't recursively refer to itself

View file

@ -777,7 +777,7 @@ pub fn check_fn(cx: &MatchCheckCtxt,
decl: &fn_decl,
body: &Block,
sp: span,
id: node_id,
id: NodeId,
(s, v): ((),
visit::vt<()>)) {
visit::visit_fn(kind, decl, body, sp, id, (s, v));

View file

@ -175,7 +175,7 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
enum_def: ast::def_id,
variant_def: ast::def_id)
-> Option<@expr> {
fn variant_expr(variants: &[ast::variant], id: ast::node_id) -> Option<@expr> {
fn variant_expr(variants: &[ast::variant], id: ast::NodeId) -> Option<@expr> {
for variants.iter().advance |variant| {
if variant.node.id == id {
return variant.node.disr_expr;

View file

@ -46,7 +46,7 @@ pub struct DataFlowContext<O> {
priv words_per_id: uint,
// mapping from node to bitset index.
priv nodeid_to_bitset: HashMap<ast::node_id,uint>,
priv nodeid_to_bitset: HashMap<ast::NodeId,uint>,
// Bit sets per id. The following three fields (`gens`, `kills`,
// and `on_entry`) all have the same structure. For each id in
@ -93,7 +93,7 @@ enum LoopKind {
}
struct LoopScope<'self> {
loop_id: ast::node_id,
loop_id: ast::NodeId,
loop_kind: LoopKind,
break_bits: ~[uint]
}
@ -126,7 +126,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
}
pub fn add_gen(&mut self, id: ast::node_id, bit: uint) {
pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` generates `bit`
debug!("add_gen(id=%?, bit=%?)", id, bit);
@ -137,7 +137,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
}
pub fn add_kill(&mut self, id: ast::node_id, bit: uint) {
pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` kills `bit`
debug!("add_kill(id=%?, bit=%?)", id, bit);
@ -148,7 +148,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
}
fn apply_gen_kill(&mut self, id: ast::node_id, bits: &mut [uint]) {
fn apply_gen_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) {
//! Applies the gen and kill sets for `id` to `bits`
debug!("apply_gen_kill(id=%?, bits=%s) [before]",
@ -163,7 +163,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
id, mut_bits_to_str(bits));
}
fn apply_kill(&mut self, id: ast::node_id, bits: &mut [uint]) {
fn apply_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) {
debug!("apply_kill(id=%?, bits=%s) [before]",
id, mut_bits_to_str(bits));
let (start, end) = self.compute_id_range(id);
@ -173,14 +173,14 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
id, mut_bits_to_str(bits));
}
fn compute_id_range_frozen(&self, id: ast::node_id) -> (uint, uint) {
fn compute_id_range_frozen(&self, id: ast::NodeId) -> (uint, uint) {
let n = *self.nodeid_to_bitset.get(&id);
let start = n * self.words_per_id;
let end = start + self.words_per_id;
(start, end)
}
fn compute_id_range(&mut self, id: ast::node_id) -> (uint, uint) {
fn compute_id_range(&mut self, id: ast::NodeId) -> (uint, uint) {
let mut expanded = false;
let len = self.nodeid_to_bitset.len();
let n = do self.nodeid_to_bitset.find_or_insert_with(id) |_| {
@ -208,7 +208,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
pub fn each_bit_on_entry_frozen(&self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(uint) -> bool) -> bool {
//! Iterates through each bit that is set on entry to `id`.
//! Only useful after `propagate()` has been called.
@ -223,7 +223,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
pub fn each_bit_on_entry(&mut self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(uint) -> bool) -> bool {
//! Iterates through each bit that is set on entry to `id`.
//! Only useful after `propagate()` has been called.
@ -236,7 +236,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
pub fn each_gen_bit(&mut self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(uint) -> bool) -> bool {
//! Iterates through each bit in the gen set for `id`.
@ -248,7 +248,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
pub fn each_gen_bit_frozen(&self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(uint) -> bool) -> bool {
//! Iterates through each bit in the gen set for `id`.
if !self.nodeid_to_bitset.contains_key(&id) {
@ -851,8 +851,8 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn walk_call(&mut self,
_callee_id: ast::node_id,
call_id: ast::node_id,
_callee_id: ast::NodeId,
call_id: ast::NodeId,
arg0: @ast::expr,
args: &[@ast::expr],
in_out: &mut [uint],
@ -949,7 +949,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
for bits.mut_iter().advance |b| { *b = e; }
}
fn add_to_entry_set(&mut self, id: ast::node_id, pred_bits: &[uint]) {
fn add_to_entry_set(&mut self, id: ast::NodeId, pred_bits: &[uint]) {
debug!("add_to_entry_set(id=%?, pred_bits=%s)",
id, bits_to_str(pred_bits));
let (start, end) = self.dfcx.compute_id_range(id);
@ -965,7 +965,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn merge_with_entry_set(&mut self,
id: ast::node_id,
id: ast::NodeId,
pred_bits: &mut [uint]) {
debug!("merge_with_entry_set(id=%?, pred_bits=%s)",
id, mut_bits_to_str(pred_bits));

View file

@ -17,7 +17,7 @@ use middle::typeck::method_map;
use util::ppaux;
use syntax::ast::{deref, expr_call, expr_inline_asm, expr_method_call};
use syntax::ast::{expr_unary, node_id, unsafe_blk, unsafe_fn, expr_path};
use syntax::ast::{expr_unary, unsafe_fn, expr_path};
use syntax::ast;
use syntax::codemap::span;
use syntax::visit::{fk_item_fn, fk_method};
@ -27,7 +27,7 @@ use syntax::visit;
enum UnsafeContext {
SafeContext,
UnsafeFn,
UnsafeBlock(node_id),
UnsafeBlock(ast::NodeId),
}
struct Context {
@ -99,7 +99,7 @@ pub fn check_crate(tcx: ty::ctxt,
visit_block: |block, (_, visitor)| {
let old_unsafe_context = context.unsafe_context;
if block.rules == unsafe_blk &&
if block.rules == ast::UnsafeBlock &&
context.unsafe_context == SafeContext {
context.unsafe_context = UnsafeBlock(block.id)
}

View file

@ -12,7 +12,7 @@
use driver::session;
use driver::session::Session;
use syntax::parse::token::special_idents;
use syntax::ast::{Crate, node_id, item, item_fn};
use syntax::ast::{Crate, NodeId, item, item_fn};
use syntax::attr;
use syntax::codemap::span;
use syntax::visit::{default_visitor, mk_vt, vt, Visitor, visit_crate, visit_item};
@ -25,17 +25,17 @@ struct EntryContext {
ast_map: ast_map::map,
// The top-level function called 'main'
main_fn: Option<(node_id, span)>,
main_fn: Option<(NodeId, span)>,
// The function that has attribute named 'main'
attr_main_fn: Option<(node_id, span)>,
attr_main_fn: Option<(NodeId, span)>,
// The function that has the attribute 'start' on it
start_fn: Option<(node_id, span)>,
start_fn: Option<(NodeId, span)>,
// The functions that one might think are 'main' but aren't, e.g.
// main functions not defined at the top level. For diagnostics.
non_main_fns: ~[(node_id, span)],
non_main_fns: ~[(NodeId, span)],
}
type EntryVisitor = vt<@mut EntryContext>;

View file

@ -27,7 +27,7 @@ pub struct freevar_entry {
span: span //< First span where it is accessed (there can be multiple)
}
pub type freevar_info = @~[@freevar_entry];
pub type freevar_map = @mut HashMap<ast::node_id, freevar_info>;
pub type freevar_map = @mut HashMap<ast::NodeId, freevar_info>;
// Searches through part of the AST for all references to locals or
// upvars in this frame and returns the list of definition IDs thus found.
@ -95,7 +95,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: &ast::Crate) ->
&ast::fn_decl,
&ast::Block,
span,
ast::node_id) = |_, _, blk, _, nid| {
ast::NodeId) = |_, _, blk, _, nid| {
let vars = collect_freevars(def_map, blk);
freevars.insert(nid, vars);
};
@ -109,13 +109,13 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: &ast::Crate) ->
return freevars;
}
pub fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info {
pub fn get_freevars(tcx: ty::ctxt, fid: ast::NodeId) -> freevar_info {
match tcx.freevars.find(&fid) {
None => fail!("get_freevars: %d has no freevars", fid),
Some(&d) => return d
}
}
pub fn has_freevars(tcx: ty::ctxt, fid: ast::node_id) -> bool {
pub fn has_freevars(tcx: ty::ctxt, fid: ast::NodeId) -> bool {
!get_freevars(tcx, fid).is_empty()
}

View file

@ -55,7 +55,7 @@ pub static try_adding: &'static str = "Try adding a move";
pub struct Context {
tcx: ty::ctxt,
method_map: typeck::method_map,
current_item: node_id
current_item: NodeId
}
pub fn check_crate(tcx: ty::ctxt,
@ -156,9 +156,9 @@ fn check_item(item: @item, (cx, visitor): (Context, visit::vt<Context>)) {
}
// Yields the appropriate function to check the kind of closed over
// variables. `id` is the node_id for some expression that creates the
// variables. `id` is the NodeId for some expression that creates the
// closure.
fn with_appropriate_checker(cx: Context, id: node_id,
fn with_appropriate_checker(cx: Context, id: NodeId,
b: &fn(checker: &fn(Context, @freevar_entry))) {
fn check_for_uniq(cx: Context, fv: &freevar_entry, bounds: ty::BuiltinBounds) {
// all captured data must be owned, regardless of whether it is
@ -230,7 +230,7 @@ fn check_fn(
decl: &fn_decl,
body: &Block,
sp: span,
fn_id: node_id,
fn_id: NodeId,
(cx, v): (Context,
visit::vt<Context>)) {
@ -348,7 +348,7 @@ pub fn check_builtin_bounds(cx: Context, ty: ty::t, bounds: ty::BuiltinBounds,
}
pub fn check_typaram_bounds(cx: Context,
_type_parameter_id: node_id,
_type_parameter_id: NodeId,
sp: span,
ty: ty::t,
type_param_def: &ty::TypeParameterDef)

View file

@ -874,7 +874,7 @@ fn lint_unused_unsafe() -> visit::vt<@mut Context> {
visit::mk_vt(@visit::Visitor {
visit_expr: |e, (cx, vt): (@mut Context, visit::vt<@mut Context>)| {
match e.node {
ast::expr_block(ref blk) if blk.rules == ast::unsafe_blk => {
ast::expr_block(ref blk) if blk.rules == ast::UnsafeBlock => {
if !cx.tcx.used_unsafe.contains(&blk.id) {
cx.span_lint(unused_unsafe, blk.span,
"unnecessary `unsafe` block");

View file

@ -212,7 +212,7 @@ fn invalid_node() -> LiveNode { LiveNode(uint::max_value) }
struct CaptureInfo {
ln: LiveNode,
is_move: bool,
var_nid: node_id
var_nid: NodeId
}
enum LocalKind {
@ -222,14 +222,14 @@ enum LocalKind {
}
struct LocalInfo {
id: node_id,
id: NodeId,
ident: ident,
is_mutbl: bool,
kind: LocalKind,
}
enum VarKind {
Arg(node_id, ident),
Arg(NodeId, ident),
Local(LocalInfo),
ImplicitRet
}
@ -241,9 +241,9 @@ struct IrMaps {
num_live_nodes: uint,
num_vars: uint,
live_node_map: HashMap<node_id, LiveNode>,
variable_map: HashMap<node_id, Variable>,
capture_info_map: HashMap<node_id, @~[CaptureInfo]>,
live_node_map: HashMap<NodeId, LiveNode>,
variable_map: HashMap<NodeId, Variable>,
capture_info_map: HashMap<NodeId, @~[CaptureInfo]>,
var_kinds: ~[VarKind],
lnks: ~[LiveNodeKind],
}
@ -279,7 +279,7 @@ impl IrMaps {
}
pub fn add_live_node_for_node(&mut self,
node_id: node_id,
node_id: NodeId,
lnk: LiveNodeKind) {
let ln = self.add_live_node(lnk);
self.live_node_map.insert(node_id, ln);
@ -304,7 +304,7 @@ impl IrMaps {
v
}
pub fn variable(&mut self, node_id: node_id, span: span) -> Variable {
pub fn variable(&mut self, node_id: NodeId, span: span) -> Variable {
match self.variable_map.find(&node_id) {
Some(&var) => var,
None => {
@ -323,7 +323,7 @@ impl IrMaps {
}
}
pub fn set_captures(&mut self, node_id: node_id, cs: ~[CaptureInfo]) {
pub fn set_captures(&mut self, node_id: NodeId, cs: ~[CaptureInfo]) {
self.capture_info_map.insert(node_id, @cs);
}
@ -345,7 +345,7 @@ fn visit_fn(fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
sp: span,
id: node_id,
id: NodeId,
(this, v): (@mut IrMaps,
vt<@mut IrMaps>)) {
debug!("visit_fn: id=%d", id);
@ -553,7 +553,7 @@ static ACC_READ: uint = 1u;
static ACC_WRITE: uint = 2u;
static ACC_USE: uint = 4u;
type LiveNodeMap = @mut HashMap<node_id, LiveNode>;
type LiveNodeMap = @mut HashMap<NodeId, LiveNode>;
struct Liveness {
tcx: ty::ctxt,
@ -563,7 +563,7 @@ struct Liveness {
users: @mut ~[Users],
// The list of node IDs for the nested loop scopes
// we're in.
loop_scope: @mut ~[node_id],
loop_scope: @mut ~[NodeId],
// mappings from loop node ID to LiveNode
// ("break" label should map to loop node ID,
// it probably doesn't now)
@ -586,7 +586,7 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
}
impl Liveness {
pub fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
pub fn live_node(&self, node_id: NodeId, span: span) -> LiveNode {
let ir: &mut IrMaps = self.ir;
match ir.live_node_map.find(&node_id) {
Some(&ln) => ln,
@ -614,11 +614,11 @@ impl Liveness {
}
}
pub fn variable(&self, node_id: node_id, span: span) -> Variable {
pub fn variable(&self, node_id: NodeId, span: span) -> Variable {
self.ir.variable(node_id, span)
}
pub fn variable_from_def_map(&self, node_id: node_id, span: span)
pub fn variable_from_def_map(&self, node_id: NodeId, span: span)
-> Option<Variable> {
match self.tcx.def_map.find(&node_id) {
Some(&def) => {
@ -635,7 +635,7 @@ impl Liveness {
pub fn pat_bindings(&self,
pat: @pat,
f: &fn(LiveNode, Variable, span, node_id)) {
f: &fn(LiveNode, Variable, span, NodeId)) {
let def_map = self.tcx.def_map;
do pat_util::pat_bindings(def_map, pat) |_bm, p_id, sp, _n| {
let ln = self.live_node(p_id, sp);
@ -646,7 +646,7 @@ impl Liveness {
pub fn arm_pats_bindings(&self,
pats: &[@pat],
f: &fn(LiveNode, Variable, span, node_id)) {
f: &fn(LiveNode, Variable, span, NodeId)) {
// only consider the first pattern; any later patterns must have
// the same bindings, and we also consider the first pattern to be
// the "authoratative" set of ids
@ -741,9 +741,9 @@ impl Liveness {
pub fn find_loop_scope(&self,
opt_label: Option<ident>,
id: node_id,
id: NodeId,
sp: span)
-> node_id {
-> NodeId {
match opt_label {
Some(_) => // Refers to a labeled loop. Use the results of resolve
// to find with one
@ -765,7 +765,7 @@ impl Liveness {
}
}
pub fn last_loop_scope(&self) -> node_id {
pub fn last_loop_scope(&self) -> NodeId {
let loop_scope = &mut *self.loop_scope;
*loop_scope.last()
}
@ -1388,7 +1388,7 @@ impl Liveness {
}
pub fn with_loop_nodes<R>(&self,
loop_node_id: node_id,
loop_node_id: NodeId,
break_ln: LiveNode,
cont_ln: LiveNode,
f: &fn() -> R)
@ -1491,7 +1491,7 @@ fn check_expr(expr: @expr, (this, vt): (@Liveness, vt<@Liveness>)) {
}
fn check_fn(_fk: &visit::fn_kind, _decl: &fn_decl,
_body: &Block, _sp: span, _id: node_id,
_body: &Block, _sp: span, _id: NodeId,
(_self, _v): (@Liveness, vt<@Liveness>)) {
// do not check contents of nested fns
}
@ -1505,7 +1505,7 @@ enum ReadKind {
impl Liveness {
pub fn check_ret(&self,
id: node_id,
id: NodeId,
sp: span,
_fk: &visit::fn_kind,
entry_ln: LiveNode) {
@ -1618,7 +1618,7 @@ impl Liveness {
pub fn warn_about_unused(&self,
sp: span,
id: node_id,
id: NodeId,
ln: LiveNode,
var: Variable)
-> bool {
@ -1652,7 +1652,7 @@ impl Liveness {
pub fn warn_about_dead_assign(&self,
sp: span,
id: node_id,
id: NodeId,
ln: LiveNode,
var: Variable) {
if self.live_on_exit(ln, var).is_none() {

View file

@ -60,25 +60,25 @@ use syntax::print::pprust;
#[deriving(Eq)]
pub enum categorization {
cat_rvalue(ast::node_id), // temporary val, argument is its scope
cat_rvalue(ast::NodeId), // temporary val, argument is its scope
cat_static_item,
cat_implicit_self,
cat_copied_upvar(CopiedUpvar), // upvar copied into @fn or ~fn env
cat_stack_upvar(cmt), // by ref upvar from &fn
cat_local(ast::node_id), // local variable
cat_arg(ast::node_id), // formal argument
cat_local(ast::NodeId), // local variable
cat_arg(ast::NodeId), // formal argument
cat_deref(cmt, uint, ptr_kind), // deref of a ptr
cat_interior(cmt, InteriorKind), // something interior: field, tuple, etc
cat_downcast(cmt), // selects a particular enum variant (*)
cat_discr(cmt, ast::node_id), // match discriminant (see preserve())
cat_self(ast::node_id), // explicit `self`
cat_discr(cmt, ast::NodeId), // match discriminant (see preserve())
cat_self(ast::NodeId), // explicit `self`
// (*) downcast is only required if the enum has more than one variant
}
#[deriving(Eq)]
pub struct CopiedUpvar {
upvar_id: ast::node_id,
upvar_id: ast::NodeId,
onceness: ast::Onceness,
}
@ -136,7 +136,7 @@ pub enum MutabilityCategory {
// fashion. For more details, see the method `cat_pattern`
#[deriving(Eq)]
pub struct cmt_ {
id: ast::node_id, // id of expr/pat producing this value
id: ast::NodeId, // id of expr/pat producing this value
span: span, // span of same expr/pat
cat: categorization, // categorization of expr
mutbl: MutabilityCategory, // mutability of expr as lvalue
@ -252,7 +252,7 @@ pub fn cat_expr_autoderefd(
pub fn cat_def(
tcx: ty::ctxt,
method_map: typeck::method_map,
expr_id: ast::node_id,
expr_id: ast::NodeId,
expr_span: span,
expr_ty: ty::t,
def: ast::def) -> cmt {
@ -264,17 +264,17 @@ pub fn cat_def(
}
pub trait ast_node {
fn id(&self) -> ast::node_id;
fn id(&self) -> ast::NodeId;
fn span(&self) -> span;
}
impl ast_node for @ast::expr {
fn id(&self) -> ast::node_id { self.id }
fn id(&self) -> ast::NodeId { self.id }
fn span(&self) -> span { self.span }
}
impl ast_node for @ast::pat {
fn id(&self) -> ast::node_id { self.id }
fn id(&self) -> ast::NodeId { self.id }
fn span(&self) -> span { self.span }
}
@ -439,7 +439,7 @@ impl mem_categorization_ctxt {
}
pub fn cat_def(&self,
id: ast::node_id,
id: ast::NodeId,
span: span,
expr_ty: ty::t,
def: ast::def)
@ -587,9 +587,9 @@ impl mem_categorization_ctxt {
}
pub fn cat_rvalue(&self,
cmt_id: ast::node_id,
cmt_id: ast::NodeId,
span: span,
cleanup_scope_id: ast::node_id,
cleanup_scope_id: ast::NodeId,
expr_ty: ty::t) -> cmt {
@cmt_ {
id:cmt_id,
@ -1069,7 +1069,7 @@ impl mem_categorization_ctxt {
pub fn field_mutbl(tcx: ty::ctxt,
base_ty: ty::t,
f_name: ast::ident,
node_id: ast::node_id)
node_id: ast::NodeId)
-> Option<ast::mutability> {
// Need to refactor so that struct/enum fields can be treated uniformly.
match ty::get(base_ty).sty {

View file

@ -157,9 +157,9 @@ pub struct CaptureVar {
mode: CaptureMode // How variable is being accessed
}
pub type CaptureMap = @mut HashMap<node_id, @[CaptureVar]>;
pub type CaptureMap = @mut HashMap<NodeId, @[CaptureVar]>;
pub type MovesMap = @mut HashSet<node_id>;
pub type MovesMap = @mut HashSet<NodeId>;
/**
* Set of variable node-ids that are moved.
@ -167,7 +167,7 @@ pub type MovesMap = @mut HashSet<node_id>;
* Note: The `VariableMovesMap` stores expression ids that
* are moves, whereas this set stores the ids of the variables
* that are moved at some point */
pub type MovedVariablesSet = @mut HashSet<node_id>;
pub type MovedVariablesSet = @mut HashSet<NodeId>;
/** See the section Output on the module comment for explanation. */
#[deriving(Clone)]
@ -213,7 +213,7 @@ pub fn compute_moves(tcx: ty::ctxt,
return visit_cx.move_maps;
}
pub fn moved_variable_node_id_from_def(def: def) -> Option<node_id> {
pub fn moved_variable_node_id_from_def(def: def) -> Option<NodeId> {
match def {
def_binding(nid, _) |
def_arg(nid, _) |
@ -240,7 +240,7 @@ fn compute_modes_for_fn(fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
span: span,
id: node_id,
id: NodeId,
(cx, v): (VisitContext,
vt<VisitContext>)) {
for decl.inputs.iter().advance |a| {
@ -634,7 +634,7 @@ impl VisitContext {
}
pub fn use_fn_args(&self,
_: node_id,
_: NodeId,
arg_exprs: &[@expr],
visitor: vt<VisitContext>) {
//! Uses the argument expressions.
@ -664,7 +664,7 @@ impl VisitContext {
return None;
}
pub fn compute_captures(&self, fn_expr_id: node_id) -> @[CaptureVar] {
pub fn compute_captures(&self, fn_expr_id: NodeId) -> @[CaptureVar] {
debug!("compute_capture_vars(fn_expr_id=%?)", fn_expr_id);
let _indenter = indenter();

View file

@ -16,10 +16,10 @@ use syntax::ast::*;
use syntax::ast_util::{path_to_ident, walk_pat};
use syntax::codemap::span;
pub type PatIdMap = HashMap<ident, node_id>;
pub type PatIdMap = HashMap<ident, NodeId>;
// This is used because same-named variables in alternative patterns need to
// use the node_id of their namesake in the first pattern.
// use the NodeId of their namesake in the first pattern.
pub fn pat_id_map(dm: resolve::DefMap, pat: @pat) -> PatIdMap {
let mut map = HashMap::new();
do pat_bindings(dm, pat) |_bm, p_id, _s, n| {
@ -71,7 +71,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool {
}
pub fn pat_bindings(dm: resolve::DefMap, pat: @pat,
it: &fn(binding_mode, node_id, span, &Path)) {
it: &fn(binding_mode, NodeId, span, &Path)) {
for walk_pat(pat) |p| {
match p.node {
pat_ident(binding_mode, ref pth, _) if pat_is_binding(dm, p) => {
@ -82,7 +82,7 @@ pub fn pat_bindings(dm: resolve::DefMap, pat: @pat,
}
}
pub fn pat_binding_ids(dm: resolve::DefMap, pat: @pat) -> ~[node_id] {
pub fn pat_binding_ids(dm: resolve::DefMap, pat: @pat) -> ~[NodeId] {
let mut found = ~[];
pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| found.push(b_id) );
return found;

View file

@ -23,7 +23,7 @@ use syntax::ast::{decl_item, def, def_fn, def_id, def_static_method};
use syntax::ast::{def_variant, expr_field, expr_method_call, expr_path};
use syntax::ast::{expr_struct, expr_unary, ident, inherited, item_enum};
use syntax::ast::{item_foreign_mod, item_fn, item_impl, item_struct};
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, Path};
use syntax::ast::{item_trait, LOCAL_CRATE, NodeId, pat_struct, Path};
use syntax::ast::{private, provided, public, required, stmt_decl, visibility};
use syntax::ast;
use syntax::ast_map::{node_foreign_item, node_item, node_method};
@ -106,7 +106,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
};
// Returns true if a crate-local method is private and false otherwise.
let method_is_private: @fn(span: span, method_id: node_id) -> bool =
let method_is_private: @fn(span: span, method_id: NodeId) -> bool =
|span, method_id| {
let check = |vis: visibility, container_id: def_id| {
let mut is_private = false;
@ -116,7 +116,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
is_private = false;
} else {
// Look up the enclosing impl.
if container_id.crate != local_crate {
if container_id.crate != LOCAL_CRATE {
tcx.sess.span_bug(span,
"local method isn't in local \
impl?!");
@ -170,9 +170,9 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
};
// Returns true if the given local item is private and false otherwise.
let local_item_is_private: @fn(span: span, item_id: node_id) -> bool =
let local_item_is_private: @fn(span: span, item_id: NodeId) -> bool =
|span, item_id| {
let mut f: &fn(node_id) -> bool = |_| false;
let mut f: &fn(NodeId) -> bool = |_| false;
f = |item_id| {
match tcx.items.find(&item_id) {
Some(&node_item(item, _)) => item.vis != public,
@ -227,11 +227,11 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
let method_id = ty::method(tcx, method_id).provided_source
.get_or_default(method_id);
if method_id.crate == local_crate {
if method_id.crate == LOCAL_CRATE {
let is_private = method_is_private(span, method_id.node);
let container_id = ty::method(tcx, method_id).container_id;
if is_private &&
(container_id.crate != local_crate ||
(container_id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(container_id.node))) {
tcx.sess.span_err(span,
fmt!("method `%s` is private",
@ -258,7 +258,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
check_method_common(span, method_id, path.idents.last())
}
def_fn(def_id, _) => {
if def_id.crate == local_crate {
if def_id.crate == LOCAL_CRATE {
if local_item_is_private(span, def_id.node) &&
!privileged_items.iter().any(|x| x == &def_id.node) {
tcx.sess.span_err(span,
@ -291,7 +291,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
_
}) |
method_trait(trait_id, method_num, _) => {
if trait_id.crate == local_crate {
if trait_id.crate == LOCAL_CRATE {
match tcx.items.find(&trait_id.node) {
Some(&node_item(item, _)) => {
match item.node {
@ -386,7 +386,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
match ty::get(ty::type_autoderef(tcx, ty::expr_ty(tcx,
base))).sty {
ty_struct(id, _)
if id.crate != local_crate || !privileged_items.iter()
if id.crate != LOCAL_CRATE || !privileged_items.iter()
.any(|x| x == &(id.node)) => {
debug!("(privacy checking) checking field access");
check_field(expr.span, id, ident);
@ -399,7 +399,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
match ty::get(ty::type_autoderef(tcx, ty::expr_ty(tcx,
base))).sty {
ty_struct(id, _)
if id.crate != local_crate ||
if id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(id.node)) => {
match method_map.find(&expr.id) {
None => {
@ -423,7 +423,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
expr_struct(_, ref fields, _) => {
match ty::get(ty::expr_ty(tcx, expr)).sty {
ty_struct(id, _) => {
if id.crate != local_crate ||
if id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(id.node)) {
for (*fields).iter().advance |field| {
debug!("(privacy checking) checking \
@ -433,7 +433,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
}
}
ty_enum(id, _) => {
if id.crate != local_crate ||
if id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(id.node)) {
match tcx.def_map.get_copy(&expr.id) {
def_variant(_, variant_id) => {
@ -469,7 +469,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
// since typeck already happened.)
match ty::get(ty::expr_ty(tcx, operand)).sty {
ty_enum(id, _) => {
if id.crate != local_crate ||
if id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(id.node)) {
check_variant(expr.span, id);
}
@ -487,7 +487,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
pat_struct(_, ref fields, _) => {
match ty::get(ty::pat_ty(tcx, pattern)).sty {
ty_struct(id, _) => {
if id.crate != local_crate ||
if id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &(id.node)) {
for fields.iter().advance |field| {
debug!("(privacy checking) checking \
@ -497,7 +497,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
}
}
ty_enum(enum_id, _) => {
if enum_id.crate != local_crate ||
if enum_id.crate != LOCAL_CRATE ||
!privileged_items.iter().any(|x| x == &enum_id.node) {
match tcx.def_map.find(&pattern.id) {
Some(&def_variant(_, variant_id)) => {

View file

@ -59,7 +59,7 @@ fn item_might_be_inlined(item: @item) -> bool {
// Returns true if the given type method must be inlined because it may be
// monomorphized or it was marked with `#[inline]`.
fn ty_method_might_be_inlined(ty_method: &ty_method) -> bool {
fn ty_method_might_be_inlined(ty_method: &TypeMethod) -> bool {
attributes_specify_inlining(ty_method.attrs) ||
generics_require_inlining(&ty_method.generics)
}
@ -90,10 +90,10 @@ struct ReachableContext {
// methods they've been resolved to.
method_map: typeck::method_map,
// The set of items which must be exported in the linkage sense.
reachable_symbols: @mut HashSet<node_id>,
reachable_symbols: @mut HashSet<NodeId>,
// A worklist of item IDs. Each item ID in this worklist will be inlined
// and will be scanned for further references.
worklist: @mut ~[node_id],
worklist: @mut ~[NodeId],
}
impl ReachableContext {
@ -216,7 +216,7 @@ impl ReachableContext {
// eligible for inlining and false otherwise.
fn def_id_represents_local_inlined_item(tcx: ty::ctxt, def_id: def_id)
-> bool {
if def_id.crate != local_crate {
if def_id.crate != LOCAL_CRATE {
return false
}
@ -241,7 +241,7 @@ impl ReachableContext {
} else {
// Check the impl. If the generics on the self type of the
// impl require inlining, this method does too.
assert!(impl_did.crate == local_crate);
assert!(impl_did.crate == LOCAL_CRATE);
match tcx.items.find(&impl_did.node) {
Some(&ast_map::node_item(item, _)) => {
match item.node {
@ -394,7 +394,7 @@ impl ReachableContext {
fn mark_destructors_reachable(&self) {
for self.tcx.destructor_for_type.iter().advance
|(_, destructor_def_id)| {
if destructor_def_id.crate == local_crate {
if destructor_def_id.crate == LOCAL_CRATE {
self.reachable_symbols.insert(destructor_def_id.node);
}
}
@ -404,7 +404,7 @@ impl ReachableContext {
pub fn find_reachable(tcx: ty::ctxt,
method_map: typeck::method_map,
crate: @Crate)
-> @mut HashSet<node_id> {
-> @mut HashSet<NodeId> {
// XXX(pcwalton): We only need to mark symbols that are exported. But this
// is more complicated than just looking at whether the symbol is `pub`,
// because it might be the target of a `pub use` somewhere. For now, I

View file

@ -55,9 +55,9 @@ The region maps encode information about region relationships.
necessarily how I think things ought to work
*/
pub struct RegionMaps {
priv scope_map: HashMap<ast::node_id, ast::node_id>,
priv scope_map: HashMap<ast::NodeId, ast::NodeId>,
priv free_region_map: HashMap<FreeRegion, ~[FreeRegion]>,
priv cleanup_scopes: HashSet<ast::node_id>
priv cleanup_scopes: HashSet<ast::NodeId>
}
#[deriving(Clone)]
@ -69,10 +69,10 @@ pub struct Context {
region_maps: @mut RegionMaps,
// Scope where variables should be parented to
var_parent: Option<ast::node_id>,
var_parent: Option<ast::NodeId>,
// Innermost enclosing expression
parent: Option<ast::node_id>,
parent: Option<ast::NodeId>,
}
impl RegionMaps {
@ -92,14 +92,14 @@ impl RegionMaps {
self.free_region_map.insert(sub, ~[sup]);
}
pub fn record_parent(&mut self, sub: ast::node_id, sup: ast::node_id) {
pub fn record_parent(&mut self, sub: ast::NodeId, sup: ast::NodeId) {
debug!("record_parent(sub=%?, sup=%?)", sub, sup);
assert!(sub != sup);
self.scope_map.insert(sub, sup);
}
pub fn record_cleanup_scope(&mut self, scope_id: ast::node_id) {
pub fn record_cleanup_scope(&mut self, scope_id: ast::NodeId) {
//! Records that a scope is a CLEANUP SCOPE. This is invoked
//! from within regionck. We wait until regionck because we do
//! not know which operators are overloaded until that point,
@ -108,13 +108,13 @@ impl RegionMaps {
self.cleanup_scopes.insert(scope_id);
}
pub fn opt_encl_scope(&self, id: ast::node_id) -> Option<ast::node_id> {
pub fn opt_encl_scope(&self, id: ast::NodeId) -> Option<ast::NodeId> {
//! Returns the narrowest scope that encloses `id`, if any.
self.scope_map.find(&id).map(|&x| *x)
}
pub fn encl_scope(&self, id: ast::node_id) -> ast::node_id {
pub fn encl_scope(&self, id: ast::NodeId) -> ast::NodeId {
//! Returns the narrowest scope that encloses `id`, if any.
match self.scope_map.find(&id) {
@ -123,11 +123,11 @@ impl RegionMaps {
}
}
pub fn is_cleanup_scope(&self, scope_id: ast::node_id) -> bool {
pub fn is_cleanup_scope(&self, scope_id: ast::NodeId) -> bool {
self.cleanup_scopes.contains(&scope_id)
}
pub fn cleanup_scope(&self, expr_id: ast::node_id) -> ast::node_id {
pub fn cleanup_scope(&self, expr_id: ast::NodeId) -> ast::NodeId {
//! Returns the scope when temps in expr will be cleaned up
let mut id = self.encl_scope(expr_id);
@ -137,21 +137,21 @@ impl RegionMaps {
return id;
}
pub fn encl_region(&self, id: ast::node_id) -> ty::Region {
pub fn encl_region(&self, id: ast::NodeId) -> ty::Region {
//! Returns the narrowest scope region that encloses `id`, if any.
ty::re_scope(self.encl_scope(id))
}
pub fn scopes_intersect(&self, scope1: ast::node_id, scope2: ast::node_id)
pub fn scopes_intersect(&self, scope1: ast::NodeId, scope2: ast::NodeId)
-> bool {
self.is_subscope_of(scope1, scope2) ||
self.is_subscope_of(scope2, scope1)
}
pub fn is_subscope_of(&self,
subscope: ast::node_id,
superscope: ast::node_id)
subscope: ast::NodeId,
superscope: ast::NodeId)
-> bool {
/*!
* Returns true if `subscope` is equal to or is lexically
@ -254,9 +254,9 @@ impl RegionMaps {
}
pub fn nearest_common_ancestor(&self,
scope_a: ast::node_id,
scope_b: ast::node_id)
-> Option<ast::node_id> {
scope_a: ast::NodeId,
scope_b: ast::NodeId)
-> Option<ast::NodeId> {
/*!
* Finds the nearest common ancestor (if any) of two scopes. That
* is, finds the smallest scope which is greater than or equal to
@ -294,8 +294,8 @@ impl RegionMaps {
}
}
fn ancestors_of(this: &RegionMaps, scope: ast::node_id)
-> ~[ast::node_id]
fn ancestors_of(this: &RegionMaps, scope: ast::NodeId)
-> ~[ast::NodeId]
{
// debug!("ancestors_of(scope=%d)", scope);
let mut result = ~[scope];
@ -315,7 +315,7 @@ impl RegionMaps {
}
/// Records the current parent (if any) as the parent of `child_id`.
fn parent_to_expr(cx: Context, child_id: ast::node_id, sp: span) {
fn parent_to_expr(cx: Context, child_id: ast::NodeId, sp: span) {
debug!("region::parent_to_expr(span=%?)",
cx.sess.codemap.span_to_str(sp));
for cx.parent.iter().advance |parent_id| {
@ -416,7 +416,7 @@ fn resolve_fn(fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
id: ast::node_id,
id: ast::NodeId,
(cx, visitor): (Context,
visit::vt<Context>)) {
debug!("region::resolve_fn(id=%?, \
@ -503,12 +503,12 @@ pub fn resolve_crate(sess: Session,
// a worklist. We can then process the worklist, propagating indirect
// dependencies until a fixed point is reached.
pub type region_paramd_items = @mut HashMap<ast::node_id, region_variance>;
pub type region_paramd_items = @mut HashMap<ast::NodeId, region_variance>;
#[deriving(Eq)]
pub struct region_dep {
ambient_variance: region_variance,
id: ast::node_id
id: ast::NodeId
}
pub struct DetermineRpCtxt {
@ -516,11 +516,11 @@ pub struct DetermineRpCtxt {
ast_map: ast_map::map,
def_map: resolve::DefMap,
region_paramd_items: region_paramd_items,
dep_map: @mut HashMap<ast::node_id, @mut ~[region_dep]>,
worklist: ~[ast::node_id],
dep_map: @mut HashMap<ast::NodeId, @mut ~[region_dep]>,
worklist: ~[ast::NodeId],
// the innermost enclosing item id
item_id: ast::node_id,
item_id: ast::NodeId,
// true when we are within an item but not within a method.
// see long discussion on region_is_relevant().
@ -572,7 +572,7 @@ impl DetermineRpCtxt {
/// Records that item `id` is region-parameterized with the
/// variance `variance`. If `id` was already parameterized, then
/// the new variance is joined with the old variance.
pub fn add_rp(&mut self, id: ast::node_id, variance: region_variance) {
pub fn add_rp(&mut self, id: ast::NodeId, variance: region_variance) {
assert!(id != 0);
let old_variance = self.region_paramd_items.find(&id).
map_consume(|x| *x);
@ -598,7 +598,7 @@ impl DetermineRpCtxt {
/// `from`. Put another way, it indicates that the current item
/// contains a value of type `from`, so if `from` is
/// region-parameterized, so is the current item.
pub fn add_dep(&mut self, from: ast::node_id) {
pub fn add_dep(&mut self, from: ast::NodeId) {
debug!("add dependency from %d -> %d (%s -> %s) with variance %?",
from, self.item_id,
ast_map::node_id_to_str(self.ast_map, from,
@ -670,7 +670,7 @@ impl DetermineRpCtxt {
}
pub fn with(@mut self,
item_id: ast::node_id,
item_id: ast::NodeId,
anon_implies_rp: bool,
f: &fn()) {
let old_item_id = self.item_id;
@ -708,7 +708,7 @@ fn determine_rp_in_fn(fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
_: span,
_: ast::node_id,
_: ast::NodeId,
(cx, visitor): (@mut DetermineRpCtxt,
visit::vt<@mut DetermineRpCtxt>)) {
do cx.with(cx.item_id, false) {
@ -724,7 +724,7 @@ fn determine_rp_in_fn(fk: &visit::fn_kind,
}
}
fn determine_rp_in_ty_method(ty_m: &ast::ty_method,
fn determine_rp_in_ty_method(ty_m: &ast::TypeMethod,
(cx, visitor): (@mut DetermineRpCtxt,
visit::vt<@mut DetermineRpCtxt>)) {
do cx.with(cx.item_id, false) {
@ -790,7 +790,7 @@ fn determine_rp_in_ty(ty: &ast::Ty,
Some(&ast::def_ty(did)) |
Some(&ast::def_trait(did)) |
Some(&ast::def_struct(did)) => {
if did.crate == ast::local_crate {
if did.crate == ast::LOCAL_CRATE {
if cx.region_is_relevant(&path.rp) {
cx.add_dep(did.node);
}

View file

@ -45,7 +45,7 @@ use std::hashmap::{HashMap, HashSet};
use std::util;
// Definition mapping
pub type DefMap = @mut HashMap<node_id,def>;
pub type DefMap = @mut HashMap<NodeId,def>;
pub struct binding_info {
span: span,
@ -56,11 +56,11 @@ pub struct binding_info {
pub type BindingMap = HashMap<ident,binding_info>;
// Trait method resolution
pub type TraitMap = HashMap<node_id,@mut ~[def_id]>;
pub type TraitMap = HashMap<NodeId,@mut ~[def_id]>;
// This is the replacement export map. It maps a module to all of the exports
// within.
pub type ExportMap2 = @mut HashMap<node_id, ~[Export2]>;
pub type ExportMap2 = @mut HashMap<NodeId, ~[Export2]>;
pub struct Export2 {
name: @str, // The name of the target.
@ -128,7 +128,7 @@ pub enum Mutability {
pub enum SelfBinding {
NoSelfBinding,
HasSelfBinding(node_id, bool /* is implicit */)
HasSelfBinding(NodeId, bool /* is implicit */)
}
pub type ResolveVisitor = vt<()>;
@ -163,7 +163,7 @@ impl<T> ResolveResult<T> {
pub enum TypeParameters<'self> {
NoTypeParameters, //< No type parameters.
HasTypeParameters(&'self Generics, //< Type parameters.
node_id, //< ID of the enclosing item
NodeId, //< ID of the enclosing item
// The index to start numbering the type parameters at.
// This is zero if this is the outermost set of type
@ -191,14 +191,14 @@ pub enum RibKind {
// We passed through a function scope at the given node ID. Translate
// upvars as appropriate.
FunctionRibKind(node_id /* func id */, node_id /* body id */),
FunctionRibKind(NodeId /* func id */, NodeId /* body id */),
// We passed through an impl or trait and are now in one of its
// methods. Allow references to ty params that impl or trait
// binds. Disallow any other upvars (including other ty params that are
// upvars).
// parent; method itself
MethodRibKind(node_id, MethodSort),
MethodRibKind(NodeId, MethodSort),
// We passed through a function *item* scope. Disallow upvars.
OpaqueFunctionRibKind,
@ -210,7 +210,7 @@ pub enum RibKind {
// Methods can be required or provided. Required methods only occur in traits.
pub enum MethodSort {
Required,
Provided(node_id)
Provided(NodeId)
}
// The X-ray flag indicates that a context has the X-ray privilege, which
@ -304,14 +304,14 @@ pub struct ImportDirective {
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
id: node_id,
id: NodeId,
}
pub fn ImportDirective(privacy: Privacy,
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
id: node_id)
id: NodeId)
-> ImportDirective {
ImportDirective {
privacy: privacy,
@ -352,17 +352,17 @@ pub struct ImportResolution {
value_target: Option<Target>,
/// The source node of the `use` directive leading to the value target
/// being non-none
value_id: node_id,
value_id: NodeId,
/// The type that this `use` directive names, if there is one.
type_target: Option<Target>,
/// The source node of the `use` directive leading to the type target
/// being non-none
type_id: node_id,
type_id: NodeId,
}
pub fn ImportResolution(privacy: Privacy,
id: node_id) -> ImportResolution {
id: NodeId) -> ImportResolution {
ImportResolution {
privacy: privacy,
type_id: id,
@ -382,7 +382,7 @@ impl ImportResolution {
}
}
fn id(&self, namespace: Namespace) -> node_id {
fn id(&self, namespace: Namespace) -> NodeId {
match namespace {
TypeNS => self.type_id,
ValueNS => self.value_id,
@ -394,7 +394,7 @@ impl ImportResolution {
pub enum ParentLink {
NoParentLink,
ModuleParentLink(@mut Module, ident),
BlockParentLink(@mut Module, node_id)
BlockParentLink(@mut Module, NodeId)
}
/// The type of module this is.
@ -434,7 +434,7 @@ pub struct Module {
//
// There will be an anonymous module created around `g` with the ID of the
// entry block for `f`.
anonymous_children: @mut HashMap<node_id,@mut Module>,
anonymous_children: @mut HashMap<NodeId,@mut Module>,
// The status of resolving each import in this module.
import_resolutions: @mut HashMap<ident, @mut ImportResolution>,
@ -868,7 +868,7 @@ pub struct Resolver {
export_map2: ExportMap2,
trait_map: TraitMap,
used_imports: HashSet<node_id>,
used_imports: HashSet<NodeId>,
}
impl Resolver {
@ -1903,7 +1903,7 @@ impl Resolver {
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
id: node_id) {
id: NodeId) {
let directive = @ImportDirective(privacy, module_path,
subclass, span, id);
module_.imports.push(directive);
@ -2428,7 +2428,7 @@ impl Resolver {
privacy: Privacy,
module_: @mut Module,
containing_module: @mut Module,
id: node_id)
id: NodeId)
-> ResolveResult<()> {
// This function works in a highly imperative manner; it eagerly adds
// everything it can to the list of import resolutions of the module
@ -3145,7 +3145,7 @@ impl Resolver {
// exports for nonlocal crates.
match module_.def_id {
Some(def_id) if def_id.crate == local_crate => {
Some(def_id) if def_id.crate == LOCAL_CRATE => {
// OK. Continue.
debug!("(recording exports for module subtree) recording \
exports for local module `%s`",
@ -3791,7 +3791,7 @@ impl Resolver {
}
pub fn resolve_type_parameter_bound(@mut self,
id: node_id,
id: NodeId,
type_parameter_bound: &TyParamBound,
visitor: ResolveVisitor) {
match *type_parameter_bound {
@ -3803,7 +3803,7 @@ impl Resolver {
}
pub fn resolve_trait_reference(@mut self,
id: node_id,
id: NodeId,
trait_reference: &trait_ref,
visitor: ResolveVisitor,
reference_type: TraitReferenceType) {
@ -3828,7 +3828,7 @@ impl Resolver {
}
pub fn resolve_struct(@mut self,
id: node_id,
id: NodeId,
generics: &Generics,
fields: &[@struct_field],
visitor: ResolveVisitor) {
@ -3896,7 +3896,7 @@ impl Resolver {
}
pub fn resolve_implementation(@mut self,
id: node_id,
id: NodeId,
generics: &Generics,
opt_trait_reference: &Option<trait_ref>,
self_type: &Ty,
@ -3976,7 +3976,7 @@ impl Resolver {
module_: &_mod,
span: span,
_name: ident,
id: node_id,
id: NodeId,
visitor: ResolveVisitor) {
// Write the implementations in scope into the module metadata.
debug!("(resolving module) resolving module ID %d", id);
@ -4192,7 +4192,7 @@ impl Resolver {
mutability: Mutability,
// Maps idents to the node ID for the (outermost)
// pattern that binds them
bindings_list: Option<@mut HashMap<ident,node_id>>,
bindings_list: Option<@mut HashMap<ident,NodeId>>,
visitor: ResolveVisitor) {
let pat_id = pattern.id;
for walk_pat(pattern) |pattern| {
@ -4470,7 +4470,7 @@ impl Resolver {
/// If `check_ribs` is true, checks the local definitions first; i.e.
/// doesn't skip straight to the containing module.
pub fn resolve_path(@mut self,
id: node_id,
id: NodeId,
path: &Path,
namespace: Namespace,
check_ribs: bool,
@ -5250,7 +5250,7 @@ impl Resolver {
}
pub fn add_fixed_trait_for_expr(@mut self,
expr_id: node_id,
expr_id: NodeId,
trait_id: Option<def_id>) {
match trait_id {
Some(trait_id) => {
@ -5260,7 +5260,7 @@ impl Resolver {
}
}
pub fn record_def(@mut self, node_id: node_id, def: def) {
pub fn record_def(@mut self, node_id: NodeId, def: def) {
debug!("(recording def) recording %? for %?", def, node_id);
self.def_map.insert(node_id, def);
}

View file

@ -184,7 +184,7 @@ use syntax::print::pprust::pat_to_str;
// An option identifying a literal: either a unit-like struct or an
// expression.
pub enum Lit {
UnitLikeStructLit(ast::node_id), // the node ID of the pattern
UnitLikeStructLit(ast::NodeId), // the node ID of the pattern
ExprLit(@ast::expr),
ConstLit(ast::def_id), // the def ID of the constant
}
@ -292,7 +292,7 @@ pub fn trans_opt(bcx: @mut Block, o: &Opt) -> opt_result {
}
}
pub fn variant_opt(bcx: @mut Block, pat_id: ast::node_id)
pub fn variant_opt(bcx: @mut Block, pat_id: ast::NodeId)
-> Opt {
let ccx = bcx.ccx();
match ccx.tcx.def_map.get_copy(&pat_id) {
@ -334,7 +334,7 @@ pub enum TransBindingMode {
pub struct BindingInfo {
llmatch: ValueRef,
trmode: TransBindingMode,
id: ast::node_id,
id: ast::NodeId,
ty: ty::t,
}
@ -885,7 +885,7 @@ pub fn extract_variant_args(bcx: @mut Block,
ExtractedBlock { vals: args, bcx: bcx }
}
fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::node_id) -> Datum {
fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::NodeId) -> Datum {
//! Helper for converting from the ValueRef that we pass around in
//! the match code, which is always by ref, into a Datum. Eventually
//! we should just pass around a Datum and be done with it.
@ -897,7 +897,7 @@ fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::node_id) -> Datum {
pub fn extract_vec_elems(bcx: @mut Block,
pat_span: span,
pat_id: ast::node_id,
pat_id: ast::NodeId,
elem_count: uint,
slice: Option<uint>,
val: ValueRef,
@ -1871,7 +1871,7 @@ pub fn store_arg(mut bcx: @mut Block,
}
fn mk_binding_alloca(mut bcx: @mut Block,
p_id: ast::node_id,
p_id: ast::NodeId,
path: &ast::Path,
binding_mode: IrrefutablePatternBindingMode,
populate: &fn(@mut Block, ty::t, ValueRef) -> @mut Block) -> @mut Block {

View file

@ -106,7 +106,7 @@ pub struct Struct {
* these, for places in trans where the `ty::t` isn't directly
* available.
*/
pub fn represent_node(bcx: @mut Block, node: ast::node_id) -> @Repr {
pub fn represent_node(bcx: @mut Block, node: ast::NodeId) -> @Repr {
represent_type(bcx.ccx(), node_id_type(bcx, node))
}

View file

@ -509,12 +509,12 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
-> ValueRef {
let _icx = push_ctxt("trans_res_dtor");
if !substs.is_empty() {
let did = if did.crate != ast::local_crate {
let did = if did.crate != ast::LOCAL_CRATE {
inline::maybe_instantiate_inline(ccx, did)
} else {
did
};
assert_eq!(did.crate, ast::local_crate);
assert_eq!(did.crate, ast::LOCAL_CRATE);
let tsubsts = ty::substs {regions: ty::ErasedRegions,
self_ty: None,
tps: /*bad*/ substs.to_owned() };
@ -526,7 +526,7 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
None);
val
} else if did.crate == ast::local_crate {
} else if did.crate == ast::LOCAL_CRATE {
get_item_val(ccx, did.node)
} else {
let tcx = ccx.tcx;
@ -1012,7 +1012,7 @@ pub fn get_landing_pad(bcx: @mut Block) -> BasicBlockRef {
return pad_bcx.llbb;
}
pub fn find_bcx_for_scope(bcx: @mut Block, scope_id: ast::node_id) -> @mut Block {
pub fn find_bcx_for_scope(bcx: @mut Block, scope_id: ast::NodeId) -> @mut Block {
let mut bcx_sid = bcx;
let mut cur_scope = bcx_sid.scope;
loop {
@ -1617,7 +1617,7 @@ pub fn make_return_pointer(fcx: @mut FunctionContext, output_type: ty::t) -> Val
pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext,
path: path,
llfndecl: ValueRef,
id: ast::node_id,
id: ast::NodeId,
output_type: ty::t,
skip_retptr: bool,
param_substs: Option<@param_substs>,
@ -1838,7 +1838,7 @@ pub fn trans_closure(ccx: @mut CrateContext,
llfndecl: ValueRef,
self_arg: self_arg,
param_substs: Option<@param_substs>,
id: ast::node_id,
id: ast::NodeId,
attributes: &[ast::Attribute],
output_type: ty::t,
maybe_load_env: &fn(@mut FunctionContext),
@ -1919,7 +1919,7 @@ pub fn trans_fn(ccx: @mut CrateContext,
llfndecl: ValueRef,
self_arg: self_arg,
param_substs: Option<@param_substs>,
id: ast::node_id,
id: ast::NodeId,
attrs: &[ast::Attribute]) {
let the_path_str = path_str(ccx.sess, path);
@ -1976,7 +1976,7 @@ fn insert_synthetic_type_entries(bcx: @mut Block,
}
pub fn trans_enum_variant(ccx: @mut CrateContext,
_enum_id: ast::node_id,
_enum_id: ast::NodeId,
variant: &ast::variant,
args: &[ast::variant_arg],
disr: uint,
@ -1995,7 +1995,7 @@ pub fn trans_enum_variant(ccx: @mut CrateContext,
pub fn trans_tuple_struct(ccx: @mut CrateContext,
fields: &[@ast::struct_field],
ctor_id: ast::node_id,
ctor_id: ast::NodeId,
param_substs: Option<@param_substs>,
llfndecl: ValueRef) {
let _icx = push_ctxt("trans_tuple_struct");
@ -2010,23 +2010,23 @@ pub fn trans_tuple_struct(ccx: @mut CrateContext,
}
trait IdAndTy {
fn id(&self) -> ast::node_id;
fn id(&self) -> ast::NodeId;
fn ty<'a>(&'a self) -> &'a ast::Ty;
}
impl IdAndTy for ast::variant_arg {
fn id(&self) -> ast::node_id { self.id }
fn id(&self) -> ast::NodeId { self.id }
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.ty }
}
impl IdAndTy for @ast::struct_field {
fn id(&self) -> ast::node_id { self.node.id }
fn id(&self) -> ast::NodeId { self.node.id }
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.node.ty }
}
pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
ccx: @mut CrateContext,
ctor_id: ast::node_id,
ctor_id: ast::NodeId,
args: &[A],
disr: uint,
param_substs: Option<@param_substs>,
@ -2104,7 +2104,7 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
}
pub fn trans_enum_def(ccx: @mut CrateContext, enum_definition: &ast::enum_def,
id: ast::node_id, vi: @~[@ty::VariantInfo],
id: ast::NodeId, vi: @~[@ty::VariantInfo],
i: &mut uint) {
for enum_definition.variants.iter().advance |variant| {
let disr_val = vi[*i].disr_val;
@ -2245,7 +2245,7 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
pub fn register_fn(ccx: @mut CrateContext,
sp: span,
sym: ~str,
node_id: ast::node_id)
node_id: ast::NodeId)
-> ValueRef {
let t = ty::node_id_to_type(ccx.tcx, node_id);
register_fn_full(ccx, sp, sym, node_id, t)
@ -2254,7 +2254,7 @@ pub fn register_fn(ccx: @mut CrateContext,
pub fn register_fn_full(ccx: @mut CrateContext,
sp: span,
sym: ~str,
node_id: ast::node_id,
node_id: ast::NodeId,
node_type: ty::t)
-> ValueRef {
let llfty = type_of_fn_from_ty(ccx, node_type);
@ -2265,7 +2265,7 @@ pub fn register_fn_full(ccx: @mut CrateContext,
pub fn register_fn_fuller(ccx: @mut CrateContext,
sp: span,
sym: ~str,
node_id: ast::node_id,
node_id: ast::NodeId,
node_type: ty::t,
cc: lib::llvm::CallConv,
fn_ty: Type)
@ -2287,7 +2287,7 @@ pub fn register_fn_fuller(ccx: @mut CrateContext,
llfn
}
pub fn is_entry_fn(sess: &Session, node_id: ast::node_id) -> bool {
pub fn is_entry_fn(sess: &Session, node_id: ast::NodeId) -> bool {
match *sess.entry_fn {
Some((entry_id, _)) => node_id == entry_id,
None => false
@ -2367,7 +2367,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
Ok(id) => id,
Err(s) => { ccx.tcx.sess.fatal(s); }
};
let start_fn = if start_def_id.crate == ast::local_crate {
let start_fn = if start_def_id.crate == ast::LOCAL_CRATE {
get_item_val(ccx, start_def_id.node)
} else {
let start_fn_type = csearch::get_type(ccx.tcx,
@ -2421,7 +2421,7 @@ pub fn fill_fn_pair(bcx: @mut Block, pair: ValueRef, llfn: ValueRef,
Store(bcx, llenvblobptr, env_cell);
}
pub fn item_path(ccx: &CrateContext, id: &ast::node_id) -> path {
pub fn item_path(ccx: &CrateContext, id: &ast::NodeId) -> path {
match ccx.tcx.items.get_copy(id) {
ast_map::node_item(i, p) =>
vec::append((*p).clone(), [path_name(i.ident)]),
@ -2438,7 +2438,7 @@ fn exported_name(ccx: @mut CrateContext, path: path, ty: ty::t, attrs: &[ast::At
}
}
pub fn get_item_val(ccx: @mut CrateContext, id: ast::node_id) -> ValueRef {
pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
debug!("get_item_val(id=`%?`)", id);
let val = ccx.item_vals.find_copy(&id);
@ -2601,7 +2601,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::node_id) -> ValueRef {
}
pub fn register_method(ccx: @mut CrateContext,
id: ast::node_id,
id: ast::NodeId,
path: @ast_map::path,
m: @ast::method) -> ValueRef {
let mty = ty::node_id_to_type(ccx.tcx, id);
@ -2623,7 +2623,7 @@ pub fn trans_constant(ccx: &mut CrateContext, it: @ast::item) {
match it.node {
ast::item_enum(ref enum_definition, _) => {
let vi = ty::enum_variants(ccx.tcx,
ast::def_id { crate: ast::local_crate,
ast::def_id { crate: ast::LOCAL_CRATE,
node: it.id });
let mut i = 0;
let path = item_path(ccx, &it.id);
@ -2870,7 +2870,7 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
let llannihilatefn = match ccx.tcx.lang_items.annihilate_fn() {
Some(annihilate_def_id) => {
if annihilate_def_id.crate == ast::local_crate {
if annihilate_def_id.crate == ast::LOCAL_CRATE {
get_item_val(ccx, annihilate_def_id.node)
} else {
let annihilate_fn_type = csearch::get_type(ccx.tcx,

View file

@ -157,14 +157,14 @@ pub fn trans(bcx: @mut Block, expr: @ast::expr) -> Callee {
pub fn trans_fn_ref_to_callee(bcx: @mut Block,
def_id: ast::def_id,
ref_id: ast::node_id) -> Callee {
ref_id: ast::NodeId) -> Callee {
Callee {bcx: bcx,
data: Fn(trans_fn_ref(bcx, def_id, ref_id))}
}
pub fn trans_fn_ref(bcx: @mut Block,
def_id: ast::def_id,
ref_id: ast::node_id) -> FnData {
ref_id: ast::NodeId) -> FnData {
/*!
*
* Translates a reference (with id `ref_id`) to the fn/method
@ -184,7 +184,7 @@ pub fn trans_fn_ref(bcx: @mut Block,
pub fn trans_fn_ref_with_vtables_to_callee(
bcx: @mut Block,
def_id: ast::def_id,
ref_id: ast::node_id,
ref_id: ast::NodeId,
type_params: &[ty::t],
vtables: Option<typeck::vtable_res>)
-> Callee {
@ -238,7 +238,7 @@ fn resolve_default_method_vtables(bcx: @mut Block,
pub fn trans_fn_ref_with_vtables(
bcx: @mut Block, //
def_id: ast::def_id, // def id of fn
ref_id: ast::node_id, // node id of use of fn; may be zero if N/A
ref_id: ast::NodeId, // node id of use of fn; may be zero if N/A
type_params: &[ty::t], // values for fn's ty params
vtables: Option<typeck::vtable_res>) // vtables for the call
-> FnData {
@ -334,7 +334,7 @@ pub fn trans_fn_ref_with_vtables(
// Check whether this fn has an inlined copy and, if so, redirect
// def_id to the local id of the inlined copy.
let def_id = {
if def_id.crate != ast::local_crate {
if def_id.crate != ast::LOCAL_CRATE {
inline::maybe_instantiate_inline(ccx, def_id)
} else {
def_id
@ -348,7 +348,7 @@ pub fn trans_fn_ref_with_vtables(
let must_monomorphise;
if type_params.len() > 0 || is_default {
must_monomorphise = true;
} else if def_id.crate == ast::local_crate {
} else if def_id.crate == ast::LOCAL_CRATE {
let map_node = session::expect(
ccx.sess,
ccx.tcx.items.find(&def_id.node),
@ -369,7 +369,7 @@ pub fn trans_fn_ref_with_vtables(
// Create a monomorphic verison of generic functions
if must_monomorphise {
// Should be either intra-crate or inlined.
assert_eq!(def_id.crate, ast::local_crate);
assert_eq!(def_id.crate, ast::LOCAL_CRATE);
let (val, must_cast) =
monomorphize::monomorphic_fn(ccx, def_id, &substs,
@ -389,7 +389,7 @@ pub fn trans_fn_ref_with_vtables(
// Find the actual function pointer.
let val = {
if def_id.crate == ast::local_crate {
if def_id.crate == ast::LOCAL_CRATE {
// Internal reference.
get_item_val(ccx, def_id.node)
} else {
@ -408,7 +408,7 @@ pub fn trans_call(in_cx: @mut Block,
call_ex: @ast::expr,
f: @ast::expr,
args: CallArgs,
id: ast::node_id,
id: ast::NodeId,
dest: expr::Dest)
-> @mut Block {
let _icx = push_ctxt("trans_call");
@ -424,7 +424,7 @@ pub fn trans_call(in_cx: @mut Block,
pub fn trans_method_call(in_cx: @mut Block,
call_ex: @ast::expr,
callee_id: ast::node_id,
callee_id: ast::NodeId,
rcvr: @ast::expr,
args: CallArgs,
dest: expr::Dest)
@ -465,7 +465,7 @@ pub fn trans_lang_call(bcx: @mut Block,
args: &[ValueRef],
dest: Option<expr::Dest>)
-> Result {
let fty = if did.crate == ast::local_crate {
let fty = if did.crate == ast::LOCAL_CRATE {
ty::node_id_to_type(bcx.ccx().tcx, did.node)
} else {
csearch::get_type(bcx.ccx().tcx, did).ty
@ -494,7 +494,7 @@ pub fn trans_lang_call_with_type_params(bcx: @mut Block,
dest: expr::Dest)
-> @mut Block {
let fty;
if did.crate == ast::local_crate {
if did.crate == ast::LOCAL_CRATE {
fty = ty::node_id_to_type(bcx.tcx(), did.node);
} else {
fty = csearch::get_type(bcx.tcx(), did).ty;

View file

@ -359,8 +359,8 @@ pub fn trans_expr_fn(bcx: @mut Block,
sigil: ast::Sigil,
decl: &ast::fn_decl,
body: &ast::Block,
outer_id: ast::node_id,
user_id: ast::node_id,
outer_id: ast::NodeId,
user_id: ast::NodeId,
is_loop_body: Option<Option<ValueRef>>,
dest: expr::Dest) -> @mut Block {
/*!

View file

@ -203,16 +203,16 @@ pub struct FunctionContext {
has_immediate_return_value: bool,
// Maps arguments to allocas created for them in llallocas.
llargs: @mut HashMap<ast::node_id, ValueRef>,
llargs: @mut HashMap<ast::NodeId, ValueRef>,
// Maps the def_ids for local variables to the allocas created for
// them in llallocas.
lllocals: @mut HashMap<ast::node_id, ValueRef>,
lllocals: @mut HashMap<ast::NodeId, ValueRef>,
// Same as above, but for closure upvars
llupvars: @mut HashMap<ast::node_id, ValueRef>,
llupvars: @mut HashMap<ast::NodeId, ValueRef>,
// The node_id of the function, or -1 if it doesn't correspond to
// The NodeId of the function, or -1 if it doesn't correspond to
// a user-defined function.
id: ast::node_id,
id: ast::NodeId,
// If this function is being monomorphized, this contains the type
// substitutions used.
@ -361,13 +361,13 @@ pub fn add_clean_temp_mem(bcx: @mut Block, val: ValueRef, t: ty::t) {
}
pub fn add_clean_temp_mem_in_scope(bcx: @mut Block,
scope_id: ast::node_id,
scope_id: ast::NodeId,
val: ValueRef,
t: ty::t) {
add_clean_temp_mem_in_scope_(bcx, Some(scope_id), val, t);
}
pub fn add_clean_temp_mem_in_scope_(bcx: @mut Block, scope_id: Option<ast::node_id>,
pub fn add_clean_temp_mem_in_scope_(bcx: @mut Block, scope_id: Option<ast::NodeId>,
val: ValueRef, t: ty::t) {
if !ty::type_needs_drop(bcx.tcx(), t) { return; }
debug!("add_clean_temp_mem(%s, %s, %s)",
@ -380,7 +380,7 @@ pub fn add_clean_temp_mem_in_scope_(bcx: @mut Block, scope_id: Option<ast::node_
}
}
pub fn add_clean_return_to_mut(bcx: @mut Block,
scope_id: ast::node_id,
scope_id: ast::NodeId,
root_key: root_map_key,
frozen_val_ref: ValueRef,
bits_val_ref: ValueRef,
@ -504,8 +504,8 @@ impl get_node_info for Option<@ast::expr> {
}
pub struct NodeInfo {
id: ast::node_id,
callee_id: Option<ast::node_id>,
id: ast::NodeId,
callee_id: Option<ast::NodeId>,
span: span
}
@ -563,7 +563,7 @@ impl Block {
token::ident_to_str(&ident)
}
pub fn node_id_to_str(&self, id: ast::node_id) -> ~str {
pub fn node_id_to_str(&self, id: ast::NodeId) -> ~str {
ast_map::node_id_to_str(self.tcx().items, id, self.sess().intr())
}
@ -579,7 +579,7 @@ impl Block {
ty::expr_kind(self.tcx(), self.ccx().maps.method_map, e)
}
pub fn def(&self, nid: ast::node_id) -> ast::def {
pub fn def(&self, nid: ast::NodeId) -> ast::def {
match self.tcx().def_map.find(&nid) {
Some(&v) => v,
None => {
@ -633,7 +633,7 @@ pub fn val_ty(v: ValueRef) -> Type {
}
}
pub fn in_scope_cx(cx: @mut Block, scope_id: Option<ast::node_id>, f: &fn(si: &mut ScopeInfo)) {
pub fn in_scope_cx(cx: @mut Block, scope_id: Option<ast::NodeId>, f: &fn(si: &mut ScopeInfo)) {
let mut cur = cx;
let mut cur_scope = cur.scope;
loop {
@ -971,7 +971,7 @@ pub fn monomorphize_type(bcx: @mut Block, t: ty::t) -> ty::t {
}
}
pub fn node_id_type(bcx: @mut Block, id: ast::node_id) -> ty::t {
pub fn node_id_type(bcx: @mut Block, id: ast::NodeId) -> ty::t {
let tcx = bcx.tcx();
let t = ty::node_id_to_type(tcx, id);
monomorphize_type(bcx, t)
@ -987,7 +987,7 @@ pub fn expr_ty_adjusted(bcx: @mut Block, ex: &ast::expr) -> ty::t {
monomorphize_type(bcx, t)
}
pub fn node_id_type_params(bcx: @mut Block, id: ast::node_id) -> ~[ty::t] {
pub fn node_id_type_params(bcx: @mut Block, id: ast::NodeId) -> ~[ty::t] {
let tcx = bcx.tcx();
let params = ty::node_id_to_type_params(tcx, id);
@ -1007,7 +1007,7 @@ pub fn node_id_type_params(bcx: @mut Block, id: ast::node_id) -> ~[ty::t] {
}
}
pub fn node_vtables(bcx: @mut Block, id: ast::node_id)
pub fn node_vtables(bcx: @mut Block, id: ast::NodeId)
-> Option<typeck::vtable_res> {
let raw_vtables = bcx.ccx().maps.vtable_map.find(&id);
raw_vtables.map(

View file

@ -601,7 +601,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::expr) -> ValueRef {
}
}
pub fn trans_const(ccx: @mut CrateContext, m: ast::mutability, id: ast::node_id) {
pub fn trans_const(ccx: @mut CrateContext, m: ast::mutability, id: ast::NodeId) {
unsafe {
let _icx = push_ctxt("trans_const");
let g = base::get_item_val(ccx, id);

View file

@ -43,20 +43,20 @@ pub struct CrateContext {
tn: TypeNames,
externs: ExternMap,
intrinsics: HashMap<&'static str, ValueRef>,
item_vals: HashMap<ast::node_id, ValueRef>,
item_vals: HashMap<ast::NodeId, ValueRef>,
exp_map2: resolve::ExportMap2,
reachable: @mut HashSet<ast::node_id>,
item_symbols: HashMap<ast::node_id, ~str>,
reachable: @mut HashSet<ast::NodeId>,
item_symbols: HashMap<ast::NodeId, ~str>,
link_meta: LinkMeta,
enum_sizes: HashMap<ty::t, uint>,
discrims: HashMap<ast::def_id, ValueRef>,
discrim_symbols: HashMap<ast::node_id, @str>,
discrim_symbols: HashMap<ast::NodeId, @str>,
tydescs: HashMap<ty::t, @mut tydesc_info>,
// Set when running emit_tydescs to enforce that no more tydescs are
// created.
finished_tydescs: bool,
// Track mapping of external ids to local items imported for inlining
external: HashMap<ast::def_id, Option<ast::node_id>>,
external: HashMap<ast::def_id, Option<ast::NodeId>>,
// Cache instances of monomorphized functions
monomorphized: HashMap<mono_id, ValueRef>,
monomorphizing: HashMap<ast::def_id, uint>,
@ -78,7 +78,7 @@ pub struct CrateContext {
const_globals: HashMap<int, ValueRef>,
// Cache of emitted const values
const_values: HashMap<ast::node_id, ValueRef>,
const_values: HashMap<ast::NodeId, ValueRef>,
// Cache of external const values
extern_const_values: HashMap<ast::def_id, ValueRef>,
@ -119,7 +119,7 @@ impl CrateContext {
maps: astencode::Maps,
symbol_hasher: hash::State,
link_meta: LinkMeta,
reachable: @mut HashSet<ast::node_id>)
reachable: @mut HashSet<ast::NodeId>)
-> CrateContext {
unsafe {
let llcx = llvm::LLVMContextCreate();

View file

@ -614,7 +614,7 @@ impl Datum {
pub fn try_deref(&self,
bcx: @mut Block,
span: span,
expr_id: ast::node_id,
expr_id: ast::NodeId,
derefs: uint,
is_auto: bool)
-> (Option<Datum>, @mut Block) {
@ -740,7 +740,7 @@ impl Datum {
pub fn autoderef(&self,
bcx: @mut Block,
span: span,
expr_id: ast::node_id,
expr_id: ast::NodeId,
max: uint)
-> DatumBlock {
let _icx = push_ctxt("autoderef");
@ -773,7 +773,7 @@ impl Datum {
pub fn get_vec_base_and_len(&self,
mut bcx: @mut Block,
span: span,
expr_id: ast::node_id,
expr_id: ast::NodeId,
derefs: uint)
-> (@mut Block, ValueRef, ValueRef) {
//! Converts a vector into the slice pair. Performs rooting
@ -797,7 +797,7 @@ impl Datum {
pub fn root_and_write_guard(&self,
bcx: @mut Block,
span: span,
expr_id: ast::node_id,
expr_id: ast::NodeId,
derefs: uint)
-> @mut Block {
write_guard::root_and_write_guard(self, bcx, span, expr_id, derefs)

View file

@ -96,10 +96,10 @@ pub struct DebugContext {
priv builder: DIBuilderRef,
priv curr_loc: (uint, uint),
priv created_files: HashMap<~str, DIFile>,
priv created_functions: HashMap<ast::node_id, DISubprogram>,
priv created_blocks: HashMap<ast::node_id, DILexicalBlock>,
priv created_functions: HashMap<ast::NodeId, DISubprogram>,
priv created_blocks: HashMap<ast::NodeId, DILexicalBlock>,
priv created_types: HashMap<uint, DIType>,
priv last_function_context_id: ast::node_id,
priv last_function_context_id: ast::NodeId,
priv argument_counter: uint,
}

View file

@ -943,7 +943,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::expr) -> DatumBlock {
fn get_did(ccx: @mut CrateContext, did: ast::def_id)
-> ast::def_id {
if did.crate != ast::local_crate {
if did.crate != ast::LOCAL_CRATE {
inline::maybe_instantiate_inline(ccx, did)
} else {
did
@ -953,7 +953,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::expr) -> DatumBlock {
fn get_val(bcx: @mut Block, did: ast::def_id, const_ty: ty::t)
-> ValueRef {
// For external constants, we don't inline.
if did.crate == ast::local_crate {
if did.crate == ast::LOCAL_CRATE {
// The LLVM global has the type of its initializer,
// which may not be equal to the enum's type for
// non-C-like enums.
@ -1057,8 +1057,8 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::def) -> Datum {
};
fn take_local(bcx: @mut Block,
table: &HashMap<ast::node_id, ValueRef>,
nid: ast::node_id) -> Datum {
table: &HashMap<ast::NodeId, ValueRef>,
nid: ast::NodeId) -> Datum {
let v = match table.find(&nid) {
Some(&v) => v,
None => {
@ -1082,7 +1082,7 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::def) -> Datum {
// is and `node_id_opt` is none, this function fails).
pub fn with_field_tys<R>(tcx: ty::ctxt,
ty: ty::t,
node_id_opt: Option<ast::node_id>,
node_id_opt: Option<ast::NodeId>,
op: &fn(uint, (&[ty::field])) -> R) -> R {
match ty::get(ty).sty {
ty::ty_struct(did, ref substs) => {
@ -1127,7 +1127,7 @@ fn trans_rec_or_struct(bcx: @mut Block,
fields: &[ast::Field],
base: Option<@ast::expr>,
expr_span: codemap::span,
id: ast::node_id,
id: ast::NodeId,
dest: Dest) -> @mut Block
{
let _icx = push_ctxt("trans_rec");
@ -1529,7 +1529,7 @@ fn trans_binary(bcx: @mut Block,
fn trans_overloaded_op(bcx: @mut Block,
expr: &ast::expr,
callee_id: ast::node_id,
callee_id: ast::NodeId,
rcvr: @ast::expr,
args: ~[@ast::expr],
ret_ty: ty::t,
@ -1605,7 +1605,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
}
fn trans_imm_cast(bcx: @mut Block, expr: @ast::expr,
id: ast::node_id) -> DatumBlock {
id: ast::NodeId) -> DatumBlock {
let _icx = push_ctxt("trans_cast");
let ccx = bcx.ccx();
@ -1668,7 +1668,7 @@ fn trans_imm_cast(bcx: @mut Block, expr: @ast::expr,
fn trans_assign_op(bcx: @mut Block,
expr: @ast::expr,
callee_id: ast::node_id,
callee_id: ast::NodeId,
op: ast::binop,
dst: @ast::expr,
src: @ast::expr) -> @mut Block

View file

@ -108,7 +108,7 @@ fn foreign_signature(ccx: &mut CrateContext, fn_sig: &ty::FnSig)
}
}
fn shim_types(ccx: @mut CrateContext, id: ast::node_id) -> ShimTypes {
fn shim_types(ccx: @mut CrateContext, id: ast::NodeId) -> ShimTypes {
let fn_sig = match ty::get(ty::node_id_to_type(ccx.tcx, id)).sty {
ty::ty_bare_fn(ref fn_ty) => fn_ty.sig.clone(),
_ => ccx.sess.bug("c_arg_and_ret_lltys called on non-function type")
@ -338,7 +338,7 @@ pub fn trans_foreign_mod(ccx: @mut CrateContext,
}
fn build_foreign_fn(ccx: @mut CrateContext,
id: ast::node_id,
id: ast::NodeId,
foreign_item: @ast::foreign_item,
cc: lib::llvm::CallConv) {
let llwrapfn = get_item_val(ccx, id);
@ -537,7 +537,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
path: ast_map::path,
substs: @param_substs,
attributes: &[ast::Attribute],
ref_id: Option<ast::node_id>) {
ref_id: Option<ast::NodeId>) {
debug!("trans_intrinsic(item.ident=%s)", ccx.sess.str_of(item.ident));
fn simple_llvm_intrinsic(bcx: @mut Block, name: &'static str, num_args: uint) {
@ -975,14 +975,14 @@ pub fn trans_foreign_fn(ccx: @mut CrateContext,
decl: &ast::fn_decl,
body: &ast::Block,
llwrapfn: ValueRef,
id: ast::node_id) {
id: ast::NodeId) {
let _icx = push_ctxt("foreign::build_foreign_fn");
fn build_rust_fn(ccx: @mut CrateContext,
path: &ast_map::path,
decl: &ast::fn_decl,
body: &ast::Block,
id: ast::node_id)
id: ast::NodeId)
-> ValueRef {
let _icx = push_ctxt("foreign::foreign::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id);
@ -1145,7 +1145,7 @@ pub fn trans_foreign_fn(ccx: @mut CrateContext,
pub fn register_foreign_fn(ccx: @mut CrateContext,
sp: span,
sym: ~str,
node_id: ast::node_id)
node_id: ast::NodeId)
-> ValueRef {
let _icx = push_ctxt("foreign::register_foreign_fn");

View file

@ -48,7 +48,7 @@ pub fn trans_impl(ccx: @mut CrateContext,
name: ast::ident,
methods: &[@ast::method],
generics: &ast::Generics,
id: ast::node_id) {
id: ast::NodeId) {
let _icx = push_ctxt("impl::trans_impl");
let tcx = ccx.tcx;
@ -142,7 +142,7 @@ pub fn trans_self_arg(bcx: @mut Block,
}
pub fn trans_method_callee(bcx: @mut Block,
callee_id: ast::node_id,
callee_id: ast::NodeId,
this: @ast::expr,
mentry: typeck::method_map_entry)
-> Callee {
@ -201,7 +201,7 @@ pub fn trans_method_callee(bcx: @mut Block,
pub fn trans_static_method_callee(bcx: @mut Block,
method_id: ast::def_id,
trait_id: ast::def_id,
callee_id: ast::node_id)
callee_id: ast::NodeId)
-> FnData {
let _icx = push_ctxt("impl::trans_static_method_callee");
let ccx = bcx.ccx();
@ -229,7 +229,7 @@ pub fn trans_static_method_callee(bcx: @mut Block,
let bound_index = ty::lookup_trait_def(bcx.tcx(), trait_id).
generics.type_param_defs.len();
let mname = if method_id.crate == ast::local_crate {
let mname = if method_id.crate == ast::LOCAL_CRATE {
match bcx.tcx().items.get_copy(&method_id.node) {
ast_map::node_trait_method(trait_method, _, _) => {
ast_util::trait_method_to_ty_method(trait_method).ident
@ -296,7 +296,7 @@ pub fn method_with_name(ccx: &mut CrateContext,
}
pub fn trans_monomorphized_callee(bcx: @mut Block,
callee_id: ast::node_id,
callee_id: ast::NodeId,
base: @ast::expr,
mentry: typeck::method_map_entry,
trait_id: ast::def_id,
@ -355,7 +355,7 @@ pub fn trans_monomorphized_callee(bcx: @mut Block,
pub fn combine_impl_and_methods_tps(bcx: @mut Block,
mth_did: ast::def_id,
callee_id: ast::node_id,
callee_id: ast::NodeId,
rcvr_substs: &[ty::t],
rcvr_origins: typeck::vtable_res)
-> (~[ty::t], typeck::vtable_res) {
@ -404,7 +404,7 @@ pub fn combine_impl_and_methods_tps(bcx: @mut Block,
pub fn trans_trait_callee(bcx: @mut Block,
callee_id: ast::node_id,
callee_id: ast::NodeId,
n_method: uint,
self_expr: @ast::expr,
store: ty::TraitStore,
@ -662,7 +662,7 @@ pub fn make_impl_vtable(bcx: @mut Block,
pub fn trans_trait_cast(bcx: @mut Block,
val: @ast::expr,
id: ast::node_id,
id: ast::NodeId,
dest: expr::Dest,
_store: ty::TraitStore)
-> @mut Block {

View file

@ -42,7 +42,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
real_substs: &ty::substs,
vtables: Option<typeck::vtable_res>,
self_vtables: Option<typeck::vtable_param_res>,
ref_id: Option<ast::node_id>)
ref_id: Option<ast::NodeId>)
-> (ValueRef, bool)
{
debug!("monomorphic_fn(\

View file

@ -72,7 +72,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: def_id, n_tps: uint)
None => ()
}
let fn_id_loc = if fn_id.crate == local_crate {
let fn_id_loc = if fn_id.crate == LOCAL_CRATE {
fn_id
} else {
inline::maybe_instantiate_inline(ccx, fn_id)
@ -93,7 +93,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: def_id, n_tps: uint)
let is_default = ty::provided_source(ccx.tcx, fn_id_loc).is_some();
// We also mark all of the params as used if it is an extern thing
// that we haven't been able to inline yet.
if is_default || fn_id_loc.crate != local_crate {
if is_default || fn_id_loc.crate != LOCAL_CRATE {
for uint::range(0u, n_tps) |n| { cx.uses[n] |= use_all; }
return store_type_uses(cx, fn_id);
}
@ -260,11 +260,11 @@ pub fn type_needs_inner(cx: &Context,
}
}
pub fn node_type_needs(cx: &Context, use_: uint, id: node_id) {
pub fn node_type_needs(cx: &Context, use_: uint, id: NodeId) {
type_needs(cx, use_, ty::node_id_to_type(cx.ccx.tcx, id));
}
pub fn mark_for_method_call(cx: &Context, e_id: node_id, callee_id: node_id) {
pub fn mark_for_method_call(cx: &Context, e_id: NodeId, callee_id: NodeId) {
let mut opt_static_did = None;
{
let r = cx.ccx.maps.method_map.find(&e_id);

View file

@ -36,7 +36,7 @@ use middle::trans::type_::Type;
pub fn root_and_write_guard(datum: &Datum,
mut bcx: @mut Block,
span: span,
expr_id: ast::node_id,
expr_id: ast::NodeId,
derefs: uint) -> @mut Block {
let key = root_map_key { id: expr_id, derefs: derefs };
debug!("write_guard::root_and_write_guard(key=%?)", key);

View file

@ -251,7 +251,7 @@ struct ctxt_ {
// of this node. This only applies to nodes that refer to entities
// parameterized by type parameters, such as generic fns, types, or
// other items.
node_type_substs: @mut HashMap<node_id, ~[t]>,
node_type_substs: @mut HashMap<NodeId, ~[t]>,
// Maps from a method to the method "descriptor"
methods: @mut HashMap<def_id, @Method>,
@ -264,7 +264,7 @@ struct ctxt_ {
impl_trait_cache: @mut HashMap<ast::def_id, Option<@ty::TraitRef>>,
trait_refs: @mut HashMap<node_id, @TraitRef>,
trait_refs: @mut HashMap<NodeId, @TraitRef>,
trait_defs: @mut HashMap<def_id, @TraitDef>,
items: ast_map::map,
@ -276,10 +276,10 @@ struct ctxt_ {
short_names_cache: @mut HashMap<t, @str>,
needs_unwind_cleanup_cache: @mut HashMap<t, bool>,
tc_cache: @mut HashMap<uint, TypeContents>,
ast_ty_to_ty_cache: @mut HashMap<node_id, ast_ty_to_ty_cache_entry>,
ast_ty_to_ty_cache: @mut HashMap<NodeId, ast_ty_to_ty_cache_entry>,
enum_var_cache: @mut HashMap<def_id, @~[@VariantInfo]>,
ty_param_defs: @mut HashMap<ast::node_id, TypeParameterDef>,
adjustments: @mut HashMap<ast::node_id, @AutoAdjustment>,
ty_param_defs: @mut HashMap<ast::NodeId, TypeParameterDef>,
adjustments: @mut HashMap<ast::NodeId, @AutoAdjustment>,
normalized_cache: @mut HashMap<t, t>,
lang_items: middle::lang_items::LanguageItems,
// A mapping of fake provided method def_ids to the default implementation
@ -311,12 +311,12 @@ struct ctxt_ {
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
// present in this set can be warned about.
used_unsafe: @mut HashSet<ast::node_id>,
used_unsafe: @mut HashSet<ast::NodeId>,
// Set of nodes which mark locals as mutable which end up getting used at
// some point. Local variable definitions not in this set can be warned
// about.
used_mut_nodes: @mut HashSet<ast::node_id>,
used_mut_nodes: @mut HashSet<ast::NodeId>,
// vtable resolution information for impl declarations
impl_vtables: typeck::impl_vtable_map
@ -430,7 +430,7 @@ pub enum Region {
re_free(FreeRegion),
/// A concrete region naming some expression within the current function.
re_scope(node_id),
re_scope(NodeId),
/// Static data that has an "infinite" lifetime. Top in the region lattice.
re_static,
@ -459,7 +459,7 @@ impl Region {
#[deriving(Clone, Eq, IterBytes, Encodable, Decodable)]
pub struct FreeRegion {
scope_id: node_id,
scope_id: NodeId,
bound_region: bound_region
}
@ -486,7 +486,7 @@ pub enum bound_region {
* enclosing scope, which may define the same names. For an example of
* where this comes up, see src/test/compile-fail/regions-ret-borrowed.rs
* and regions-ret-borrowed-1.rs. */
br_cap_avoid(ast::node_id, @bound_region),
br_cap_avoid(ast::NodeId, @bound_region),
}
/**
@ -2135,7 +2135,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
// If this assertion failures, it is likely because of a
// failure in the cross-crate inlining code to translate a
// def-id.
assert_eq!(p.def_id.crate, ast::local_crate);
assert_eq!(p.def_id.crate, ast::LOCAL_CRATE);
type_param_def_to_contents(
cx, cx.ty_param_defs.get(&p.def_id.node))
@ -2732,7 +2732,7 @@ impl cmp::TotalEq for bound_region {
}
}
pub fn node_id_to_trait_ref(cx: ctxt, id: ast::node_id) -> @ty::TraitRef {
pub fn node_id_to_trait_ref(cx: ctxt, id: ast::NodeId) -> @ty::TraitRef {
match cx.trait_refs.find(&id) {
Some(&t) => t,
None => cx.sess.bug(
@ -2742,7 +2742,7 @@ pub fn node_id_to_trait_ref(cx: ctxt, id: ast::node_id) -> @ty::TraitRef {
}
}
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
pub fn node_id_to_type(cx: ctxt, id: ast::NodeId) -> t {
//printfln!("%?/%?", id, cx.node_types.len());
match cx.node_types.find(&(id as uint)) {
Some(&t) => t,
@ -2754,14 +2754,14 @@ pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
}
// XXX(pcwalton): Makes a copy, bleh. Probably better to not do that.
pub fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> ~[t] {
pub fn node_id_to_type_params(cx: ctxt, id: ast::NodeId) -> ~[t] {
match cx.node_type_substs.find(&id) {
None => return ~[],
Some(ts) => return (*ts).clone(),
}
}
fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool {
fn node_id_has_type_params(cx: ctxt, id: ast::NodeId) -> bool {
cx.node_type_substs.contains_key(&id)
}
@ -3079,7 +3079,7 @@ pub fn expr_has_ty_params(cx: ctxt, expr: &ast::expr) -> bool {
pub fn method_call_type_param_defs(tcx: ctxt,
method_map: typeck::method_map,
id: ast::node_id)
id: ast::NodeId)
-> Option<@~[TypeParameterDef]> {
do method_map.find(&id).map |method| {
match method.origin {
@ -3260,7 +3260,7 @@ pub fn expr_kind(tcx: ctxt,
}
}
pub fn stmt_node_id(s: &ast::stmt) -> ast::node_id {
pub fn stmt_node_id(s: &ast::stmt) -> ast::NodeId {
match s.node {
ast::stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) => {
return id;
@ -3616,7 +3616,7 @@ fn lookup_locally_or_in_crate_store<V:Clone>(
None => { }
}
if def_id.crate == ast::local_crate {
if def_id.crate == ast::LOCAL_CRATE {
fail!("No def'n found for %? in tcx.%s", def_id, descr);
}
let v = load_external();
@ -3659,7 +3659,7 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::def_id) -> Option<@TraitRef> {
Some(&ret) => { return ret; }
None => {}
}
let ret = if id.crate == ast::local_crate {
let ret = if id.crate == ast::LOCAL_CRATE {
debug!("(impl_trait_ref) searching for trait impl %?", id);
match cx.items.find(&id.node) {
Some(&ast_map::node_item(@ast::item {
@ -3691,7 +3691,7 @@ pub fn ty_to_def_id(ty: t) -> Option<ast::def_id> {
/// None if the struct is not tuple-like. Fails if the given def ID does not
/// refer to a struct at all.
fn struct_ctor_id(cx: ctxt, struct_did: ast::def_id) -> Option<ast::def_id> {
if struct_did.crate != ast::local_crate {
if struct_did.crate != ast::LOCAL_CRATE {
// XXX: Cross-crate functionality.
cx.sess.unimpl("constructor ID of cross-crate tuple structs");
}
@ -3841,7 +3841,7 @@ pub fn has_dtor(cx: ctxt, struct_id: def_id) -> bool {
}
pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
if id.crate != ast::local_crate {
if id.crate != ast::LOCAL_CRATE {
csearch::get_item_path(cx, id)
} else {
// FIXME (#5521): uncomment this code and don't have a catch-all at the
@ -3910,7 +3910,7 @@ pub fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[@VariantInfo] {
_ => { /* fallthrough */ }
}
let result = if ast::local_crate != id.crate {
let result = if ast::LOCAL_CRATE != id.crate {
@csearch::get_enum_variants(cx, id)
} else {
/*
@ -4002,7 +4002,7 @@ pub fn lookup_trait_def(cx: ctxt, did: ast::def_id) -> @ty::TraitDef {
return trait_def;
}
None => {
assert!(did.crate != ast::local_crate);
assert!(did.crate != ast::LOCAL_CRATE);
let trait_def = @csearch::get_trait_def(cx, did);
cx.trait_defs.insert(did, trait_def);
return trait_def;
@ -4048,7 +4048,7 @@ pub fn lookup_field_type(tcx: ctxt,
id: def_id,
substs: &substs)
-> ty::t {
let t = if id.crate == ast::local_crate {
let t = if id.crate == ast::LOCAL_CRATE {
node_id_to_type(tcx, id.node)
}
else {
@ -4067,7 +4067,7 @@ pub fn lookup_field_type(tcx: ctxt,
// Look up the list of field names and IDs for a given struct
// Fails if the id is not bound to a struct.
pub fn lookup_struct_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
if did.crate == ast::local_crate {
if did.crate == ast::LOCAL_CRATE {
match cx.items.find(&did.node) {
Some(&ast_map::node_item(i,_)) => {
match i.node {
@ -4360,10 +4360,10 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::expr) ->
}
// Determine what purity to check a nested function under
pub fn determine_inherited_purity(parent: (ast::purity, ast::node_id),
child: (ast::purity, ast::node_id),
pub fn determine_inherited_purity(parent: (ast::purity, ast::NodeId),
child: (ast::purity, ast::NodeId),
child_sigil: ast::Sigil)
-> (ast::purity, ast::node_id) {
-> (ast::purity, ast::NodeId) {
// If the closure is a stack closure and hasn't had some non-standard
// purity inferred for it, then check it under its parent's purity.
// Otherwise, use its own

View file

@ -323,7 +323,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
}
}
pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::node_id, span: span,
pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span,
expected: ty::t, path: &ast::Path,
fields: &[ast::field_pat], etc: bool,
class_id: ast::def_id, substitutions: &ty::substs) {
@ -355,7 +355,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::node_id, span: span,
}
pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
pat_id: ast::node_id,
pat_id: ast::NodeId,
span: span,
expected: ty::t,
path: &ast::Path,
@ -619,7 +619,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
pub fn check_pointer_pat(pcx: &pat_ctxt,
pointer_kind: PointerKind,
inner: @ast::pat,
pat_id: ast::node_id,
pat_id: ast::NodeId,
span: span,
expected: ty::t) {
let fcx = pcx.fcx;

View file

@ -101,7 +101,7 @@ use std::uint;
use std::vec;
use extra::list::Nil;
use syntax::ast::{def_id, sty_value, sty_region, sty_box};
use syntax::ast::{sty_uniq, sty_static, node_id};
use syntax::ast::{sty_uniq, sty_static, NodeId};
use syntax::ast::{m_const, m_mutbl, m_imm};
use syntax::ast;
use syntax::ast_map;
@ -124,7 +124,7 @@ pub fn lookup(
// In a call `a.b::<X, Y, ...>(...)`:
expr: @ast::expr, // The expression `a.b(...)`.
self_expr: @ast::expr, // The expression `a`.
callee_id: node_id, /* Where to store `a.b`'s type,
callee_id: NodeId, /* Where to store `a.b`'s type,
* also the scope of the call */
m_name: ast::ident, // The ident `b`.
self_ty: ty::t, // The type of `a`.
@ -157,7 +157,7 @@ pub struct LookupContext<'self> {
fcx: @mut FnCtxt,
expr: @ast::expr,
self_expr: @ast::expr,
callee_id: node_id,
callee_id: NodeId,
m_name: ast::ident,
supplied_tps: &'self [ty::t],
impl_dups: @mut HashSet<def_id>,
@ -1147,7 +1147,7 @@ impl<'self> LookupContext<'self> {
}
pub fn report_static_candidate(&self, idx: uint, did: def_id) {
let span = if did.crate == ast::local_crate {
let span = if did.crate == ast::LOCAL_CRATE {
match self.tcx().items.find(&did.node) {
Some(&ast_map::node_method(m, _, _)) => m.span,
_ => fail!("report_static_candidate: bad item %?", did)

View file

@ -142,7 +142,7 @@ pub mod method;
pub struct SelfInfo {
self_ty: ty::t,
self_id: ast::node_id,
self_id: ast::NodeId,
span: span
}
@ -158,12 +158,12 @@ pub struct SelfInfo {
/// share the inherited fields.
pub struct inherited {
infcx: @mut infer::InferCtxt,
locals: @mut HashMap<ast::node_id, ty::t>,
locals: @mut HashMap<ast::NodeId, ty::t>,
// Temporary tables:
node_types: @mut HashMap<ast::node_id, ty::t>,
node_type_substs: @mut HashMap<ast::node_id, ty::substs>,
adjustments: @mut HashMap<ast::node_id, @ty::AutoAdjustment>,
node_types: @mut HashMap<ast::NodeId, ty::t>,
node_type_substs: @mut HashMap<ast::NodeId, ty::substs>,
adjustments: @mut HashMap<ast::NodeId, @ty::AutoAdjustment>,
method_map: method_map,
vtable_map: vtable_map,
}
@ -183,13 +183,13 @@ pub enum FnKind {
#[deriving(Clone)]
pub struct PurityState {
def: ast::node_id,
def: ast::NodeId,
purity: ast::purity,
priv from_fn: bool
}
impl PurityState {
pub fn function(purity: ast::purity, def: ast::node_id) -> PurityState {
pub fn function(purity: ast::purity, def: ast::NodeId) -> PurityState {
PurityState { def: def, purity: purity, from_fn: true }
}
@ -203,8 +203,8 @@ impl PurityState {
purity => {
let (purity, def) = match blk.rules {
ast::unsafe_blk => (ast::unsafe_fn, blk.id),
ast::default_blk => (purity, self.def),
ast::UnsafeBlock => (ast::unsafe_fn, blk.id),
ast::DefaultBlock => (purity, self.def),
};
PurityState{ def: def,
purity: purity,
@ -247,7 +247,7 @@ pub struct FnCtxt {
// inference selects the ultimate value. Finally, borrowck is
// charged with guaranteeing that the value whose address was taken
// can actually be made to live as long as it needs to live.
region_lb: ast::node_id,
region_lb: ast::NodeId,
// Says whether we're inside a for loop, in a do block
// or neither. Helps with error messages involving the
@ -276,7 +276,7 @@ pub fn blank_inherited(ccx: @mut CrateCtxt) -> @inherited {
// Used by check_const and check_enum_variants
pub fn blank_fn_ctxt(ccx: @mut CrateCtxt,
rty: ty::t,
region_bnd: ast::node_id)
region_bnd: ast::NodeId)
-> @mut FnCtxt {
// It's kind of a kludge to manufacture a fake function context
// and statement context, but we might as well do write the code only once
@ -314,7 +314,7 @@ pub fn check_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
pub fn check_bare_fn(ccx: @mut CrateCtxt,
decl: &ast::fn_decl,
body: &ast::Block,
id: ast::node_id,
id: ast::NodeId,
self_info: Option<SelfInfo>) {
let fty = ty::node_id_to_type(ccx.tcx, id);
match ty::get(fty).sty {
@ -338,7 +338,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
purity: ast::purity,
fn_sig: &ty::FnSig,
decl: &ast::fn_decl,
id: ast::node_id,
id: ast::NodeId,
body: &ast::Block,
fn_kind: FnKind,
inherited_isr: isr_alist,
@ -444,7 +444,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
opt_self_info: Option<SelfInfo>) {
let tcx = fcx.ccx.tcx;
let assign: @fn(ast::node_id, Option<ty::t>) = |nid, ty_opt| {
let assign: @fn(ast::NodeId, Option<ty::t>) = |nid, ty_opt| {
match ty_opt {
None => {
// infer the variable's type
@ -526,7 +526,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
// Don't descend into fns and items
fn visit_fn(_fk: &visit::fn_kind, _decl: &ast::fn_decl,
_body: &ast::Block, _sp: span,
_id: ast::node_id, (_t,_v): ((), visit::vt<()>)) {
_id: ast::NodeId, (_t,_v): ((), visit::vt<()>)) {
}
fn visit_item(_i: @ast::item, (_e,_v): ((), visit::vt<()>)) { }
@ -583,7 +583,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
}
}
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::node_id, span: span) {
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: span) {
let tcx = ccx.tcx;
// Check that the class is instantiable
@ -732,7 +732,7 @@ impl FnCtxt {
}
}
pub fn local_ty(&self, span: span, nid: ast::node_id) -> ty::t {
pub fn local_ty(&self, span: span, nid: ast::NodeId) -> ty::t {
match self.inh.locals.find(&nid) {
Some(&t) => t,
None => {
@ -748,13 +748,13 @@ impl FnCtxt {
}
#[inline]
pub fn write_ty(&self, node_id: ast::node_id, ty: ty::t) {
pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) {
debug!("write_ty(%d, %s) in fcx %s",
node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag());
self.inh.node_types.insert(node_id, ty);
}
pub fn write_substs(&self, node_id: ast::node_id, substs: ty::substs) {
pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::substs) {
if !ty::substs_is_noop(&substs) {
debug!("write_substs(%d, %s) in fcx %s",
node_id,
@ -765,7 +765,7 @@ impl FnCtxt {
}
pub fn write_ty_substs(&self,
node_id: ast::node_id,
node_id: ast::NodeId,
ty: ty::t,
substs: ty::substs) {
let ty = ty::subst(self.tcx(), &substs, ty);
@ -774,7 +774,7 @@ impl FnCtxt {
}
pub fn write_autoderef_adjustment(&self,
node_id: ast::node_id,
node_id: ast::NodeId,
derefs: uint) {
if derefs == 0 { return; }
self.write_adjustment(
@ -786,19 +786,19 @@ impl FnCtxt {
}
pub fn write_adjustment(&self,
node_id: ast::node_id,
node_id: ast::NodeId,
adj: @ty::AutoAdjustment) {
debug!("write_adjustment(node_id=%?, adj=%?)", node_id, adj);
self.inh.adjustments.insert(node_id, adj);
}
pub fn write_nil(&self, node_id: ast::node_id) {
pub fn write_nil(&self, node_id: ast::NodeId) {
self.write_ty(node_id, ty::mk_nil());
}
pub fn write_bot(&self, node_id: ast::node_id) {
pub fn write_bot(&self, node_id: ast::NodeId) {
self.write_ty(node_id, ty::mk_bot());
}
pub fn write_error(@mut self, node_id: ast::node_id) {
pub fn write_error(@mut self, node_id: ast::NodeId) {
self.write_ty(node_id, ty::mk_err());
}
@ -820,7 +820,7 @@ impl FnCtxt {
}
}
pub fn node_ty(&self, id: ast::node_id) -> ty::t {
pub fn node_ty(&self, id: ast::NodeId) -> ty::t {
match self.inh.node_types.find(&id) {
Some(&t) => t,
None => {
@ -834,7 +834,7 @@ impl FnCtxt {
}
}
pub fn node_ty_substs(&self, id: ast::node_id) -> ty::substs {
pub fn node_ty_substs(&self, id: ast::NodeId) -> ty::substs {
match self.inh.node_type_substs.find(&id) {
Some(ts) => (*ts).clone(),
None => {
@ -849,7 +849,7 @@ impl FnCtxt {
}
pub fn opt_node_ty_substs(&self,
id: ast::node_id,
id: ast::NodeId,
f: &fn(&ty::substs) -> bool)
-> bool {
match self.inh.node_type_substs.find(&id) {
@ -913,7 +913,7 @@ impl FnCtxt {
infer::mk_subr(self.infcx(), a_is_expected, origin, sub, sup)
}
pub fn with_region_lb<R>(@mut self, lb: ast::node_id, f: &fn() -> R)
pub fn with_region_lb<R>(@mut self, lb: ast::NodeId, f: &fn() -> R)
-> R {
let old_region_lb = self.region_lb;
self.region_lb = lb;
@ -1308,7 +1308,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_assignment(fcx: @mut FnCtxt,
lhs: @ast::expr,
rhs: @ast::expr,
id: ast::node_id) {
id: ast::NodeId) {
check_expr(fcx, lhs);
let lhs_type = fcx.expr_ty(lhs);
check_expr_has_type(fcx, rhs, lhs_type);
@ -1338,7 +1338,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
// A generic function for doing all of the checking for call expressions
fn check_call(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
call_expr: @ast::expr,
f: @ast::expr,
args: &[@ast::expr],
@ -1400,7 +1400,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
// Checks a method call.
fn check_method_call(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
expr: @ast::expr,
rcvr: @ast::expr,
method_name: ast::ident,
@ -1463,7 +1463,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
cond_expr: @ast::expr,
then_blk: &ast::Block,
opt_else_expr: Option<@ast::expr>,
id: ast::node_id,
id: ast::NodeId,
sp: span,
expected: Option<ty::t>) {
check_expr_has_type(fcx, cond_expr, ty::mk_bool());
@ -1499,7 +1499,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn lookup_op_method(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
op_ex: @ast::expr,
self_ex: @ast::expr,
self_t: ty::t,
@ -1537,7 +1537,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
// could be either a expr_binop or an expr_assign_binop
fn check_binop(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
expr: @ast::expr,
op: ast::binop,
lhs: @ast::expr,
@ -1625,7 +1625,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn check_user_binop(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
ex: @ast::expr,
lhs_expr: @ast::expr,
lhs_resolved_t: ty::t,
@ -1667,7 +1667,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn check_user_unop(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
op_str: &str,
mname: &str,
ex: @ast::expr,
@ -1874,7 +1874,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_struct_or_variant_fields(fcx: @mut FnCtxt,
span: span,
class_id: ast::def_id,
node_id: ast::node_id,
node_id: ast::NodeId,
substitutions: ty::substs,
field_types: &[ty::field_ty],
ast_fields: &[ast::Field],
@ -1963,7 +1963,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn check_struct_constructor(fcx: @mut FnCtxt,
id: ast::node_id,
id: ast::NodeId,
span: codemap::span,
class_id: ast::def_id,
fields: &[ast::Field],
@ -1975,7 +1975,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
let type_parameter_count;
let region_parameterized;
let raw_type;
if class_id.crate == ast::local_crate {
if class_id.crate == ast::LOCAL_CRATE {
region_parameterized =
tcx.region_paramd_items.find(&class_id.node).
map_consume(|x| *x);
@ -2052,7 +2052,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn check_struct_enum_variant(fcx: @mut FnCtxt,
id: ast::node_id,
id: ast::NodeId,
span: codemap::span,
enum_id: ast::def_id,
variant_id: ast::def_id,
@ -2064,7 +2064,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
let type_parameter_count;
let region_parameterized;
let raw_type;
if enum_id.crate == ast::local_crate {
if enum_id.crate == ast::LOCAL_CRATE {
region_parameterized =
tcx.region_paramd_items.find(&enum_id.node).map_consume(|x| *x);
match tcx.items.find(&enum_id.node) {
@ -2897,7 +2897,7 @@ pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) {
}
pub fn check_decl_initializer(fcx: @mut FnCtxt,
nid: ast::node_id,
nid: ast::NodeId,
init: @ast::expr)
{
let local_ty = fcx.local_ty(init.span, nid);
@ -3062,7 +3062,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
pub fn check_const(ccx: @mut CrateCtxt,
sp: span,
e: @ast::expr,
id: ast::node_id) {
id: ast::NodeId) {
let rty = ty::node_id_to_type(ccx.tcx, id);
let fcx = blank_fn_ctxt(ccx, rty, e.id);
let declty = fcx.ccx.tcx.tcache.get(&local_def(id)).ty;
@ -3093,7 +3093,7 @@ pub fn check_const_with_ty(fcx: @mut FnCtxt,
/// is representable, but not instantiable.
pub fn check_instantiable(tcx: ty::ctxt,
sp: span,
item_id: ast::node_id) {
item_id: ast::NodeId) {
let item_ty = ty::node_id_to_type(tcx, item_id);
if !ty::is_instantiable(tcx, item_ty) {
tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \
@ -3103,7 +3103,7 @@ pub fn check_instantiable(tcx: ty::ctxt,
}
}
pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::node_id) {
pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::NodeId) {
let t = ty::node_id_to_type(tcx, id);
if ty::type_needs_subst(t) {
tcx.sess.span_err(sp, "SIMD vector cannot be generic");
@ -3135,10 +3135,10 @@ pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::node_id) {
pub fn check_enum_variants(ccx: @mut CrateCtxt,
sp: span,
vs: &[ast::variant],
id: ast::node_id) {
id: ast::NodeId) {
fn do_check(ccx: @mut CrateCtxt,
vs: &[ast::variant],
id: ast::node_id)
id: ast::NodeId)
-> ~[@ty::VariantInfo] {
let rty = ty::node_id_to_type(ccx.tcx, id);
@ -3226,7 +3226,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
check_instantiable(ccx.tcx, sp, id);
}
pub fn lookup_def(fcx: @mut FnCtxt, sp: span, id: ast::node_id) -> ast::def {
pub fn lookup_def(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) -> ast::def {
lookup_def_ccx(fcx.ccx, sp, id)
}
@ -3302,7 +3302,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
pth: &ast::Path,
tpt: ty_param_bounds_and_ty,
span: span,
node_id: ast::node_id) {
node_id: ast::NodeId) {
debug!(">>> instantiate_path");
let ty_param_count = tpt.generics.type_param_defs.len();
@ -3427,7 +3427,7 @@ pub fn ast_expr_vstore_to_vstore(fcx: @mut FnCtxt,
}
// Returns true if b contains a break that can exit from b
pub fn may_break(cx: ty::ctxt, id: ast::node_id, b: &ast::Block) -> bool {
pub fn may_break(cx: ty::ctxt, id: ast::NodeId, b: &ast::Block) -> bool {
// First: is there an unlabeled break immediately
// inside the loop?
(loop_query(b, |e| {

View file

@ -51,7 +51,7 @@ pub struct Rcx {
errors_reported: uint,
// id of innermost fn or loop
repeating_scope: ast::node_id,
repeating_scope: ast::NodeId,
}
pub type rvt = visit::vt<@mut Rcx>;
@ -81,7 +81,7 @@ impl Rcx {
self.fcx.ccx.tcx
}
pub fn set_repeating_scope(&mut self, scope: ast::node_id) -> ast::node_id {
pub fn set_repeating_scope(&mut self, scope: ast::NodeId) -> ast::NodeId {
let old_scope = self.repeating_scope;
self.repeating_scope = scope;
old_scope
@ -124,7 +124,7 @@ impl Rcx {
}
/// Try to resolve the type for the given node.
pub fn resolve_node_type(@mut self, id: ast::node_id) -> ty::t {
pub fn resolve_node_type(@mut self, id: ast::NodeId) -> ty::t {
self.resolve_type(self.fcx.node_ty(id))
}
@ -500,7 +500,7 @@ fn check_expr_fn_block(rcx: @mut Rcx,
}
fn constrain_callee(rcx: @mut Rcx,
callee_id: ast::node_id,
callee_id: ast::NodeId,
call_expr: @ast::expr,
callee_expr: @ast::expr)
{
@ -527,7 +527,7 @@ fn constrain_callee(rcx: @mut Rcx,
fn constrain_call(rcx: @mut Rcx,
// might be expr_call, expr_method_call, or an overloaded
// operator
callee_id: ast::node_id,
callee_id: ast::NodeId,
call_expr: @ast::expr,
receiver: Option<@ast::expr>,
arg_exprs: &[@ast::expr],
@ -680,7 +680,7 @@ fn constrain_free_variables(rcx: @mut Rcx,
fn constrain_regions_in_type_of_node(
rcx: @mut Rcx,
id: ast::node_id,
id: ast::NodeId,
minimum_lifetime: ty::Region,
origin: infer::SubregionOrigin) -> bool
{
@ -895,7 +895,7 @@ pub mod guarantor {
pub fn for_by_ref(rcx: @mut Rcx,
expr: @ast::expr,
callee_scope: ast::node_id) {
callee_scope: ast::NodeId) {
/*!
* Computes the guarantor for cases where the `expr` is
* being passed by implicit reference and must outlive
@ -918,7 +918,7 @@ pub mod guarantor {
fn link(
rcx: @mut Rcx,
span: span,
id: ast::node_id,
id: ast::NodeId,
guarantor: Option<ty::Region>) {
/*!
*

View file

@ -62,7 +62,7 @@ use syntax::visit;
/// if the vtable instantiation is being performed as part of "deriving".)
pub struct LocationInfo {
span: span,
id: ast::node_id
id: ast::NodeId
}
/// A vtable context includes an inference context, a crate context, and a
@ -522,7 +522,7 @@ fn connect_trait_tps(vcx: &VtableContext,
}
fn insert_vtables(fcx: @mut FnCtxt,
callee_id: ast::node_id,
callee_id: ast::NodeId,
vtables: vtable_res) {
debug!("insert_vtables(callee_id=%d, vtables=%?)",
callee_id, vtables.repr(fcx.tcx()));

View file

@ -59,7 +59,7 @@ fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t])
})
}
fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::node_id) {
fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
// Resolve any method map entry
match fcx.inh.method_map.find(&id) {
None => {}
@ -79,7 +79,7 @@ fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::node_id) {
}
}
fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::node_id) {
fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
// Resolve any method map entry
match fcx.inh.vtable_map.find(&id) {
None => {}
@ -113,7 +113,7 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::node_id) {
}
}
fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::node_id)
fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::NodeId)
-> Option<ty::t> {
let fcx = wbcx.fcx;
let tcx = fcx.ccx.tcx;
@ -195,7 +195,7 @@ fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::node_id)
fn maybe_resolve_type_vars_for_node(wbcx: @mut WbCtxt,
sp: span,
id: ast::node_id)
id: ast::NodeId)
-> Option<ty::t> {
if wbcx.fcx.inh.node_types.contains_key(&id) {
resolve_type_vars_for_node(wbcx, sp, id)

View file

@ -38,7 +38,7 @@ use middle::typeck::infer::{new_infer_ctxt, resolve_ivar, resolve_type};
use middle::typeck::infer;
use syntax::ast::{Crate, def_id, def_struct, def_ty};
use syntax::ast::{item, item_enum, item_impl, item_mod, item_struct};
use syntax::ast::{local_crate, trait_ref, ty_path};
use syntax::ast::{LOCAL_CRATE, trait_ref, ty_path};
use syntax::ast;
use syntax::ast_map::node_item;
use syntax::ast_map;
@ -114,7 +114,7 @@ pub fn type_is_defined_in_local_crate(original_type: t) -> bool {
ty_enum(def_id, _) |
ty_trait(def_id, _, _, _, _) |
ty_struct(def_id, _) => {
if def_id.crate == ast::local_crate {
if def_id.crate == ast::LOCAL_CRATE {
found_nominal = true;
}
}
@ -513,7 +513,7 @@ impl CoherenceChecker {
let trait_def_id =
self.trait_ref_to_trait_def_id(trait_ref);
if trait_def_id.crate != local_crate {
if trait_def_id.crate != LOCAL_CRATE {
let session = self.crate_context.tcx.sess;
session.span_err(item.span,
"cannot provide an extension implementation \
@ -575,7 +575,7 @@ impl CoherenceChecker {
ty_path(_, _, path_id) => {
match self.crate_context.tcx.def_map.get_copy(&path_id) {
def_ty(def_id) | def_struct(def_id) => {
if def_id.crate != local_crate {
if def_id.crate != LOCAL_CRATE {
return false;
}
@ -647,7 +647,7 @@ impl CoherenceChecker {
}
pub fn span_of_impl(&self, implementation: @Impl) -> span {
assert_eq!(implementation.did.crate, local_crate);
assert_eq!(implementation.did.crate, LOCAL_CRATE);
match self.crate_context.tcx.items.find(&implementation.did.node) {
Some(&node_item(item, _)) => {
return item.span;
@ -783,7 +783,7 @@ impl CoherenceChecker {
}
_ => {
// Destructors only work on nominal types.
if impl_info.did.crate == ast::local_crate {
if impl_info.did.crate == ast::LOCAL_CRATE {
match tcx.items.find(&impl_info.did.node) {
Some(&ast_map::node_item(@ref item, _)) => {
tcx.sess.span_err((*item).span,

View file

@ -107,7 +107,7 @@ impl AstConv for CrateCtxt {
fn tcx(&self) -> ty::ctxt { self.tcx }
fn get_item_ty(&self, id: ast::def_id) -> ty::ty_param_bounds_and_ty {
if id.crate != ast::local_crate {
if id.crate != ast::LOCAL_CRATE {
csearch::get_type(self.tcx, id)
} else {
match self.tcx.items.find(&id.node) {
@ -195,7 +195,7 @@ pub fn get_enum_variant_types(ccx: &CrateCtxt,
}
pub fn ensure_trait_methods(ccx: &CrateCtxt,
trait_id: ast::node_id)
trait_id: ast::NodeId)
{
let tcx = ccx.tcx;
let region_paramd = tcx.region_paramd_items.find(&trait_id).map(|&x| *x);
@ -248,7 +248,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
}
fn make_static_method_ty(ccx: &CrateCtxt,
trait_id: ast::node_id,
trait_id: ast::NodeId,
m: &ty::Method,
trait_ty_generics: &ty::Generics) {
// If declaration is
@ -352,10 +352,10 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
}
fn ty_method_of_trait_method(this: &CrateCtxt,
trait_id: ast::node_id,
trait_id: ast::NodeId,
trait_rp: Option<ty::region_variance>,
trait_generics: &ast::Generics,
m_id: &ast::node_id,
m_id: &ast::NodeId,
m_ident: &ast::ident,
m_explicit_self: &ast::explicit_self,
m_generics: &ast::Generics,
@ -384,7 +384,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
}
pub fn ensure_supertraits(ccx: &CrateCtxt,
id: ast::node_id,
id: ast::NodeId,
sp: codemap::span,
rp: Option<ty::region_variance>,
ast_trait_refs: &[ast::trait_ref],
@ -666,7 +666,7 @@ pub fn check_methods_against_trait(ccx: &CrateCtxt,
let trait_ref = instantiate_trait_ref(ccx, a_trait_ty, rp,
generics, selfty);
if trait_ref.def_id.crate == ast::local_crate {
if trait_ref.def_id.crate == ast::LOCAL_CRATE {
ensure_trait_methods(ccx, trait_ref.def_id.node);
}
@ -716,13 +716,13 @@ pub fn convert_field(ccx: &CrateCtxt,
pub struct ConvertedMethod {
mty: @ty::Method,
id: ast::node_id,
id: ast::NodeId,
span: span,
body_id: ast::node_id
body_id: ast::NodeId
}
pub fn convert_methods(ccx: &CrateCtxt,
container_id: ast::node_id,
container_id: ast::NodeId,
ms: &[@ast::method],
untransformed_rcvr_ty: ty::t,
rcvr_ty_generics: &ty::Generics,
@ -763,7 +763,7 @@ pub fn convert_methods(ccx: &CrateCtxt,
}).collect();
fn ty_of_method(ccx: &CrateCtxt,
container_id: ast::node_id,
container_id: ast::NodeId,
m: &ast::method,
rp: Option<ty::region_variance>,
untransformed_rcvr_ty: ty::t,
@ -908,7 +908,7 @@ pub fn convert_struct(ccx: &CrateCtxt,
struct_def: &ast::struct_def,
generics: &ast::Generics,
tpt: ty::ty_param_bounds_and_ty,
id: ast::node_id) {
id: ast::NodeId) {
let tcx = ccx.tcx;
// Write the type of each of the members
@ -1002,7 +1002,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt,
}
fn get_trait_def(ccx: &CrateCtxt, trait_id: ast::def_id) -> @ty::TraitDef {
if trait_id.crate != ast::local_crate {
if trait_id.crate != ast::LOCAL_CRATE {
ty::lookup_trait_def(ccx.tcx, trait_id)
} else {
match ccx.tcx.items.get(&trait_id.node) {

View file

@ -686,8 +686,8 @@ impl RegionVarBindings {
fn intersect_scopes(&self,
region_a: ty::Region,
region_b: ty::Region,
scope_a: ast::node_id,
scope_b: ast::node_id) -> cres<Region>
scope_a: ast::NodeId,
scope_b: ast::NodeId) -> cres<Region>
{
// We want to generate the intersection of two
// scopes or two free regions. So, if one of

View file

@ -128,7 +128,7 @@ pub struct method_map_entry {
// maps from an expression id that corresponds to a method call to the details
// of the method to be invoked
pub type method_map = @mut HashMap<ast::node_id, method_map_entry>;
pub type method_map = @mut HashMap<ast::NodeId, method_map_entry>;
pub type vtable_param_res = @~[vtable_origin];
// Resolutions for bounds of all parameters, left to right, for a given path.
@ -172,7 +172,7 @@ impl Repr for vtable_origin {
}
}
pub type vtable_map = @mut HashMap<ast::node_id, vtable_res>;
pub type vtable_map = @mut HashMap<ast::NodeId, vtable_res>;
// Information about the vtable resolutions for for a trait impl.
@ -205,13 +205,13 @@ pub struct CrateCtxt {
}
// Functions that write types into the node type table
pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) {
pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::NodeId, ty: ty::t) {
debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty));
assert!(!ty::type_needs_infer(ty));
tcx.node_types.insert(node_id as uint, ty);
}
pub fn write_substs_to_tcx(tcx: ty::ctxt,
node_id: ast::node_id,
node_id: ast::NodeId,
substs: ~[ty::t]) {
if substs.len() > 0u {
debug!("write_substs_to_tcx(%d, %?)", node_id,
@ -221,7 +221,7 @@ pub fn write_substs_to_tcx(tcx: ty::ctxt,
}
}
pub fn write_tpt_to_tcx(tcx: ty::ctxt,
node_id: ast::node_id,
node_id: ast::NodeId,
tpt: &ty::ty_param_substs_and_ty) {
write_ty_to_tcx(tcx, node_id, tpt.ty);
if !tpt.substs.tps.is_empty() {
@ -229,7 +229,7 @@ pub fn write_tpt_to_tcx(tcx: ty::ctxt,
}
}
pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::node_id) -> ast::def {
pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::NodeId) -> ast::def {
match tcx.def_map.find(&id) {
Some(&x) => x,
_ => {
@ -238,7 +238,7 @@ pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::node_id) -> ast::def {
}
}
pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: span, id: ast::node_id)
pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: span, id: ast::NodeId)
-> ast::def {
lookup_def_tcx(ccx.tcx, sp, id)
}
@ -308,7 +308,7 @@ impl get_and_find_region for isr_alist {
}
fn check_main_fn_ty(ccx: &CrateCtxt,
main_id: ast::node_id,
main_id: ast::NodeId,
main_span: span) {
let tcx = ccx.tcx;
let main_t = ty::node_id_to_type(tcx, main_id);
@ -352,7 +352,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
}
fn check_start_fn_ty(ccx: &CrateCtxt,
start_id: ast::node_id,
start_id: ast::NodeId,
start_span: span) {
let tcx = ccx.tcx;
let start_t = ty::node_id_to_type(tcx, start_id);

View file

@ -112,4 +112,4 @@ pub fn pluralize(n: uint, s: ~str) -> ~str {
}
// A set of node IDs (used to keep track of which node IDs are for statements)
pub type stmt_set = @mut HashSet<ast::node_id>;
pub type stmt_set = @mut HashSet<ast::NodeId>;

View file

@ -165,7 +165,7 @@ pub fn bound_region_to_str(cx: ctxt,
}
}
pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::NodeId) -> ~str {
match cx.items.find(&node_id) {
Some(&ast_map::node_block(ref blk)) => {
fmt!("<block at %s>",
@ -643,7 +643,7 @@ impl Repr for ast::def_id {
// Unfortunately, there seems to be no way to attempt to print
// a path for a def-id, so I'll just make a best effort for now
// and otherwise fallback to just printing the crate/node pair
if self.crate == ast::local_crate {
if self.crate == ast::LOCAL_CRATE {
match tcx.items.find(&self.node) {
Some(&ast_map::node_item(*)) |
Some(&ast_map::node_foreign_item(*)) |

View file

@ -84,7 +84,7 @@ fn fold_item(
let srv = fold.ctxt.clone();
let doc = fold::default_seq_fold_item(fold, doc);
let desc = if doc.id == ast::crate_node_id {
let desc = if doc.id == ast::CRATE_NODE_ID {
// This is the top-level mod, use the crate attributes
do astsrv::exec(srv) |ctxt| {
attr_parser::parse_desc(ctxt.ast.attrs.clone())

View file

@ -60,11 +60,11 @@ fn top_moddoc_from_crate(
crate: @ast::Crate,
default_name: ~str
) -> doc::ModDoc {
moddoc_from_mod(mk_itemdoc(ast::crate_node_id, default_name),
moddoc_from_mod(mk_itemdoc(ast::CRATE_NODE_ID, default_name),
crate.module.clone())
}
fn mk_itemdoc(id: ast::node_id, name: ~str) -> doc::ItemDoc {
fn mk_itemdoc(id: ast::NodeId, name: ~str) -> doc::ItemDoc {
doc::ItemDoc {
id: id,
name: name,

View file

@ -138,7 +138,7 @@ fn write_header_(ctxt: &Ctxt, lvl: Hlvl, title: ~str) {
pub fn header_kind(doc: doc::ItemTag) -> ~str {
match doc {
doc::ModTag(_) => {
if doc.id() == syntax::ast::crate_node_id {
if doc.id() == syntax::ast::CRATE_NODE_ID {
~"Crate"
} else {
~"Module"
@ -174,7 +174,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str {
pub fn header_name(doc: doc::ItemTag) -> ~str {
let fullpath = (doc.path() + &[doc.name_()]).connect("::");
match &doc {
&doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => {
&doc::ModTag(_) if doc.id() != syntax::ast::CRATE_NODE_ID => {
fullpath
}
&doc::NmodTag(_) => {

View file

@ -106,7 +106,7 @@ fn fold_crate(fold: &fold::Fold<PageChan>, doc: doc::CrateDoc)
fn fold_mod(fold: &fold::Fold<PageChan>, doc: doc::ModDoc) -> doc::ModDoc {
let doc = fold::default_any_fold_mod(fold, doc);
if doc.id() != ast::crate_node_id {
if doc.id() != ast::CRATE_NODE_ID {
let doc = strip_mod(doc.clone());
let page = doc::ItemPage(doc::ModTag(doc));

View file

@ -66,7 +66,7 @@ fn fold_item(fold: &fold::Fold<Ctxt>, doc: doc::ItemDoc) -> doc::ItemDoc {
}
fn fold_mod(fold: &fold::Fold<Ctxt>, doc: doc::ModDoc) -> doc::ModDoc {
let is_topmod = doc.id() == ast::crate_node_id;
let is_topmod = doc.id() == ast::CRATE_NODE_ID;
if !is_topmod { fold.ctxt.path.push(doc.name_()); }
let doc = fold::default_any_fold_mod(fold, doc);

View file

@ -14,7 +14,7 @@ use syntax::print::pp;
use syntax::print::pprust;
use syntax::parse::token;
pub fn each_binding(l: @ast::Local, f: @fn(&ast::Path, ast::node_id)) {
pub fn each_binding(l: @ast::Local, f: @fn(&ast::Path, ast::NodeId)) {
use syntax::visit;
let vt = visit::mk_simple_visitor(

View file

@ -94,7 +94,7 @@ pub type fn_ident = Option<ident>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct Lifetime {
id: node_id,
id: NodeId,
span: span,
ident: ident
}
@ -119,16 +119,16 @@ pub struct Path {
pub type CrateNum = int;
pub type node_id = int;
pub type NodeId = int;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct def_id {
crate: CrateNum,
node: node_id,
node: NodeId,
}
pub static local_crate: CrateNum = 0;
pub static crate_node_id: node_id = 0;
pub static LOCAL_CRATE: CrateNum = 0;
pub static CRATE_NODE_ID: NodeId = 0;
// The AST represents all type param bounds as types.
// typeck::collect::compute_bounds matches these against
@ -143,7 +143,7 @@ pub enum TyParamBound {
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct TyParam {
ident: ident,
id: node_id,
id: NodeId,
bounds: OptVec<TyParamBound>
}
@ -171,28 +171,28 @@ pub enum def {
def_static_method(/* method */ def_id,
/* trait */ Option<def_id>,
purity),
def_self(node_id, bool /* is_implicit */),
def_self_ty(/* trait id */ node_id),
def_self(NodeId, bool /* is_implicit */),
def_self_ty(/* trait id */ NodeId),
def_mod(def_id),
def_foreign_mod(def_id),
def_static(def_id, bool /* is_mutbl */),
def_arg(node_id, bool /* is_mutbl */),
def_local(node_id, bool /* is_mutbl */),
def_arg(NodeId, bool /* is_mutbl */),
def_local(NodeId, bool /* is_mutbl */),
def_variant(def_id /* enum */, def_id /* variant */),
def_ty(def_id),
def_trait(def_id),
def_prim_ty(prim_ty),
def_ty_param(def_id, uint),
def_binding(node_id, binding_mode),
def_binding(NodeId, binding_mode),
def_use(def_id),
def_upvar(node_id, // id of closed over var
def_upvar(NodeId, // id of closed over var
@def, // closed over def
node_id, // expr node that creates the closure
node_id), // id for the block/body of the closure expr
NodeId, // expr node that creates the closure
NodeId), // id for the block/body of the closure expr
def_struct(def_id),
def_typaram_binder(node_id), /* struct, impl or trait with ty params */
def_region(node_id),
def_label(node_id),
def_typaram_binder(NodeId), /* struct, impl or trait with ty params */
def_region(NodeId),
def_label(NodeId),
def_method(def_id /* method */, Option<def_id> /* trait */),
}
@ -248,14 +248,14 @@ pub struct Block {
view_items: ~[view_item],
stmts: ~[@stmt],
expr: Option<@expr>,
id: node_id,
rules: blk_check_mode,
id: NodeId,
rules: BlockCheckMode,
span: span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct pat {
id: node_id,
id: NodeId,
node: pat_,
span: span,
}
@ -280,7 +280,7 @@ pub enum pat_ {
// is None).
// In the nullary enum case, the parser can't determine
// which it is. The resolver determines this, and
// records this pattern's node_id in an auxiliary
// records this pattern's NodeId in an auxiliary
// set (of "pat_idents that refer to nullary enums")
pat_ident(binding_mode, Path, Option<@pat>),
pat_enum(Path, Option<~[@pat]>), /* "none" means a * pattern where
@ -371,13 +371,13 @@ pub type stmt = spanned<stmt_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum stmt_ {
// could be an item or a local (let) binding:
stmt_decl(@decl, node_id),
stmt_decl(@decl, NodeId),
// expr without trailing semi-colon (must have unit type):
stmt_expr(@expr, node_id),
stmt_expr(@expr, NodeId),
// expr with trailing semi-colon (may have any type):
stmt_semi(@expr, node_id),
stmt_semi(@expr, NodeId),
// bool: is there a trailing sem-colon?
stmt_mac(mac, bool),
@ -391,7 +391,7 @@ pub struct Local {
ty: Ty,
pat: @pat,
init: Option<@expr>,
id: node_id,
id: NodeId,
span: span,
}
@ -420,20 +420,20 @@ pub struct Field {
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum blk_check_mode {
default_blk,
unsafe_blk,
pub enum BlockCheckMode {
DefaultBlock,
UnsafeBlock,
}
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub struct expr {
id: node_id,
id: NodeId,
node: expr_,
span: span,
}
impl expr {
pub fn get_callee_id(&self) -> Option<node_id> {
pub fn get_callee_id(&self) -> Option<NodeId> {
match self.node {
expr_method_call(callee_id, _, _, _, _, _) |
expr_index(callee_id, _, _) |
@ -457,10 +457,10 @@ pub enum expr_ {
expr_vstore(@expr, expr_vstore),
expr_vec(~[@expr], mutability),
expr_call(@expr, ~[@expr], CallSugar),
expr_method_call(node_id, @expr, ident, ~[Ty], ~[@expr], CallSugar),
expr_method_call(NodeId, @expr, ident, ~[Ty], ~[@expr], CallSugar),
expr_tup(~[@expr]),
expr_binary(node_id, binop, @expr, @expr),
expr_unary(node_id, unop, @expr),
expr_binary(NodeId, binop, @expr, @expr),
expr_unary(NodeId, unop, @expr),
expr_lit(@lit),
expr_cast(@expr, Ty),
expr_if(@expr, Block, Option<@expr>),
@ -480,9 +480,9 @@ pub enum expr_ {
expr_block(Block),
expr_assign(@expr, @expr),
expr_assign_op(node_id, binop, @expr, @expr),
expr_assign_op(NodeId, binop, @expr, @expr),
expr_field(@expr, ident, ~[Ty]),
expr_index(node_id, @expr, @expr),
expr_index(NodeId, @expr, @expr),
expr_path(Path),
/// The special identifier `self`.
@ -636,22 +636,21 @@ pub struct mt {
}
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub struct ty_field_ {
pub struct TypeField {
ident: ident,
mt: mt,
span: span,
}
pub type ty_field = spanned<ty_field_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct ty_method {
pub struct TypeMethod {
ident: ident,
attrs: ~[Attribute],
purity: purity,
decl: fn_decl,
generics: Generics,
explicit_self: explicit_self,
id: node_id,
id: NodeId,
span: span,
}
@ -660,7 +659,7 @@ pub struct ty_method {
// implementation).
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum trait_method {
required(ty_method),
required(TypeMethod),
provided(@method),
}
@ -711,7 +710,7 @@ impl ToStr for float_ty {
// NB Eq method appears below.
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
pub struct Ty {
id: node_id,
id: NodeId,
node: ty_,
span: span,
}
@ -778,7 +777,7 @@ pub enum ty_ {
ty_closure(@TyClosure),
ty_bare_fn(@TyBareFn),
ty_tup(~[Ty]),
ty_path(Path, Option<OptVec<TyParamBound>>, node_id), // for #7264; see above
ty_path(Path, Option<OptVec<TyParamBound>>, NodeId), // for #7264; see above
ty_mac(mac),
// ty_infer means the type should be inferred instead of it having been
// specified. This should only appear at the "top level" of a type and not
@ -808,7 +807,7 @@ pub struct arg {
is_mutbl: bool,
ty: Ty,
pat: @pat,
id: node_id,
id: NodeId,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -863,9 +862,9 @@ pub struct method {
purity: purity,
decl: fn_decl,
body: Block,
id: node_id,
id: NodeId,
span: span,
self_id: node_id,
self_id: NodeId,
vis: visibility,
}
@ -893,7 +892,7 @@ pub struct foreign_mod {
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct variant_arg {
ty: Ty,
id: node_id,
id: NodeId,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -912,7 +911,7 @@ pub struct variant_ {
name: ident,
attrs: ~[Attribute],
kind: variant_kind,
id: node_id,
id: NodeId,
disr_expr: Option<@expr>,
vis: visibility,
}
@ -922,7 +921,7 @@ pub type variant = spanned<variant_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct path_list_ident_ {
name: ident,
id: node_id,
id: NodeId,
}
pub type path_list_ident = spanned<path_list_ident_>;
@ -937,13 +936,13 @@ pub enum view_path_ {
// or just
//
// foo::bar::baz (with 'baz =' implicitly on the left)
view_path_simple(ident, Path, node_id),
view_path_simple(ident, Path, NodeId),
// foo::bar::*
view_path_glob(Path, node_id),
view_path_glob(Path, NodeId),
// foo::bar::{a,b,c}
view_path_list(Path, ~[path_list_ident], node_id)
view_path_list(Path, ~[path_list_ident], NodeId)
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -956,7 +955,7 @@ pub struct view_item {
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum view_item_ {
view_item_extern_mod(ident, ~[@MetaItem], node_id),
view_item_extern_mod(ident, ~[@MetaItem], NodeId),
view_item_use(~[@view_path]),
}
@ -990,7 +989,7 @@ pub struct Attribute_ {
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
pub struct trait_ref {
path: Path,
ref_id: node_id,
ref_id: NodeId,
}
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
@ -1012,7 +1011,7 @@ impl visibility {
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub struct struct_field_ {
kind: struct_field_kind,
id: node_id,
id: NodeId,
ty: Ty,
attrs: ~[Attribute],
}
@ -1030,7 +1029,7 @@ pub struct struct_def {
fields: ~[@struct_field], /* fields, not including ctor */
/* ID of the constructor. This is only used for tuple- or enum-like
* structs. */
ctor_id: Option<node_id>
ctor_id: Option<NodeId>
}
/*
@ -1041,7 +1040,7 @@ pub struct struct_def {
pub struct item {
ident: ident,
attrs: ~[Attribute],
id: node_id,
id: NodeId,
node: item_,
vis: visibility,
span: span,
@ -1070,7 +1069,7 @@ pub struct foreign_item {
ident: ident,
attrs: ~[Attribute],
node: foreign_item_,
id: node_id,
id: NodeId,
span: span,
vis: visibility,
}

View file

@ -78,7 +78,7 @@ pub enum ast_node {
node_callee_scope(@expr)
}
pub type map = @mut HashMap<node_id, ast_node>;
pub type map = @mut HashMap<NodeId, ast_node>;
pub struct Ctx {
map: map,
@ -159,7 +159,7 @@ pub fn map_fn(
decl: &fn_decl,
body: &Block,
sp: codemap::span,
id: node_id,
id: NodeId,
(cx,v): (@mut Ctx,
visit::vt<@mut Ctx>)
) {
@ -313,7 +313,7 @@ pub fn map_stmt(stmt: @stmt, (cx,v): (@mut Ctx, visit::vt<@mut Ctx>)) {
visit::visit_stmt(stmt, (cx, v));
}
pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
pub fn node_id_to_str(map: map, id: NodeId, itr: @ident_interner) -> ~str {
match map.find(&id) {
None => {
fmt!("unknown node (id=%d)", id)
@ -376,7 +376,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
}
}
pub fn node_item_query<Result>(items: map, id: node_id,
pub fn node_item_query<Result>(items: map, id: NodeId,
query: &fn(@item) -> Result,
error_msg: ~str) -> Result {
match items.find(&id) {

View file

@ -31,13 +31,13 @@ pub fn path_to_ident(p: &Path) -> ident {
*p.idents.last()
}
pub fn local_def(id: node_id) -> def_id {
ast::def_id { crate: local_crate, node: id }
pub fn local_def(id: NodeId) -> def_id {
ast::def_id { crate: LOCAL_CRATE, node: id }
}
pub fn is_local(did: ast::def_id) -> bool { did.crate == local_crate }
pub fn is_local(did: ast::def_id) -> bool { did.crate == LOCAL_CRATE }
pub fn stmt_id(s: &stmt) -> node_id {
pub fn stmt_id(s: &stmt) -> NodeId {
match s.node {
stmt_decl(_, id) => id,
stmt_expr(_, id) => id,
@ -204,14 +204,14 @@ pub fn block_from_expr(e: @expr) -> Block {
pub fn default_block(
stmts1: ~[@stmt],
expr1: Option<@expr>,
id1: node_id
id1: NodeId
) -> Block {
ast::Block {
view_items: ~[],
stmts: stmts1,
expr: expr1,
id: id1,
rules: default_blk,
rules: DefaultBlock,
span: dummy_sp(),
}
}
@ -224,7 +224,7 @@ pub fn ident_to_path(s: span, i: ident) -> Path {
types: ~[] }
}
pub fn ident_to_pat(id: node_id, s: span, i: ident) -> @pat {
pub fn ident_to_pat(id: NodeId, s: span, i: ident) -> @pat {
@ast::pat { id: id,
node: pat_ident(bind_infer, ident_to_path(s, i), None),
span: s }
@ -254,13 +254,13 @@ pub fn public_methods(ms: ~[@method]) -> ~[@method] {
}.collect()
}
// extract a ty_method from a trait_method. if the trait_method is
// a default, pull out the useful fields to make a ty_method
pub fn trait_method_to_ty_method(method: &trait_method) -> ty_method {
// extract a TypeMethod from a trait_method. if the trait_method is
// a default, pull out the useful fields to make a TypeMethod
pub fn trait_method_to_ty_method(method: &trait_method) -> TypeMethod {
match *method {
required(ref m) => (*m).clone(),
provided(ref m) => {
ty_method {
TypeMethod {
ident: m.ident,
attrs: m.attrs.clone(),
purity: m.purity,
@ -275,7 +275,7 @@ pub fn trait_method_to_ty_method(method: &trait_method) -> ty_method {
}
pub fn split_trait_methods(trait_methods: &[trait_method])
-> (~[ty_method], ~[@method]) {
-> (~[TypeMethod], ~[@method]) {
let mut reqd = ~[];
let mut provd = ~[];
for trait_methods.iter().advance |trt_method| {
@ -296,7 +296,7 @@ pub fn struct_field_visibility(field: ast::struct_field) -> visibility {
pub trait inlined_item_utils {
fn ident(&self) -> ident;
fn id(&self) -> ast::node_id;
fn id(&self) -> ast::NodeId;
fn accept<E: Clone>(&self, e: E, v: visit::vt<E>);
}
@ -309,7 +309,7 @@ impl inlined_item_utils for inlined_item {
}
}
fn id(&self) -> ast::node_id {
fn id(&self) -> ast::NodeId {
match *self {
ii_item(i) => i.id,
ii_foreign(i) => i.id,
@ -367,8 +367,8 @@ pub fn empty_generics() -> Generics {
#[deriving(Encodable, Decodable)]
pub struct id_range {
min: node_id,
max: node_id,
min: NodeId,
max: NodeId,
}
impl id_range {
@ -383,13 +383,13 @@ impl id_range {
self.min >= self.max
}
pub fn add(&mut self, id: node_id) {
pub fn add(&mut self, id: NodeId) {
self.min = num::min(self.min, id);
self.max = num::max(self.max, id + 1);
}
}
pub fn id_visitor<T: Clone>(vfn: @fn(node_id, T)) -> visit::vt<T> {
pub fn id_visitor<T: Clone>(vfn: @fn(NodeId, T)) -> visit::vt<T> {
let visit_generics: @fn(&Generics, T) = |generics, t| {
for generics.ty_params.iter().advance |p| {
vfn(p.id, t.clone());
@ -515,11 +515,11 @@ pub fn id_visitor<T: Clone>(vfn: @fn(node_id, T)) -> visit::vt<T> {
})
}
pub fn visit_ids_for_inlined_item(item: &inlined_item, vfn: @fn(node_id)) {
pub fn visit_ids_for_inlined_item(item: &inlined_item, vfn: @fn(NodeId)) {
item.accept((), id_visitor(|id, ()| vfn(id)));
}
pub fn compute_id_range(visit_ids_fn: &fn(@fn(node_id))) -> id_range {
pub fn compute_id_range(visit_ids_fn: &fn(@fn(NodeId))) -> id_range {
let result = @mut id_range::max();
do visit_ids_fn |id| {
result.add(id);
@ -581,7 +581,7 @@ impl EachViewItem for ast::Crate {
}
}
pub fn view_path_id(p: &view_path) -> node_id {
pub fn view_path_id(p: &view_path) -> NodeId {
match p.node {
view_path_simple(_, _, id) |
view_path_glob(_, id) |

View file

@ -294,7 +294,7 @@ impl ExtCtxt {
self.print_backtrace();
self.parse_sess.span_diagnostic.handler().bug(msg);
}
pub fn next_id(&self) -> ast::node_id {
pub fn next_id(&self) -> ast::NodeId {
parse::next_node_id(self.parse_sess)
}
pub fn trace_macros(&self) -> bool {

View file

@ -62,7 +62,7 @@ pub trait AstBuilder {
fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::ty_field;
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField;
fn strip_bounds(&self, bounds: &Generics) -> Generics;
fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
@ -306,12 +306,12 @@ impl AstBuilder for @ExtCtxt {
~[ ty ]), None)
}
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::ty_field {
respan(span,
ast::ty_field_ {
ident: name,
mt: ast::mt { ty: ~ty, mutbl: ast::m_imm },
})
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField {
ast::TypeField {
ident: name,
mt: ast::mt { ty: ~ty, mutbl: ast::m_imm },
span: span,
}
}
fn ty_infer(&self, span: span) -> ast::Ty {
@ -404,7 +404,7 @@ impl AstBuilder for @ExtCtxt {
stmts: stmts,
expr: expr,
id: self.next_id(),
rules: ast::default_blk,
rules: ast::DefaultBlock,
span: span,
}
}

View file

@ -36,7 +36,7 @@ pub trait ast_fold {
fn fold_path(@self, &Path) -> Path;
fn fold_local(@self, @Local) -> @Local;
fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr];
fn new_id(@self, node_id) -> node_id;
fn new_id(@self, NodeId) -> NodeId;
fn new_span(@self, span) -> span;
}
@ -65,7 +65,7 @@ pub struct AstFoldFns {
fold_path: @fn(&Path, @ast_fold) -> Path,
fold_local: @fn(@Local, @ast_fold) -> @Local,
map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr],
new_id: @fn(node_id) -> node_id,
new_id: @fn(NodeId) -> NodeId,
new_span: @fn(span) -> span
}
@ -646,12 +646,10 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
mutbl: mt.mutbl,
}
}
fn fold_field(f: ty_field, fld: @ast_fold) -> ty_field {
spanned {
node: ast::ty_field_ {
ident: fld.fold_ident(f.node.ident),
mt: fold_mt(&f.node.mt, fld),
},
fn fold_field(f: TypeField, fld: @ast_fold) -> TypeField {
ast::TypeField {
ident: fld.fold_ident(f.ident),
mt: fold_mt(&f.mt, fld),
span: fld.new_span(f.span),
}
}
@ -787,7 +785,7 @@ fn noop_map_exprs(f: @fn(@expr) -> @expr, es: &[@expr]) -> ~[@expr] {
es.map(|x| f(*x))
}
fn noop_id(i: node_id) -> node_id { return i; }
fn noop_id(i: NodeId) -> NodeId { return i; }
fn noop_span(sp: span) -> span { return sp; }
@ -924,7 +922,7 @@ impl ast_fold for AstFoldFns {
-> ~[@expr] {
(self.map_exprs)(f, e)
}
fn new_id(@self, node_id: ast::node_id) -> node_id {
fn new_id(@self, node_id: ast::NodeId) -> NodeId {
(self.new_id)(node_id)
}
fn new_span(@self, span: span) -> span {

View file

@ -39,7 +39,7 @@ pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
pub fn expr_is_simple_block(e: @ast::expr) -> bool {
match e.node {
ast::expr_block(
ast::Block { rules: ast::default_blk, _ }
ast::Block { rules: ast::DefaultBlock, _ }
) => true,
_ => false
}

View file

@ -11,7 +11,7 @@
//! The main parser interface
use ast::node_id;
use ast::NodeId;
use ast;
use codemap::{span, CodeMap, FileMap, FileSubstr};
use codemap;
@ -42,7 +42,7 @@ pub mod obsolete;
// info about a parsing session.
pub struct ParseSess {
cm: @codemap::CodeMap, // better be the same as the one in the reader!
next_id: node_id,
next_id: NodeId,
span_diagnostic: @span_handler, // better be the same as the one in the reader!
/// Used to determine and report recursive mod inclusions
included_mod_stack: ~[Path],
@ -202,7 +202,7 @@ pub fn parse_from_source_str<T>(
}
// return the next unused node id.
pub fn next_node_id(sess: @mut ParseSess) -> node_id {
pub fn next_node_id(sess: @mut ParseSess) -> NodeId {
let rv = sess.next_id;
sess.next_id += 1;
// ID 0 is reserved for the crate and doesn't actually exist in the AST
@ -506,7 +506,7 @@ mod test {
// check the contents of the tt manually:
#[test] fn parse_fundecl () {
// this test depends on the intern order of "fn" and "int", and on the
// assignment order of the node_ids.
// assignment order of the NodeIds.
assert_eq!(string_to_item(@"fn a (b : int) { b; }"),
Some(
@ast::item{ident:str_to_ident("a"),
@ -566,7 +566,7 @@ mod test {
span: sp(17,18)}],
expr: None,
id: 8, // fixme
rules: ast::default_blk, // no idea
rules: ast::DefaultBlock, // no idea
span: sp(15,21),
}),
vis: ast::inherited,

View file

@ -17,9 +17,9 @@ use ast::{RegionTyParamBound, TraitTyParamBound};
use ast::{provided, public, purity};
use ast::{_mod, add, arg, arm, Attribute, bind_by_ref, bind_infer};
use ast::{bitand, bitor, bitxor, Block};
use ast::{blk_check_mode, box};
use ast::{BlockCheckMode, box};
use ast::{Crate, CrateConfig, decl, decl_item};
use ast::{decl_local, default_blk, deref, div, enum_def, explicit_self};
use ast::{decl_local, DefaultBlock, deref, div, enum_def, explicit_self};
use ast::{expr, expr_, expr_addr_of, expr_match, expr_again};
use ast::{expr_assign, expr_assign_op, expr_binary, expr_block};
use ast::{expr_break, expr_call, expr_cast, expr_do_body};
@ -39,7 +39,7 @@ use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, Local, m_const};
use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
use ast::{match_seq, match_tok, method, mt, mul, mutability};
use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
use ast::{named_field, neg, NodeId, noreturn, not, pat, pat_box, pat_enum};
use ast::{pat_ident, pat_lit, pat_range, pat_region, pat_struct};
use ast::{pat_tup, pat_uniq, pat_wild, private};
use ast::{rem, required};
@ -49,11 +49,11 @@ use ast::{struct_variant_kind, subtract};
use ast::{sty_box, sty_region, sty_static, sty_uniq, sty_value};
use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok};
use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box};
use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn};
use ast::{ty_infer, ty_method};
use ast::{TypeField, ty_fixed_length_vec, ty_closure, ty_bare_fn};
use ast::{ty_infer, TypeMethod};
use ast::{ty_nil, TyParam, TyParamBound, ty_path, ty_ptr, ty_rptr};
use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, uniq};
use ast::{unnamed_field, unsafe_blk, unsafe_fn, view_item};
use ast::{unnamed_field, UnsafeBlock, unsafe_fn, view_item};
use ast::{view_item_, view_item_extern_mod, view_item_use};
use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
use ast::visibility;
@ -645,7 +645,7 @@ impl Parser {
pub fn abort_if_errors(&self) {
self.sess.span_diagnostic.handler().abort_if_errors();
}
pub fn get_id(&self) -> node_id { next_node_id(self.sess) }
pub fn get_id(&self) -> NodeId { next_node_id(self.sess) }
pub fn id_to_str(&self, id: ident) -> @str {
get_ident_interner().get(id.name)
@ -837,7 +837,7 @@ impl Parser {
debug!("parse_trait_methods(): parsing required method");
// NB: at the moment, visibility annotations on required
// methods are ignored; this could change.
required(ty_method {
required(TypeMethod {
ident: ident,
attrs: attrs,
purity: pur,
@ -889,20 +889,18 @@ impl Parser {
// parse [mut/const/imm] ID : TY
// now used only by obsolete record syntax parser...
pub fn parse_ty_field(&self) -> ty_field {
pub fn parse_ty_field(&self) -> TypeField {
let lo = self.span.lo;
let mutbl = self.parse_mutability();
let id = self.parse_ident();
self.expect(&token::COLON);
let ty = ~self.parse_ty(false);
spanned(
lo,
ty.span.hi,
ast::ty_field_ {
ident: id,
mt: ast::mt { ty: ty, mutbl: mutbl },
}
)
let hi = ty.span.hi;
ast::TypeField {
ident: id,
mt: ast::mt { ty: ty, mutbl: mutbl },
span: mk_sp(lo, hi),
}
}
// parse optional return type [ -> TY ] in function decl
@ -1614,7 +1612,7 @@ impl Parser {
}
} else if *self.token == token::LBRACE {
self.bump();
let blk = self.parse_block_tail(lo, default_blk);
let blk = self.parse_block_tail(lo, DefaultBlock);
return self.mk_expr(blk.span.lo, blk.span.hi,
expr_block(blk));
} else if token::is_bar(&*self.token) {
@ -1643,7 +1641,7 @@ impl Parser {
} else if self.eat_keyword(keywords::Match) {
return self.parse_match_expr();
} else if self.eat_keyword(keywords::Unsafe) {
return self.parse_block_expr(lo, unsafe_blk);
return self.parse_block_expr(lo, UnsafeBlock);
} else if *self.token == token::LBRACKET {
self.bump();
let mutbl = self.parse_mutability();
@ -1779,7 +1777,7 @@ impl Parser {
}
// parse a block or unsafe block
pub fn parse_block_expr(&self, lo: BytePos, blk_mode: blk_check_mode)
pub fn parse_block_expr(&self, lo: BytePos, blk_mode: BlockCheckMode)
-> @expr {
self.expect(&token::LBRACE);
let blk = self.parse_block_tail(lo, blk_mode);
@ -2308,7 +2306,7 @@ impl Parser {
stmts: ~[],
expr: Some(body),
id: self.get_id(),
rules: default_blk,
rules: DefaultBlock,
span: body.span,
};
@ -2474,7 +2472,7 @@ impl Parser {
stmts: ~[],
expr: Some(expr),
id: self.get_id(),
rules: default_blk,
rules: DefaultBlock,
span: expr.span,
};
@ -3093,7 +3091,7 @@ impl Parser {
}
self.expect(&token::LBRACE);
return self.parse_block_tail_(lo, default_blk, ~[]);
return self.parse_block_tail_(lo, DefaultBlock, ~[]);
}
// parse a block. Inner attrs are allowed.
@ -3109,19 +3107,19 @@ impl Parser {
self.expect(&token::LBRACE);
let (inner, next) = self.parse_inner_attrs_and_next();
(inner, self.parse_block_tail_(lo, default_blk, next))
(inner, self.parse_block_tail_(lo, DefaultBlock, next))
}
// Precondition: already parsed the '{' or '#{'
// I guess that also means "already parsed the 'impure'" if
// necessary, and this should take a qualifier.
// some blocks start with "#{"...
fn parse_block_tail(&self, lo: BytePos, s: blk_check_mode) -> Block {
fn parse_block_tail(&self, lo: BytePos, s: BlockCheckMode) -> Block {
self.parse_block_tail_(lo, s, ~[])
}
// parse the rest of a block expression or function body
fn parse_block_tail_(&self, lo: BytePos, s: blk_check_mode,
fn parse_block_tail_(&self, lo: BytePos, s: BlockCheckMode,
first_item_attrs: ~[Attribute]) -> Block {
let mut stmts = ~[];
let mut expr = None;

View file

@ -807,7 +807,7 @@ pub fn print_variant(s: @ps, v: &ast::variant) {
}
}
pub fn print_ty_method(s: @ps, m: &ast::ty_method) {
pub fn print_ty_method(s: @ps, m: &ast::TypeMethod) {
hardbreak_if_not_bol(s);
maybe_print_comment(s, m.span.lo);
print_outer_attributes(s, m.attrs);
@ -948,8 +948,8 @@ pub fn print_possibly_embedded_block_(s: @ps,
attrs: &[ast::Attribute],
close_box: bool) {
match blk.rules {
ast::unsafe_blk => word_space(s, "unsafe"),
ast::default_blk => ()
ast::UnsafeBlock => word_space(s, "unsafe"),
ast::DefaultBlock => ()
}
maybe_print_comment(s, blk.span.lo);
let ann_node = node_block(s, blk);
@ -1272,7 +1272,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
// in the case of foo => expr
if arm.body.view_items.is_empty() &&
arm.body.stmts.is_empty() &&
arm.body.rules == ast::default_blk &&
arm.body.rules == ast::DefaultBlock &&
arm.body.expr.is_some()
{
match arm.body.expr {

View file

@ -71,7 +71,7 @@ pub fn generics_of_fn(fk: &fn_kind) -> Generics {
}
pub struct Visitor<E> {
visit_mod: @fn(&_mod, span, node_id, (E, vt<E>)),
visit_mod: @fn(&_mod, span, NodeId, (E, vt<E>)),
visit_view_item: @fn(&view_item, (E, vt<E>)),
visit_foreign_item: @fn(@foreign_item, (E, vt<E>)),
visit_item: @fn(@item, (E, vt<E>)),
@ -85,10 +85,10 @@ pub struct Visitor<E> {
visit_expr_post: @fn(@expr, (E, vt<E>)),
visit_ty: @fn(&Ty, (E, vt<E>)),
visit_generics: @fn(&Generics, (E, vt<E>)),
visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, node_id, (E, vt<E>)),
visit_ty_method: @fn(&ty_method, (E, vt<E>)),
visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, NodeId, (E, vt<E>)),
visit_ty_method: @fn(&TypeMethod, (E, vt<E>)),
visit_trait_method: @fn(&trait_method, (E, vt<E>)),
visit_struct_def: @fn(@struct_def, ident, &Generics, node_id, (E, vt<E>)),
visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId, (E, vt<E>)),
visit_struct_field: @fn(@struct_field, (E, vt<E>)),
}
@ -119,12 +119,12 @@ pub fn default_visitor<E:Clone>() -> visitor<E> {
}
pub fn visit_crate<E:Clone>(c: &Crate, (e, v): (E, vt<E>)) {
(v.visit_mod)(&c.module, c.span, crate_node_id, (e, v));
(v.visit_mod)(&c.module, c.span, CRATE_NODE_ID, (e, v));
}
pub fn visit_mod<E:Clone>(m: &_mod,
_sp: span,
_id: node_id,
_id: NodeId,
(e, v): (E, vt<E>)) {
for m.view_items.iter().advance |vi| {
(v.visit_view_item)(vi, (e.clone(), v));
@ -387,14 +387,14 @@ pub fn visit_method_helper<E:Clone>(m: &method, (e, v): (E, vt<E>)) {
}
pub fn visit_fn<E:Clone>(fk: &fn_kind, decl: &fn_decl, body: &Block, _sp: span,
_id: node_id, (e, v): (E, vt<E>)) {
_id: NodeId, (e, v): (E, vt<E>)) {
visit_fn_decl(decl, (e.clone(), v));
let generics = generics_of_fn(fk);
(v.visit_generics)(&generics, (e.clone(), v));
(v.visit_block)(body, (e, v));
}
pub fn visit_ty_method<E:Clone>(m: &ty_method, (e, v): (E, vt<E>)) {
pub fn visit_ty_method<E:Clone>(m: &TypeMethod, (e, v): (E, vt<E>)) {
for m.decl.inputs.iter().advance |a| {
(v.visit_ty)(&a.ty, (e.clone(), v));
}
@ -413,7 +413,7 @@ pub fn visit_struct_def<E:Clone>(
sd: @struct_def,
_nm: ast::ident,
_generics: &Generics,
_id: node_id,
_id: NodeId,
(e, v): (E, vt<E>)
) {
for sd.fields.iter().advance |f| {
@ -579,7 +579,7 @@ pub fn visit_arm<E:Clone>(a: &arm, (e, v): (E, vt<E>)) {
// calls the given functions on the nodes.
pub struct SimpleVisitor {
visit_mod: @fn(&_mod, span, node_id),
visit_mod: @fn(&_mod, span, NodeId),
visit_view_item: @fn(&view_item),
visit_foreign_item: @fn(@foreign_item),
visit_item: @fn(@item),
@ -593,10 +593,10 @@ pub struct SimpleVisitor {
visit_expr_post: @fn(@expr),
visit_ty: @fn(&Ty),
visit_generics: @fn(&Generics),
visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, node_id),
visit_ty_method: @fn(&ty_method),
visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, NodeId),
visit_ty_method: @fn(&TypeMethod),
visit_trait_method: @fn(&trait_method),
visit_struct_def: @fn(@struct_def, ident, &Generics, node_id),
visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId),
visit_struct_field: @fn(@struct_field),
visit_struct_method: @fn(@method)
}
@ -632,10 +632,10 @@ pub fn default_simple_visitor() -> @SimpleVisitor {
pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
fn v_mod(
f: @fn(&_mod, span, node_id),
f: @fn(&_mod, span, NodeId),
m: &_mod,
sp: span,
id: node_id,
id: NodeId,
(e, v): ((), vt<()>)
) {
f(m, sp, id);
@ -688,7 +688,7 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
f(ty);
visit_ty(ty, (e, v));
}
fn v_ty_method(f: @fn(&ty_method), ty: &ty_method, (e, v): ((), vt<()>)) {
fn v_ty_method(f: @fn(&TypeMethod), ty: &TypeMethod, (e, v): ((), vt<()>)) {
f(ty);
visit_ty_method(ty, (e, v));
}
@ -699,11 +699,11 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
visit_trait_method(m, (e, v));
}
fn v_struct_def(
f: @fn(@struct_def, ident, &Generics, node_id),
f: @fn(@struct_def, ident, &Generics, NodeId),
sd: @struct_def,
nm: ident,
generics: &Generics,
id: node_id,
id: NodeId,
(e, v): ((), vt<()>)
) {
f(sd, nm, generics, id);
@ -718,12 +718,12 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
visit_generics(ps, (e, v));
}
fn v_fn(
f: @fn(&fn_kind, &fn_decl, &Block, span, node_id),
f: @fn(&fn_kind, &fn_decl, &Block, span, NodeId),
fk: &fn_kind,
decl: &fn_decl,
body: &Block,
sp: span,
id: node_id,
id: NodeId,
(e, v): ((), vt<()>)
) {
f(fk, decl, body, sp, id);

View file

@ -23,7 +23,7 @@ use syntax::print::*;
trait fake_ext_ctxt {
fn cfg() -> ast::Crate_cfg;
fn cfg() -> ast::CrateConfig;
fn parse_sess() -> parse::parse_sess;
fn call_site() -> span;
fn ident_of(st: &str) -> ast::ident;
@ -32,7 +32,7 @@ trait fake_ext_ctxt {
type fake_session = parse::parse_sess;
impl fake_ext_ctxt for fake_session {
fn cfg() -> ast::Crate_cfg { ~[] }
fn cfg() -> ast::CrateConfig { ~[] }
fn parse_sess() -> parse::parse_sess { self }
fn call_site() -> span {
codemap::span {

View file

@ -22,7 +22,7 @@ use syntax::parse::parser;
use syntax::print::*;
trait fake_ext_ctxt {
fn cfg() -> ast::Crate_cfg;
fn cfg() -> ast::CrateConfig;
fn parse_sess() -> parse::parse_sess;
fn call_site() -> span;
fn ident_of(st: &str) -> ast::ident;
@ -31,7 +31,7 @@ trait fake_ext_ctxt {
type fake_session = parse::parse_sess;
impl fake_ext_ctxt for fake_session {
fn cfg() -> ast::Crate_cfg { ~[] }
fn cfg() -> ast::CrateConfig { ~[] }
fn parse_sess() -> parse::parse_sess { self }
fn call_site() -> span {
codemap::span {

View file

@ -32,18 +32,18 @@ fn new_parse_sess() -> parser::parse_sess {
trait fake_ext_ctxt {
fn session() -> fake_session;
fn cfg() -> ast::Crate_cfg;
fn cfg() -> ast::CrateConfig;
fn parse_sess() -> parser::parse_sess;
}
type fake_options = {cfg: ast::Crate_cfg};
type fake_options = {cfg: ast::CrateConfig};
type fake_session = {opts: @fake_options,
parse_sess: parser::parse_sess};
impl of fake_ext_ctxt for fake_session {
fn session() -> fake_session {self}
fn cfg() -> ast::Crate_cfg { self.opts.cfg }
fn cfg() -> ast::CrateConfig { self.opts.cfg }
fn parse_sess() -> parser::parse_sess { self.parse_sess }
}

View file

@ -24,7 +24,7 @@ use syntax::print::*;
trait fake_ext_ctxt {
fn cfg() -> ast::Crate_cfg;
fn cfg() -> ast::CrateConfig;
fn parse_sess() -> parse::parse_sess;
fn call_site() -> span;
fn ident_of(st: &str) -> ast::ident;
@ -33,7 +33,7 @@ trait fake_ext_ctxt {
type fake_session = parse::parse_sess;
impl fake_ext_ctxt for fake_session {
fn cfg() -> ast::Crate_cfg { ~[] }
fn cfg() -> ast::CrateConfig { ~[] }
fn parse_sess() -> parse::parse_sess { self }
fn call_site() -> span {
codemap::span {