@@ -26,7 +26,7 @@ pub struct DefCollector<'a> {
26
26
pub struct MacroInvocationData {
27
27
pub mark : Mark ,
28
28
pub def_index : DefIndex ,
29
- pub const_integer : bool ,
29
+ pub const_expr : bool ,
30
30
}
31
31
32
32
impl < ' a > DefCollector < ' a > {
@@ -65,10 +65,10 @@ impl<'a> DefCollector<'a> {
65
65
self . parent_def = parent;
66
66
}
67
67
68
- pub fn visit_ast_const_integer ( & mut self , expr : & Expr ) {
68
+ pub fn visit_const_expr ( & mut self , expr : & Expr ) {
69
69
match expr. node {
70
70
// Find the node which will be used after lowering.
71
- ExprKind :: Paren ( ref inner) => return self . visit_ast_const_integer ( inner) ,
71
+ ExprKind :: Paren ( ref inner) => return self . visit_const_expr ( inner) ,
72
72
ExprKind :: Mac ( ..) => return self . visit_macro_invoc ( expr. id , true ) ,
73
73
// FIXME(eddyb) Closures should have separate
74
74
// function definition IDs and expression IDs.
@@ -79,11 +79,11 @@ impl<'a> DefCollector<'a> {
79
79
self . create_def ( expr. id , DefPathData :: Initializer ) ;
80
80
}
81
81
82
- fn visit_macro_invoc ( & mut self , id : NodeId , const_integer : bool ) {
82
+ fn visit_macro_invoc ( & mut self , id : NodeId , const_expr : bool ) {
83
83
if let Some ( ref mut visit) = self . visit_macro_invoc {
84
84
visit ( MacroInvocationData {
85
85
mark : Mark :: from_placeholder_id ( id) ,
86
- const_integer : const_integer ,
86
+ const_expr : const_expr ,
87
87
def_index : self . parent_def . unwrap ( ) ,
88
88
} )
89
89
}
@@ -142,7 +142,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
142
142
}
143
143
144
144
if let Some ( ref expr) = v. node . disr_expr {
145
- this. visit_ast_const_integer ( expr) ;
145
+ this. visit_const_expr ( expr) ;
146
146
}
147
147
} ) ;
148
148
}
@@ -194,7 +194,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
194
194
let def = self . create_def ( ti. id , def_data) ;
195
195
self . with_parent ( def, |this| {
196
196
if let TraitItemKind :: Const ( _, Some ( ref expr) ) = ti. node {
197
- this. create_def ( expr. id , DefPathData :: Initializer ) ;
197
+ this. visit_const_expr ( expr) ;
198
198
}
199
199
200
200
visit:: walk_trait_item ( this, ti) ;
@@ -212,7 +212,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
212
212
let def = self . create_def ( ii. id , def_data) ;
213
213
self . with_parent ( def, |this| {
214
214
if let ImplItemKind :: Const ( _, ref expr) = ii. node {
215
- this. create_def ( expr. id , DefPathData :: Initializer ) ;
215
+ this. visit_const_expr ( expr) ;
216
216
}
217
217
218
218
visit:: walk_impl_item ( this, ii) ;
@@ -240,7 +240,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
240
240
241
241
match expr. node {
242
242
ExprKind :: Mac ( ..) => return self . visit_macro_invoc ( expr. id , false ) ,
243
- ExprKind :: Repeat ( _, ref count) => self . visit_ast_const_integer ( count) ,
243
+ ExprKind :: Repeat ( _, ref count) => self . visit_const_expr ( count) ,
244
244
ExprKind :: Closure ( ..) => {
245
245
let def = self . create_def ( expr. id , DefPathData :: ClosureExpr ) ;
246
246
self . parent_def = Some ( def) ;
@@ -255,11 +255,11 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
255
255
fn visit_ty ( & mut self , ty : & ' a Ty ) {
256
256
match ty. node {
257
257
TyKind :: Mac ( ..) => return self . visit_macro_invoc ( ty. id , false ) ,
258
- TyKind :: Array ( _, ref length) => self . visit_ast_const_integer ( length) ,
258
+ TyKind :: Array ( _, ref length) => self . visit_const_expr ( length) ,
259
259
TyKind :: ImplTrait ( ..) => {
260
260
self . create_def ( ty. id , DefPathData :: ImplTrait ) ;
261
261
}
262
- TyKind :: Typeof ( ref expr) => self . visit_ast_const_integer ( expr) ,
262
+ TyKind :: Typeof ( ref expr) => self . visit_const_expr ( expr) ,
263
263
_ => { }
264
264
}
265
265
visit:: walk_ty ( self , ty) ;
0 commit comments