@@ -26,7 +26,7 @@ pub struct DefCollector<'a> {
2626pub struct MacroInvocationData {
2727 pub mark : Mark ,
2828 pub def_index : DefIndex ,
29- pub const_integer : bool ,
29+ pub const_expr : bool ,
3030}
3131
3232impl < ' a > DefCollector < ' a > {
@@ -65,10 +65,10 @@ impl<'a> DefCollector<'a> {
6565 self . parent_def = parent;
6666 }
6767
68- pub fn visit_ast_const_integer ( & mut self , expr : & Expr ) {
68+ pub fn visit_const_expr ( & mut self , expr : & Expr ) {
6969 match expr. node {
7070 // 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) ,
7272 ExprKind :: Mac ( ..) => return self . visit_macro_invoc ( expr. id , true ) ,
7373 // FIXME(eddyb) Closures should have separate
7474 // function definition IDs and expression IDs.
@@ -79,11 +79,11 @@ impl<'a> DefCollector<'a> {
7979 self . create_def ( expr. id , DefPathData :: Initializer ) ;
8080 }
8181
82- fn visit_macro_invoc ( & mut self , id : NodeId , const_integer : bool ) {
82+ fn visit_macro_invoc ( & mut self , id : NodeId , const_expr : bool ) {
8383 if let Some ( ref mut visit) = self . visit_macro_invoc {
8484 visit ( MacroInvocationData {
8585 mark : Mark :: from_placeholder_id ( id) ,
86- const_integer : const_integer ,
86+ const_expr : const_expr ,
8787 def_index : self . parent_def . unwrap ( ) ,
8888 } )
8989 }
@@ -142,7 +142,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
142142 }
143143
144144 if let Some ( ref expr) = v. node . disr_expr {
145- this. visit_ast_const_integer ( expr) ;
145+ this. visit_const_expr ( expr) ;
146146 }
147147 } ) ;
148148 }
@@ -194,7 +194,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
194194 let def = self . create_def ( ti. id , def_data) ;
195195 self . with_parent ( def, |this| {
196196 if let TraitItemKind :: Const ( _, Some ( ref expr) ) = ti. node {
197- this. create_def ( expr. id , DefPathData :: Initializer ) ;
197+ this. visit_const_expr ( expr) ;
198198 }
199199
200200 visit:: walk_trait_item ( this, ti) ;
@@ -212,7 +212,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
212212 let def = self . create_def ( ii. id , def_data) ;
213213 self . with_parent ( def, |this| {
214214 if let ImplItemKind :: Const ( _, ref expr) = ii. node {
215- this. create_def ( expr. id , DefPathData :: Initializer ) ;
215+ this. visit_const_expr ( expr) ;
216216 }
217217
218218 visit:: walk_impl_item ( this, ii) ;
@@ -240,7 +240,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
240240
241241 match expr. node {
242242 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) ,
244244 ExprKind :: Closure ( ..) => {
245245 let def = self . create_def ( expr. id , DefPathData :: ClosureExpr ) ;
246246 self . parent_def = Some ( def) ;
@@ -255,11 +255,11 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
255255 fn visit_ty ( & mut self , ty : & ' a Ty ) {
256256 match ty. node {
257257 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) ,
259259 TyKind :: ImplTrait ( ..) => {
260260 self . create_def ( ty. id , DefPathData :: ImplTrait ) ;
261261 }
262- TyKind :: Typeof ( ref expr) => self . visit_ast_const_integer ( expr) ,
262+ TyKind :: Typeof ( ref expr) => self . visit_const_expr ( expr) ,
263263 _ => { }
264264 }
265265 visit:: walk_ty ( self , ty) ;
0 commit comments