Indent the code correctly again after removing the query categories.

This commit is contained in:
Julian Wollersberger 2021-01-31 21:40:03 +01:00
parent 7bc09f78af
commit 988d93c8a0
2 changed files with 1590 additions and 1592 deletions

View file

@ -438,66 +438,64 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let mut dep_node_def_stream = quote! {};
let mut cached_queries = quote! {};
//for group in groups.0 {
for mut query in queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
let arg = &query.arg;
let result_full = &query.result;
let result = match query.result {
ReturnType::Default => quote! { -> () },
_ => quote! { #result_full },
};
for mut query in queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
let arg = &query.arg;
let result_full = &query.result;
let result = match query.result {
ReturnType::Default => quote! { -> () },
_ => quote! { #result_full },
};
if modifiers.cache.is_some() {
cached_queries.extend(quote! {
#name,
});
}
let mut attributes = Vec::new();
// Pass on the fatal_cycle modifier
if modifiers.fatal_cycle {
attributes.push(quote! { fatal_cycle });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
attributes.push(quote! { storage(#ty) });
};
// Pass on the cycle_delay_bug modifier
if modifiers.cycle_delay_bug {
attributes.push(quote! { cycle_delay_bug });
};
// Pass on the no_hash modifier
if modifiers.no_hash {
attributes.push(quote! { no_hash });
};
// Pass on the anon modifier
if modifiers.anon {
attributes.push(quote! { anon });
};
// Pass on the eval_always modifier
if modifiers.eval_always {
attributes.push(quote! { eval_always });
};
let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name(#arg) #result,
if modifiers.cache.is_some() {
cached_queries.extend(quote! {
#name,
});
// Create a dep node for the query
dep_node_def_stream.extend(quote! {
[#attribute_stream] #name(#arg),
});
add_query_description_impl(&query, modifiers, &mut query_description_stream);
}
//}
let mut attributes = Vec::new();
// Pass on the fatal_cycle modifier
if modifiers.fatal_cycle {
attributes.push(quote! { fatal_cycle });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
attributes.push(quote! { storage(#ty) });
};
// Pass on the cycle_delay_bug modifier
if modifiers.cycle_delay_bug {
attributes.push(quote! { cycle_delay_bug });
};
// Pass on the no_hash modifier
if modifiers.no_hash {
attributes.push(quote! { no_hash });
};
// Pass on the anon modifier
if modifiers.anon {
attributes.push(quote! { anon });
};
// Pass on the eval_always modifier
if modifiers.eval_always {
attributes.push(quote! { eval_always });
};
let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name(#arg) #result,
});
// Create a dep node for the query
dep_node_def_stream.extend(quote! {
[#attribute_stream] #name(#arg),
});
add_query_description_impl(&query, modifiers, &mut query_description_stream);
}
TokenStream::from(quote! {
macro_rules! rustc_query_append {

File diff suppressed because it is too large Load diff