From 491face68b3edc0f94e1f250fa6c38c1c7a79bb8 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 30 Apr 2018 02:24:21 -0700 Subject: [PATCH] More autoderive things --- schala-codegen/Cargo.toml | 4 ++-- schala-codegen/src/lib.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/schala-codegen/Cargo.toml b/schala-codegen/Cargo.toml index c76a527..1aa7bde 100644 --- a/schala-codegen/Cargo.toml +++ b/schala-codegen/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" authors = ["greg "] [dependencies] -syn = "0.11.11" -quote = "0.3.15" +syn = "0.13.1" +quote = "0.5" [lib] proc-macro = true diff --git a/schala-codegen/src/lib.rs b/schala-codegen/src/lib.rs index deae07f..856f196 100644 --- a/schala-codegen/src/lib.rs +++ b/schala-codegen/src/lib.rs @@ -3,7 +3,9 @@ extern crate proc_macro; #[macro_use] extern crate quote; extern crate syn; + use proc_macro::TokenStream; +use syn::DeriveInput; #[proc_macro] pub fn print_a_thing(_input: TokenStream) -> TokenStream { @@ -13,7 +15,13 @@ pub fn print_a_thing(_input: TokenStream) -> TokenStream { #[proc_macro_derive(ProgrammingLanguageInterface)] pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream { - input + let ast: DeriveInput = syn::parse(input).unwrap(); + let name = &ast.ident; + let tokens = quote! { + impl ProgrammingLanguageInterface for #name { + } + }; + tokens.into() } #[cfg(test)]