@@ -8,7 +8,6 @@ extern crate wasm_bindgen_gc;
8
8
extern crate failure;
9
9
extern crate wasm_bindgen_wasm_interpreter as wasm_interpreter;
10
10
11
- use std:: any:: Any ;
12
11
use std:: collections:: BTreeSet ;
13
12
use std:: env;
14
13
use std:: fs;
@@ -40,7 +39,6 @@ pub struct Bindgen {
40
39
41
40
enum Input {
42
41
Path ( PathBuf ) ,
43
- Bytes ( Vec < u8 > , String ) ,
44
42
Module ( Module , String ) ,
45
43
None ,
46
44
}
@@ -68,33 +66,10 @@ impl Bindgen {
68
66
}
69
67
70
68
/// Explicitly specify the already parsed input module.
71
- ///
72
- /// Note that this API is a little wonky to avoid tying itself with a public
73
- /// dependency on the `parity-wasm` crate, what we currently use to parse
74
- /// wasm mdoules.
75
- ///
76
- /// If the `module` argument is a `parity_wasm::Module` then it will be used
77
- /// directly. Otherwise it will be passed to `into_bytes` to serialize the
78
- /// module to a vector of bytes, and this will deserialize the module later.
79
- ///
80
- /// Note that even if the argument passed in is a `parity_wasm::Module` it
81
- /// doesn't mean that this won't invoke `into_bytes`, if the `parity_wasm`
82
- /// crate versions are different we'll have to go through serialization.
83
- pub fn input_module < T : Any > (
84
- & mut self ,
85
- name : & str ,
86
- mut module : T ,
87
- into_bytes : impl FnOnce ( T ) -> Vec < u8 > ,
88
- ) -> & mut Bindgen {
69
+ pub fn input_module ( & mut self , name : & str , module : Module ) -> & mut Bindgen {
89
70
let name = name. to_string ( ) ;
90
- if let Some ( module) = ( & mut module as & mut Any ) . downcast_mut :: < Module > ( ) {
91
- let blank = Module :: new ( Vec :: new ( ) ) ;
92
- self . input = Input :: Module ( mem:: replace ( module, blank) , name) ;
93
- return self ;
94
- }
95
-
96
- self . input = Input :: Bytes ( into_bytes ( module) , name) ;
97
- self
71
+ self . input = Input :: Module ( module, name) ;
72
+ return self ;
98
73
}
99
74
100
75
pub fn nodejs ( & mut self , node : bool ) -> & mut Bindgen {
@@ -153,11 +128,6 @@ impl Bindgen {
153
128
let blank_module = Module :: new ( Vec :: new ( ) ) ;
154
129
( mem:: replace ( m, blank_module) , & name[ ..] )
155
130
}
156
- Input :: Bytes ( ref b, ref name) => {
157
- let module = parity_wasm:: deserialize_buffer :: < Module > ( & b)
158
- . context ( "failed to parse input file as wasm" ) ?;
159
- ( module, & name[ ..] )
160
- }
161
131
Input :: Path ( ref path) => {
162
132
let contents = fs:: read ( & path)
163
133
. with_context ( |_| format ! ( "failed to read `{}`" , path. display( ) ) ) ?;
0 commit comments