@@ -160,6 +160,16 @@ impl TryToTokens for ast::LinkToModule {
160
160
}
161
161
}
162
162
163
+ #[ cfg( feature = "unstable-coverage" ) ]
164
+ fn coverage ( ) -> TokenStream {
165
+ quote ! ( #[ coverage( off) ] )
166
+ }
167
+
168
+ #[ cfg( not( feature = "unstable-coverage" ) ) ]
169
+ fn coverage ( ) -> TokenStream {
170
+ quote ! ( )
171
+ }
172
+
163
173
impl ToTokens for ast:: Struct {
164
174
fn to_tokens ( & self , tokens : & mut TokenStream ) {
165
175
let name = & self . rust_name ;
@@ -169,10 +179,12 @@ impl ToTokens for ast::Struct {
169
179
let new_fn = Ident :: new ( & shared:: new_function ( & name_str) , Span :: call_site ( ) ) ;
170
180
let free_fn = Ident :: new ( & shared:: free_function ( & name_str) , Span :: call_site ( ) ) ;
171
181
let unwrap_fn = Ident :: new ( & shared:: unwrap_function ( & name_str) , Span :: call_site ( ) ) ;
182
+ let coverage = coverage ( ) ;
172
183
let wasm_bindgen = & self . wasm_bindgen ;
173
184
( quote ! {
174
185
#[ automatically_derived]
175
186
impl #wasm_bindgen:: describe:: WasmDescribe for #name {
187
+ #coverage
176
188
fn describe( ) {
177
189
use #wasm_bindgen:: __wbindgen_if_not_std;
178
190
__wbindgen_if_not_std! {
@@ -814,6 +826,7 @@ impl ToTokens for ast::ImportType {
814
826
} ) ;
815
827
816
828
let no_deref = self . no_deref ;
829
+ let coverage = coverage ( ) ;
817
830
818
831
( quote ! {
819
832
#[ automatically_derived]
@@ -835,6 +848,7 @@ impl ToTokens for ast::ImportType {
835
848
use #wasm_bindgen:: __rt:: core;
836
849
837
850
impl WasmDescribe for #rust_name {
851
+ #coverage
838
852
fn describe( ) {
839
853
#description
840
854
}
@@ -1048,6 +1062,7 @@ impl ToTokens for ast::ImportEnum {
1048
1062
let variant_paths_ref = & variant_paths;
1049
1063
1050
1064
let wasm_bindgen = & self . wasm_bindgen ;
1065
+ let coverage = coverage ( ) ;
1051
1066
1052
1067
( quote ! {
1053
1068
#( #attrs) *
@@ -1082,6 +1097,7 @@ impl ToTokens for ast::ImportEnum {
1082
1097
// It should really be using &str for all of these, but that requires some major changes to cli-support
1083
1098
#[ automatically_derived]
1084
1099
impl #wasm_bindgen:: describe:: WasmDescribe for #name {
1100
+ #coverage
1085
1101
fn describe( ) {
1086
1102
<#wasm_bindgen:: JsValue as #wasm_bindgen:: describe:: WasmDescribe >:: describe( )
1087
1103
}
@@ -1404,6 +1420,7 @@ impl ToTokens for ast::Enum {
1404
1420
} ) ;
1405
1421
let try_from_cast_clauses = cast_clauses. clone ( ) ;
1406
1422
let wasm_bindgen = & self . wasm_bindgen ;
1423
+ let coverage = coverage ( ) ;
1407
1424
( quote ! {
1408
1425
#[ automatically_derived]
1409
1426
impl #wasm_bindgen:: convert:: IntoWasmAbi for #enum_name {
@@ -1441,6 +1458,7 @@ impl ToTokens for ast::Enum {
1441
1458
1442
1459
#[ automatically_derived]
1443
1460
impl #wasm_bindgen:: describe:: WasmDescribe for #enum_name {
1461
+ #coverage
1444
1462
fn describe( ) {
1445
1463
use #wasm_bindgen:: describe:: * ;
1446
1464
inform( ENUM ) ;
0 commit comments