mod.rs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. use proc_macro2::TokenStream;
  2. // #[proc_macro_derive(DartEvent, attributes(event_ty))]
  3. pub fn expand_enum_derive(_input: &syn::DeriveInput) -> Result<TokenStream, Vec<syn::Error>> {
  4. Ok(TokenStream::default())
  5. }
  6. // use flowy_ast::{ASTContainer, Ctxt};
  7. // use proc_macro2::TokenStream;
  8. //
  9. // // #[proc_macro_derive(DartEvent, attributes(event_ty))]
  10. // pub fn expand_enum_derive(input: &syn::DeriveInput) -> Result<TokenStream,
  11. // Vec<syn::Error>> { let ctxt = Ctxt::new();
  12. // let cont = match ASTContainer::from_ast(&ctxt, input) {
  13. // Some(cont) => cont,
  14. // None => return Err(ctxt.check().unwrap_err()),
  15. // };
  16. //
  17. // let enum_ident = &cont.ident;
  18. // let pb_enum = cont.attrs.pb_enum_type().unwrap();
  19. //
  20. // let build_display_pb_enum = cont.data.all_idents().map(|i| {
  21. // let a = format_ident!("{}", i.to_string());
  22. // let token_stream: TokenStream = quote! {
  23. // #enum_ident::#i => f.write_str(&#a)?,
  24. // };
  25. // token_stream
  26. // });
  27. //
  28. // ctxt.check()?;
  29. //
  30. // Ok(quote! {
  31. // impl std::fmt::Display for #enum_ident {
  32. // fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
  33. // { match self {
  34. // #(#build_display_pb_enum)*
  35. // }
  36. // }
  37. // }
  38. // })
  39. // }