File tree 3 files changed +11
-1
lines changed
3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1171,7 +1171,7 @@ impl<'a> Context<'a> {
1171
1171
let module = mem:: replace ( self . module , Module :: default ( ) ) ;
1172
1172
let wasm_bytes = parity_wasm:: serialize ( module) . unwrap ( ) ;
1173
1173
let bytes = wasm_gc:: Config :: new ( )
1174
- . demangle ( false )
1174
+ . demangle ( self . config . demangle )
1175
1175
. gc ( & wasm_bytes)
1176
1176
. unwrap ( ) ;
1177
1177
* self . module = deserialize_buffer ( & bytes) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ pub struct Bindgen {
19
19
browser : bool ,
20
20
debug : bool ,
21
21
typescript : bool ,
22
+ demangle : bool ,
22
23
}
23
24
24
25
#[ derive( Debug ) ]
@@ -38,6 +39,7 @@ impl Bindgen {
38
39
browser : false ,
39
40
debug : false ,
40
41
typescript : false ,
42
+ demangle : true ,
41
43
}
42
44
}
43
45
@@ -66,6 +68,11 @@ impl Bindgen {
66
68
self
67
69
}
68
70
71
+ pub fn demangle ( & mut self , demangle : bool ) -> & mut Bindgen {
72
+ self . demangle = demangle;
73
+ self
74
+ }
75
+
69
76
pub fn generate < P : AsRef < Path > > ( & mut self , path : P ) -> Result < ( ) , Error > {
70
77
self . _generate ( path. as_ref ( ) )
71
78
}
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ Options:
24
24
--browser Generate output that only works in a browser
25
25
--typescript Output a TypeScript definition file
26
26
--debug Include otherwise-extraneous debug checks in output
27
+ --no-demangle Don't demangle Rust symbol names
27
28
-V --version Print the version number of wasm-bindgen
28
29
" ;
29
30
@@ -35,6 +36,7 @@ struct Args {
35
36
flag_out_dir : Option < PathBuf > ,
36
37
flag_debug : bool ,
37
38
flag_version : bool ,
39
+ flag_no_demangle : bool ,
38
40
arg_input : Option < PathBuf > ,
39
41
}
40
42
@@ -58,6 +60,7 @@ fn main() {
58
60
. nodejs ( args. flag_nodejs )
59
61
. browser ( args. flag_browser )
60
62
. debug ( args. flag_debug )
63
+ . demangle ( !args. flag_no_demangle )
61
64
. typescript ( args. flag_typescript ) ;
62
65
63
66
let out_dir = match args. flag_out_dir {
You can’t perform that action at this time.
0 commit comments