File tree 3 files changed +12
-1
lines changed 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
### Added
7
7
8
+ * Allow exporting functions named ` default ` . Throw error in wasm-bindgen-cli if --target web and
9
+ an exported symbol is named ` default ` .
10
+ [ #3930 ] ( https://github.com/rustwasm/wasm-bindgen/pull/3930 )
11
+
8
12
* Added support for arbitrary expressions when using ` #[wasm_bindgen(typescript_custom_section)] ` .
9
13
[ #3901 ] ( https://github.com/rustwasm/wasm-bindgen/pull/3901 )
10
14
Original file line number Diff line number Diff line change @@ -327,6 +327,13 @@ impl Bindgen {
327
327
. context ( "failed getting Wasm module" ) ?,
328
328
} ;
329
329
330
+ // Check that no exported symbol is called "default" if we target web.
331
+ if matches ! ( self . mode, OutputMode :: Web )
332
+ && module. exports . iter ( ) . any ( |export| export. name == "default" )
333
+ {
334
+ bail ! ( "exported symbol \" default\" not allowed for --target web" )
335
+ }
336
+
330
337
let thread_count = self
331
338
. threads
332
339
. run ( & mut module)
Original file line number Diff line number Diff line change @@ -799,7 +799,7 @@ impl ConvertToAst<BindgenAttrs> for syn::ItemFn {
799
799
false ,
800
800
None ,
801
801
false ,
802
- None ,
802
+ Some ( & [ "default" ] ) ,
803
803
) ?;
804
804
attrs. check_used ( ) ;
805
805
Ok ( ret. 0 )
You can’t perform that action at this time.
0 commit comments