MCPcopy Create free account
hub / github.com/PLSysSec/wave / rewrite_self

Function rewrite_self

tools/fuzz-gen/src/extern_spec_rewriter.rs:149–170  ·  view source on GitHub ↗
(tokens: proc_macro2::TokenStream)

Source from the content-addressed store, hash-verified

147}
148
149fn rewrite_self(tokens: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
150 let mut new_tokens = proc_macro2::TokenStream::new();
151 for token in tokens.into_iter() {
152 match token {
153 proc_macro2::TokenTree::Group(group) => {
154 let new_group = proc_macro2::Group::new(group.delimiter(),
155 rewrite_self(group.stream()));
156 new_tokens.extend(new_group.to_token_stream());
157 }
158 proc_macro2::TokenTree::Ident(mut ident) => {
159 if ident == "self" {
160 ident = proc_macro2::Ident::new("_self", ident.span());
161 }
162 new_tokens.extend(ident.into_token_stream());
163 }
164 _ => {
165 new_tokens.extend(token.into_token_stream());
166 }
167 }
168 }
169 new_tokens
170}
171
172fn rewrite_method_inputs(item_ty: &syn::Type, method: &mut ImplItemMethod) ->
173 syn::punctuated::Punctuated<syn::Expr, syn::token::Comma> {

Callers 1

rewrite_implFunction · 0.85

Calls 1

into_iterMethod · 0.80

Tested by

no test coverage detected