@@ -637,7 +637,7 @@ impl TryToTokens for ast::Export {
637
637
638
638
let mut argtys = Vec :: new ( ) ;
639
639
for ( i, arg) in self . function . arguments . iter ( ) . enumerate ( ) {
640
- argtys. push ( & * arg. ty ) ;
640
+ argtys. push ( & * arg. pat_type . ty ) ;
641
641
let i = i + offset;
642
642
let ident = Ident :: new ( & format ! ( "arg{}" , i) , Span :: call_site ( ) ) ;
643
643
fn unwrap_nested_types ( ty : & syn:: Type ) -> & syn:: Type {
@@ -647,7 +647,7 @@ impl TryToTokens for ast::Export {
647
647
_ => ty,
648
648
}
649
649
}
650
- let ty = unwrap_nested_types ( & arg. ty ) ;
650
+ let ty = unwrap_nested_types ( & arg. pat_type . ty ) ;
651
651
652
652
match & ty {
653
653
syn:: Type :: Reference ( syn:: TypeReference {
@@ -720,7 +720,12 @@ impl TryToTokens for ast::Export {
720
720
elems : Default :: default ( ) ,
721
721
paren_token : Default :: default ( ) ,
722
722
} ) ;
723
- let syn_ret = self . function . ret . as_ref ( ) . unwrap_or ( & syn_unit) ;
723
+ let syn_ret = self
724
+ . function
725
+ . ret
726
+ . as_ref ( )
727
+ . map ( |ret| & ret. r#type )
728
+ . unwrap_or ( & syn_unit) ;
724
729
if let syn:: Type :: Reference ( _) = syn_ret {
725
730
bail_span ! ( syn_ret, "cannot return a borrowed ref with #[wasm_bindgen]" , )
726
731
}
@@ -1323,7 +1328,7 @@ impl TryToTokens for ast::ImportFunction {
1323
1328
ast:: ImportFunctionKind :: Normal => { }
1324
1329
}
1325
1330
let vis = & self . function . rust_vis ;
1326
- let ret = match & self . function . ret {
1331
+ let ret = match self . function . ret . as_ref ( ) . map ( |ret| & ret . r#type ) {
1327
1332
Some ( ty) => quote ! { -> #ty } ,
1328
1333
None => quote ! ( ) ,
1329
1334
} ;
@@ -1337,8 +1342,8 @@ impl TryToTokens for ast::ImportFunction {
1337
1342
let wasm_bindgen_futures = & self . wasm_bindgen_futures ;
1338
1343
1339
1344
for ( i, arg) in self . function . arguments . iter ( ) . enumerate ( ) {
1340
- let ty = & arg. ty ;
1341
- let name = match & * arg. pat {
1345
+ let ty = & arg. pat_type . ty ;
1346
+ let name = match & * arg. pat_type . pat {
1342
1347
syn:: Pat :: Ident ( syn:: PatIdent {
1343
1348
by_ref : None ,
1344
1349
ident,
@@ -1347,7 +1352,7 @@ impl TryToTokens for ast::ImportFunction {
1347
1352
} ) => ident. clone ( ) ,
1348
1353
syn:: Pat :: Wild ( _) => syn:: Ident :: new ( & format ! ( "__genarg_{}" , i) , Span :: call_site ( ) ) ,
1349
1354
_ => bail_span ! (
1350
- arg. pat,
1355
+ arg. pat_type . pat,
1351
1356
"unsupported pattern in #[wasm_bindgen] imported function" ,
1352
1357
) ,
1353
1358
} ;
@@ -1542,7 +1547,7 @@ impl ToTokens for DescribeImport<'_> {
1542
1547
ast:: ImportKind :: Type ( _) => return ,
1543
1548
ast:: ImportKind :: Enum ( _) => return ,
1544
1549
} ;
1545
- let argtys = f. function . arguments . iter ( ) . map ( |arg| & arg. ty ) ;
1550
+ let argtys = f. function . arguments . iter ( ) . map ( |arg| & arg. pat_type . ty ) ;
1546
1551
let nargs = f. function . arguments . len ( ) as u32 ;
1547
1552
let inform_ret = match & f. js_ret {
1548
1553
Some ( ref t) => quote ! { <#t as WasmDescribe >:: describe( ) ; } ,
0 commit comments