-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add placeholders for interface attributes
the interface attributes are only recognized by the redIDL compiler but not the Rust compiler. The Rust compiler will spit out errors if there's no placeholder implementations for them
- Loading branch information
Showing
8 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[dependencies.interface_attribute_placeholder] | ||
path = "../lib/external/interface_attribute_placeholder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "interface_attribute_placeholder" | ||
version = "0.1.0" | ||
authors = ["Redleaf team <[email protected]>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
quote = "1.0.9" | ||
proc-macro2 = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
///! Include multiple attributes that | ||
use proc_macro::TokenStream; | ||
|
||
macro_rules! generate_placeholder_attributes { | ||
() => {}; | ||
($attr:ident) => { | ||
#[doc = "Placeholder attribute; noop besides removing the attribute itself."] | ||
#[proc_macro_attribute] | ||
pub fn $attr(_attr: TokenStream, item: TokenStream) -> TokenStream { | ||
item | ||
} | ||
}; | ||
($attr:ident, $($attrs:tt)*) => { | ||
generate_placeholder_attributes!($attr); | ||
generate_placeholder_attributes!($($attrs)*); | ||
}; | ||
} | ||
|
||
generate_placeholder_attributes! { | ||
placeholder, | ||
interface, | ||
domain_create, | ||
domain_create_blob, | ||
} | ||
// #[proc_macro_attribute] | ||
// pub fn a(mut attr: TokenStream, item: TokenStream) -> TokenStream { | ||
// let attr = proc_macro2::TokenStream::from(attr); | ||
// let item = proc_macro2::TokenStream::from(item); | ||
// let output = quote::quote! { | ||
// #[$attr(#attr)] | ||
// #item | ||
// }; | ||
// output.into() | ||
// } |