@@ -41,7 +41,7 @@ macro_rules! attrgen {
41
41
( indexing_setter, IndexingSetter ( Span ) ) ,
42
42
( indexing_deleter, IndexingDeleter ( Span ) ) ,
43
43
( structural, Structural ( Span ) ) ,
44
- ( final_ ( " final" ) , Final ( Span ) ) ,
44
+ ( r# final, Final ( Span ) ) ,
45
45
( readonly, Readonly ( Span ) ) ,
46
46
( js_name, JsName ( Span , String , Span ) ) ,
47
47
( js_class, JsClass ( Span , String , Span ) ) ,
@@ -57,7 +57,7 @@ macro_rules! attrgen {
57
57
}
58
58
59
59
macro_rules! methods {
60
- ( $( ( $name: ident $ ( ( $other : tt ) ) * , $variant: ident( $( $contents: tt) * ) ) , ) * ) => {
60
+ ( $( ( $name: ident, $variant: ident( $( $contents: tt) * ) ) , ) * ) => {
61
61
$( methods!( @method $name, $variant( $( $contents) * ) ) ; ) *
62
62
63
63
#[ cfg( feature = "strict-macro" ) ]
@@ -200,7 +200,7 @@ impl Parse for BindgenAttrs {
200
200
}
201
201
202
202
macro_rules! gen_bindgen_attr {
203
- ( $( ( $method: ident $ ( ( $other : tt ) ) * , $( $variants: tt) * ) , ) * ) => {
203
+ ( $( ( $method: ident, $( $variants: tt) * ) , ) * ) => {
204
204
/// The possible attributes in the `#[wasm_bindgen]`.
205
205
#[ cfg_attr( feature = "extra-traits" , derive( Debug , PartialEq , Eq ) ) ]
206
206
pub enum BindgenAttr {
@@ -216,11 +216,13 @@ impl Parse for BindgenAttr {
216
216
let attr: AnyIdent = input. parse ( ) ?;
217
217
let attr = attr. 0 ;
218
218
let attr_span = attr. span ( ) ;
219
+ let attr_string = attr. to_string ( ) ;
220
+ let raw_attr_string = format ! ( "r#{}" , attr_string) ;
219
221
220
222
macro_rules! parsers {
221
- ( $( ( $name: ident $ ( ( $other : tt ) ) * , $( $contents: tt) * ) , ) * ) => {
223
+ ( $( ( $name: ident, $( $contents: tt) * ) , ) * ) => {
222
224
$(
223
- if attr == parsers! ( @attrname $name $ ( $other ) * ) {
225
+ if attr_string == stringify! ( $name) || raw_attr_string == stringify! ( $name ) {
224
226
parsers!(
225
227
@parser
226
228
$( $contents) *
@@ -269,9 +271,6 @@ impl Parse for BindgenAttr {
269
271
} ;
270
272
return Ok ( BindgenAttr :: $variant( attr_span, val, span) )
271
273
} ) ;
272
-
273
- ( @attrname $a: ident $b: tt) => ( $b) ;
274
- ( @attrname $a: ident) => ( stringify!( $a) ) ;
275
274
}
276
275
277
276
attrgen ! ( parsers) ;
@@ -490,7 +489,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte
490
489
ShortHash ( data)
491
490
)
492
491
} ;
493
- if let Some ( span) = opts. final_ ( ) {
492
+ if let Some ( span) = opts. r#final ( ) {
494
493
if opts. structural ( ) . is_some ( ) {
495
494
let msg = "cannot specify both `structural` and `final`" ;
496
495
return Err ( Diagnostic :: span_error ( * span, msg) ) ;
@@ -502,7 +501,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte
502
501
js_ret,
503
502
catch,
504
503
variadic,
505
- structural : opts. structural ( ) . is_some ( ) || opts. final_ ( ) . is_none ( ) ,
504
+ structural : opts. structural ( ) . is_some ( ) || opts. r#final ( ) . is_none ( ) ,
506
505
rust_name : self . ident . clone ( ) ,
507
506
shim : Ident :: new ( & shim, Span :: call_site ( ) ) ,
508
507
doc_comment : None ,
0 commit comments