Skip to content

Commit

Permalink
rustc: Rename NodeLocal to NodeBinding
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Aug 18, 2017
1 parent 59ccba9 commit 9b6f9d0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<'hir> Visitor<'hir> for NodeCollector<'hir> {

fn visit_pat(&mut self, pat: &'hir Pat) {
let node = if let PatKind::Binding(..) = pat.node {
NodeLocal(pat)
NodeBinding(pat)
} else {
NodePat(pat)
};
Expand Down
22 changes: 11 additions & 11 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum Node<'hir> {
NodeStmt(&'hir Stmt),
NodeTy(&'hir Ty),
NodeTraitRef(&'hir TraitRef),
NodeLocal(&'hir Pat),
NodeBinding(&'hir Pat),
NodePat(&'hir Pat),
NodeBlock(&'hir Block),

Expand Down Expand Up @@ -83,7 +83,7 @@ enum MapEntry<'hir> {
EntryStmt(NodeId, &'hir Stmt),
EntryTy(NodeId, &'hir Ty),
EntryTraitRef(NodeId, &'hir TraitRef),
EntryLocal(NodeId, &'hir Pat),
EntryBinding(NodeId, &'hir Pat),
EntryPat(NodeId, &'hir Pat),
EntryBlock(NodeId, &'hir Block),
EntryStructCtor(NodeId, &'hir VariantData),
Expand Down Expand Up @@ -114,7 +114,7 @@ impl<'hir> MapEntry<'hir> {
NodeStmt(n) => EntryStmt(p, n),
NodeTy(n) => EntryTy(p, n),
NodeTraitRef(n) => EntryTraitRef(p, n),
NodeLocal(n) => EntryLocal(p, n),
NodeBinding(n) => EntryBinding(p, n),
NodePat(n) => EntryPat(p, n),
NodeBlock(n) => EntryBlock(p, n),
NodeStructCtor(n) => EntryStructCtor(p, n),
Expand All @@ -136,7 +136,7 @@ impl<'hir> MapEntry<'hir> {
EntryStmt(id, _) => id,
EntryTy(id, _) => id,
EntryTraitRef(id, _) => id,
EntryLocal(id, _) => id,
EntryBinding(id, _) => id,
EntryPat(id, _) => id,
EntryBlock(id, _) => id,
EntryStructCtor(id, _) => id,
Expand All @@ -161,7 +161,7 @@ impl<'hir> MapEntry<'hir> {
EntryStmt(_, n) => NodeStmt(n),
EntryTy(_, n) => NodeTy(n),
EntryTraitRef(_, n) => NodeTraitRef(n),
EntryLocal(_, n) => NodeLocal(n),
EntryBinding(_, n) => NodeBinding(n),
EntryPat(_, n) => NodePat(n),
EntryBlock(_, n) => NodeBlock(n),
EntryStructCtor(_, n) => NodeStructCtor(n),
Expand Down Expand Up @@ -319,7 +319,7 @@ impl<'hir> Map<'hir> {
EntryStmt(p, _) |
EntryTy(p, _) |
EntryTraitRef(p, _) |
EntryLocal(p, _) |
EntryBinding(p, _) |
EntryPat(p, _) |
EntryBlock(p, _) |
EntryStructCtor(p, _) |
Expand Down Expand Up @@ -589,7 +589,7 @@ impl<'hir> Map<'hir> {
/// immediate parent is an item or a closure.
pub fn is_argument(&self, id: NodeId) -> bool {
match self.find(id) {
Some(NodeLocal(_)) => (),
Some(NodeBinding(_)) => (),
_ => return false,
}
match self.find(self.get_parent_node(id)) {
Expand Down Expand Up @@ -856,7 +856,7 @@ impl<'hir> Map<'hir> {
NodeField(f) => f.name,
NodeLifetime(lt) => lt.name,
NodeTyParam(tp) => tp.name,
NodeLocal(&Pat { node: PatKind::Binding(_,_,l,_), .. }) => l.node,
NodeBinding(&Pat { node: PatKind::Binding(_,_,l,_), .. }) => l.node,
NodeStructCtor(_) => self.name(self.get_parent(id)),
_ => bug!("no name for {}", self.node_to_string(id))
}
Expand Down Expand Up @@ -915,7 +915,7 @@ impl<'hir> Map<'hir> {
Some(EntryStmt(_, stmt)) => stmt.span,
Some(EntryTy(_, ty)) => ty.span,
Some(EntryTraitRef(_, tr)) => tr.path.span,
Some(EntryLocal(_, pat)) => pat.span,
Some(EntryBinding(_, pat)) => pat.span,
Some(EntryPat(_, pat)) => pat.span,
Some(EntryBlock(_, block)) => block.span,
Some(EntryStructCtor(_, _)) => self.expect_item(self.get_parent(id)).span,
Expand Down Expand Up @@ -1112,7 +1112,7 @@ impl<'a> print::State<'a> {
NodeStmt(a) => self.print_stmt(&a),
NodeTy(a) => self.print_type(&a),
NodeTraitRef(a) => self.print_trait_ref(&a),
NodeLocal(a) |
NodeBinding(a) |
NodePat(a) => self.print_pat(&a),
NodeBlock(a) => {
use syntax::print::pprust::PrintState;
Expand Down Expand Up @@ -1223,7 +1223,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
Some(NodeTraitRef(_)) => {
format!("trait_ref {}{}", map.node_to_pretty_string(id), id_str)
}
Some(NodeLocal(_)) => {
Some(NodeBinding(_)) => {
format!("local {}{}", map.node_to_pretty_string(id), id_str)
}
Some(NodePat(_)) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl MutabilityCategory {

fn from_local(tcx: TyCtxt, tables: &ty::TypeckTables, id: ast::NodeId) -> MutabilityCategory {
let ret = match tcx.hir.get(id) {
hir_map::NodeLocal(p) => match p.node {
hir_map::NodeBinding(p) => match p.node {
PatKind::Binding(..) => {
let bm = *tables.pat_binding_modes()
.get(p.hir_id)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

pub fn local_var_name_str(self, id: NodeId) -> InternedString {
match self.hir.find(id) {
Some(hir_map::NodeLocal(pat)) => {
Some(hir_map::NodeBinding(pat)) => {
match pat.node {
hir::PatKind::Binding(_, _, ref path1, _) => path1.node.as_str(),
_ => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {

fn local_binding_mode(&self, node_id: ast::NodeId) -> ty::BindingMode {
let pat = match self.tcx.hir.get(node_id) {
hir_map::Node::NodeLocal(pat) => pat,
hir_map::Node::NodeBinding(pat) => pat,
node => bug!("bad node for local: {:?}", node)
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
debug_name: keywords::Invalid.name(),
by_ref,
};
if let Some(hir::map::NodeLocal(pat)) = tcx.hir.find(var_node_id) {
if let Some(hir::map::NodeBinding(pat)) = tcx.hir.find(var_node_id) {
if let hir::PatKind::Binding(_, _, ref ident, _) = pat.node {
decl.debug_name = ident.node;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
self.tables.qpath_def(qpath, hir_id)
}

Node::NodeLocal(&hir::Pat { node: hir::PatKind::Binding(_, def_id, ..), .. }) => {
Node::NodeBinding(&hir::Pat { node: hir::PatKind::Binding(_, def_id, ..), .. }) => {
HirDef::Local(def_id)
}

Expand Down

0 comments on commit 9b6f9d0

Please sign in to comment.