Skip to content

Commit

Permalink
avm2: Resolve review notes in enum_trait_object macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed Aug 6, 2024
1 parent 5c61222 commit 3182361
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions core/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,20 @@ pub fn enum_trait_object(args: TokenStream, item: TokenStream) -> TokenStream {

let mut is_no_dynamic = false;

let new_attrs = method
.attrs
.iter()
.filter(|attr| match &attr.meta {
Meta::Path(path) => {
if let Some(ident) = path.get_ident() {
if ident == "no_dynamic" {
is_no_dynamic = true;

// Remove the #[no_dynamic] attribute from the
// list of method attributes.
false
} else {
true
}
} else {
true
}
method.attrs.retain(|attr| match &attr.meta {
Meta::Path(path) => {
if path.is_ident("no_dynamic") {
is_no_dynamic = true;

// Remove the #[no_dynamic] attribute from the
// list of method attributes.
false
} else {
true
}
_ => true,
})
.map(|o| o.clone())
.collect::<Vec<_>>();

method.attrs = new_attrs;
}
_ => true,
});

if is_no_dynamic {
// Don't create this method as a dynamic-dispatch method
Expand Down

0 comments on commit 3182361

Please sign in to comment.