@@ -53,9 +53,10 @@ pub enum Node<'hir> {
53
53
NodeStmt ( & ' hir Stmt ) ,
54
54
NodeTy ( & ' hir Ty ) ,
55
55
NodeTraitRef ( & ' hir TraitRef ) ,
56
- NodeLocal ( & ' hir Pat ) ,
56
+ NodeBinding ( & ' hir Pat ) ,
57
57
NodePat ( & ' hir Pat ) ,
58
58
NodeBlock ( & ' hir Block ) ,
59
+ NodeLocal ( & ' hir Local ) ,
59
60
60
61
/// NodeStructCtor represents a tuple struct.
61
62
NodeStructCtor ( & ' hir VariantData ) ,
@@ -83,13 +84,14 @@ enum MapEntry<'hir> {
83
84
EntryStmt ( NodeId , & ' hir Stmt ) ,
84
85
EntryTy ( NodeId , & ' hir Ty ) ,
85
86
EntryTraitRef ( NodeId , & ' hir TraitRef ) ,
86
- EntryLocal ( NodeId , & ' hir Pat ) ,
87
+ EntryBinding ( NodeId , & ' hir Pat ) ,
87
88
EntryPat ( NodeId , & ' hir Pat ) ,
88
89
EntryBlock ( NodeId , & ' hir Block ) ,
89
90
EntryStructCtor ( NodeId , & ' hir VariantData ) ,
90
91
EntryLifetime ( NodeId , & ' hir Lifetime ) ,
91
92
EntryTyParam ( NodeId , & ' hir TyParam ) ,
92
93
EntryVisibility ( NodeId , & ' hir Visibility ) ,
94
+ EntryLocal ( NodeId , & ' hir Local ) ,
93
95
94
96
/// Roots for node trees.
95
97
RootCrate ,
@@ -114,13 +116,14 @@ impl<'hir> MapEntry<'hir> {
114
116
NodeStmt ( n) => EntryStmt ( p, n) ,
115
117
NodeTy ( n) => EntryTy ( p, n) ,
116
118
NodeTraitRef ( n) => EntryTraitRef ( p, n) ,
117
- NodeLocal ( n) => EntryLocal ( p, n) ,
119
+ NodeBinding ( n) => EntryBinding ( p, n) ,
118
120
NodePat ( n) => EntryPat ( p, n) ,
119
121
NodeBlock ( n) => EntryBlock ( p, n) ,
120
122
NodeStructCtor ( n) => EntryStructCtor ( p, n) ,
121
123
NodeLifetime ( n) => EntryLifetime ( p, n) ,
122
124
NodeTyParam ( n) => EntryTyParam ( p, n) ,
123
125
NodeVisibility ( n) => EntryVisibility ( p, n) ,
126
+ NodeLocal ( n) => EntryLocal ( p, n) ,
124
127
}
125
128
}
126
129
@@ -136,13 +139,14 @@ impl<'hir> MapEntry<'hir> {
136
139
EntryStmt ( id, _) => id,
137
140
EntryTy ( id, _) => id,
138
141
EntryTraitRef ( id, _) => id,
139
- EntryLocal ( id, _) => id,
142
+ EntryBinding ( id, _) => id,
140
143
EntryPat ( id, _) => id,
141
144
EntryBlock ( id, _) => id,
142
145
EntryStructCtor ( id, _) => id,
143
146
EntryLifetime ( id, _) => id,
144
147
EntryTyParam ( id, _) => id,
145
148
EntryVisibility ( id, _) => id,
149
+ EntryLocal ( id, _) => id,
146
150
147
151
NotPresent |
148
152
RootCrate => return None ,
@@ -161,13 +165,14 @@ impl<'hir> MapEntry<'hir> {
161
165
EntryStmt ( _, n) => NodeStmt ( n) ,
162
166
EntryTy ( _, n) => NodeTy ( n) ,
163
167
EntryTraitRef ( _, n) => NodeTraitRef ( n) ,
164
- EntryLocal ( _, n) => NodeLocal ( n) ,
168
+ EntryBinding ( _, n) => NodeBinding ( n) ,
165
169
EntryPat ( _, n) => NodePat ( n) ,
166
170
EntryBlock ( _, n) => NodeBlock ( n) ,
167
171
EntryStructCtor ( _, n) => NodeStructCtor ( n) ,
168
172
EntryLifetime ( _, n) => NodeLifetime ( n) ,
169
173
EntryTyParam ( _, n) => NodeTyParam ( n) ,
170
174
EntryVisibility ( _, n) => NodeVisibility ( n) ,
175
+ EntryLocal ( _, n) => NodeLocal ( n) ,
171
176
172
177
NotPresent |
173
178
RootCrate => return None
@@ -321,13 +326,14 @@ impl<'hir> Map<'hir> {
321
326
EntryStmt ( p, _) |
322
327
EntryTy ( p, _) |
323
328
EntryTraitRef ( p, _) |
324
- EntryLocal ( p, _) |
329
+ EntryBinding ( p, _) |
325
330
EntryPat ( p, _) |
326
331
EntryBlock ( p, _) |
327
332
EntryStructCtor ( p, _) |
328
333
EntryLifetime ( p, _) |
329
334
EntryTyParam ( p, _) |
330
- EntryVisibility ( p, _) =>
335
+ EntryVisibility ( p, _) |
336
+ EntryLocal ( p, _) =>
331
337
id = p,
332
338
333
339
EntryExpr ( p, _) => {
@@ -591,7 +597,7 @@ impl<'hir> Map<'hir> {
591
597
/// immediate parent is an item or a closure.
592
598
pub fn is_argument ( & self , id : NodeId ) -> bool {
593
599
match self . find ( id) {
594
- Some ( NodeLocal ( _) ) => ( ) ,
600
+ Some ( NodeBinding ( _) ) => ( ) ,
595
601
_ => return false ,
596
602
}
597
603
match self . find ( self . get_parent_node ( id) ) {
@@ -858,7 +864,7 @@ impl<'hir> Map<'hir> {
858
864
NodeField ( f) => f. name ,
859
865
NodeLifetime ( lt) => lt. name ,
860
866
NodeTyParam ( tp) => tp. name ,
861
- NodeLocal ( & Pat { node : PatKind :: Binding ( _, _, l, _) , .. } ) => l. node ,
867
+ NodeBinding ( & Pat { node : PatKind :: Binding ( _, _, l, _) , .. } ) => l. node ,
862
868
NodeStructCtor ( _) => self . name ( self . get_parent ( id) ) ,
863
869
_ => bug ! ( "no name for {}" , self . node_to_string( id) )
864
870
}
@@ -917,14 +923,15 @@ impl<'hir> Map<'hir> {
917
923
Some ( EntryStmt ( _, stmt) ) => stmt. span ,
918
924
Some ( EntryTy ( _, ty) ) => ty. span ,
919
925
Some ( EntryTraitRef ( _, tr) ) => tr. path . span ,
920
- Some ( EntryLocal ( _, pat) ) => pat. span ,
926
+ Some ( EntryBinding ( _, pat) ) => pat. span ,
921
927
Some ( EntryPat ( _, pat) ) => pat. span ,
922
928
Some ( EntryBlock ( _, block) ) => block. span ,
923
929
Some ( EntryStructCtor ( _, _) ) => self . expect_item ( self . get_parent ( id) ) . span ,
924
930
Some ( EntryLifetime ( _, lifetime) ) => lifetime. span ,
925
931
Some ( EntryTyParam ( _, ty_param) ) => ty_param. span ,
926
932
Some ( EntryVisibility ( _, & Visibility :: Restricted { ref path, .. } ) ) => path. span ,
927
933
Some ( EntryVisibility ( _, v) ) => bug ! ( "unexpected Visibility {:?}" , v) ,
934
+ Some ( EntryLocal ( _, local) ) => local. span ,
928
935
929
936
Some ( RootCrate ) => self . forest . krate . span ,
930
937
Some ( NotPresent ) | None => {
@@ -1114,7 +1121,7 @@ impl<'a> print::State<'a> {
1114
1121
NodeStmt ( a) => self . print_stmt ( & a) ,
1115
1122
NodeTy ( a) => self . print_type ( & a) ,
1116
1123
NodeTraitRef ( a) => self . print_trait_ref ( & a) ,
1117
- NodeLocal ( a) |
1124
+ NodeBinding ( a) |
1118
1125
NodePat ( a) => self . print_pat ( & a) ,
1119
1126
NodeBlock ( a) => {
1120
1127
use syntax:: print:: pprust:: PrintState ;
@@ -1133,6 +1140,7 @@ impl<'a> print::State<'a> {
1133
1140
// hir_map to reconstruct their full structure for pretty
1134
1141
// printing.
1135
1142
NodeStructCtor ( _) => bug ! ( "cannot print isolated StructCtor" ) ,
1143
+ NodeLocal ( a) => self . print_local_decl ( & a) ,
1136
1144
}
1137
1145
}
1138
1146
}
@@ -1225,7 +1233,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
1225
1233
Some ( NodeTraitRef ( _) ) => {
1226
1234
format ! ( "trait_ref {}{}" , map. node_to_pretty_string( id) , id_str)
1227
1235
}
1228
- Some ( NodeLocal ( _) ) => {
1236
+ Some ( NodeBinding ( _) ) => {
1229
1237
format ! ( "local {}{}" , map. node_to_pretty_string( id) , id_str)
1230
1238
}
1231
1239
Some ( NodePat ( _) ) => {
@@ -1234,6 +1242,9 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
1234
1242
Some ( NodeBlock ( _) ) => {
1235
1243
format ! ( "block {}{}" , map. node_to_pretty_string( id) , id_str)
1236
1244
}
1245
+ Some ( NodeLocal ( _) ) => {
1246
+ format ! ( "local {}{}" , map. node_to_pretty_string( id) , id_str)
1247
+ }
1237
1248
Some ( NodeStructCtor ( _) ) => {
1238
1249
format ! ( "struct_ctor {}{}" , path_str( ) , id_str)
1239
1250
}
0 commit comments