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

fix(#3297): Allow variant skip #3496

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/macro-support/src/parser.rs
Expand Up @@ -1298,9 +1298,21 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum {
_ => bail_span!(self, "only public enums are allowed with #[wasm_bindgen]"),
}

fn skip(attrs: &mut Vec<syn::Attribute>) -> bool {
let Ok(attrs) = BindgenAttrs::find(attrs) else {
return false;
};

let result = attrs.skip().is_some();
attrs.check_used();

result
}

let variants = self
.variants
.iter()
.filter(|v| !skip(&mut (v.attrs).clone()))
.enumerate()
.map(|(i, v)| {
match v.fields {
Expand Down