Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: parse shuttle::endpoint macro #490

Merged
16 changes: 16 additions & 0 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
mod main;
mod next;

use next::App;
use proc_macro::TokenStream;
use proc_macro_error::proc_macro_error;
use syn::{parse_macro_input, File};

#[proc_macro_error]
#[proc_macro_attribute]
pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
main::r#impl(attr, item)
}

#[proc_macro_error]
#[proc_macro]
pub fn app(item: TokenStream) -> TokenStream {
let mut file = parse_macro_input!(item as File);

let app = App::from_file(&mut file);

quote::quote!(
#file
#app
)
.into()
}
2 changes: 1 addition & 1 deletion codegen/src/main/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,6 @@ mod tests {
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
t.compile_fail("tests/ui/main/*.rs");
}
}
Loading