mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 21:25:25 +00:00 
			
		
		
		
	Rename some things and turn macro to macro def into a query
This commit is contained in:
		
							parent
							
								
									071fe4e4e9
								
							
						
					
					
						commit
						51a9e7831a
					
				
					 21 changed files with 165 additions and 163 deletions
				
			
		| 
						 | 
				
			
			@ -102,8 +102,10 @@ pub struct ItemScope {
 | 
			
		|||
    // FIXME: Macro shadowing in one module is not properly handled. Non-item place macros will
 | 
			
		||||
    // be all resolved to the last one defined if shadowing happens.
 | 
			
		||||
    legacy_macros: FxHashMap<Name, SmallVec<[MacroId; 1]>>,
 | 
			
		||||
    /// The derive macro invocations in this scope.
 | 
			
		||||
    /// The attribute macro invocations in this scope.
 | 
			
		||||
    attr_macros: FxHashMap<AstId<ast::Item>, MacroCallId>,
 | 
			
		||||
    /// The macro invocations in this scope.
 | 
			
		||||
    pub macro_invocations: FxHashMap<AstId<ast::MacroCall>, MacroCallId>,
 | 
			
		||||
    /// The derive macro invocations in this scope, keyed by the owner item over the actual derive attributes
 | 
			
		||||
    /// paired with the derive macro invocations for the specific attribute.
 | 
			
		||||
    derive_macros: FxHashMap<AstId<ast::Adt>, SmallVec<[DeriveMacroInvocation; 1]>>,
 | 
			
		||||
| 
						 | 
				
			
			@ -345,6 +347,10 @@ impl ItemScope {
 | 
			
		|||
        self.attr_macros.insert(item, call);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub(crate) fn add_macro_invoc(&mut self, call: AstId<ast::MacroCall>, call_id: MacroCallId) {
 | 
			
		||||
        self.macro_invocations.insert(call, call_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub(crate) fn attr_macro_invocs(
 | 
			
		||||
        &self,
 | 
			
		||||
    ) -> impl Iterator<Item = (AstId<ast::Item>, MacroCallId)> + '_ {
 | 
			
		||||
| 
						 | 
				
			
			@ -692,6 +698,7 @@ impl ItemScope {
 | 
			
		|||
            use_imports_values,
 | 
			
		||||
            use_imports_types,
 | 
			
		||||
            use_imports_macros,
 | 
			
		||||
            macro_invocations,
 | 
			
		||||
        } = self;
 | 
			
		||||
        types.shrink_to_fit();
 | 
			
		||||
        values.shrink_to_fit();
 | 
			
		||||
| 
						 | 
				
			
			@ -709,6 +716,7 @@ impl ItemScope {
 | 
			
		|||
        derive_macros.shrink_to_fit();
 | 
			
		||||
        extern_crate_decls.shrink_to_fit();
 | 
			
		||||
        use_decls.shrink_to_fit();
 | 
			
		||||
        macro_invocations.shrink_to_fit();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue