The Ident struct encapsulates valid identifiers in rust. So "self" would be valid, and "to_string" would be valid. However "self.to_string" is not a valid identifier (i.e. you can't use it as a variable name or keyword). Similarly adding the parenthesis also makes it not a valid identifier.
See: proc_macro2::Ident - Rust
let param2 = String::from("self.to_string()");
- let param_ident = Ident::new(param2.as_str(), Span::call_site());
+ let param_ident = param2.parse::<::proc_macro2::TokenStream>().unwrap();
It looks to me that you wanted to "unstringify" "self.method()" to inject it as code to quote!; and they way to do that is by .parse()ing it as such.