Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parity-wasm dependency #942

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cli-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Shared support for the wasm-bindgen-cli package, an internal dependency
[dependencies]
base64 = "0.9"
failure = "0.1.2"
parity-wasm = "0.32"
parity-wasm = "0.34"
serde = "1.0"
serde_json = "1.0"
tempfile = "3.0"
Expand Down
36 changes: 3 additions & 33 deletions crates/cli-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extern crate wasm_bindgen_gc;
extern crate failure;
extern crate wasm_bindgen_wasm_interpreter as wasm_interpreter;

use std::any::Any;
use std::collections::BTreeSet;
use std::env;
use std::fs;
Expand Down Expand Up @@ -40,7 +39,6 @@ pub struct Bindgen {

enum Input {
Path(PathBuf),
Bytes(Vec<u8>, String),
Module(Module, String),
None,
}
Expand Down Expand Up @@ -68,33 +66,10 @@ impl Bindgen {
}

/// Explicitly specify the already parsed input module.
///
/// Note that this API is a little wonky to avoid tying itself with a public
/// dependency on the `parity-wasm` crate, what we currently use to parse
/// wasm mdoules.
///
/// If the `module` argument is a `parity_wasm::Module` then it will be used
/// directly. Otherwise it will be passed to `into_bytes` to serialize the
/// module to a vector of bytes, and this will deserialize the module later.
///
/// Note that even if the argument passed in is a `parity_wasm::Module` it
/// doesn't mean that this won't invoke `into_bytes`, if the `parity_wasm`
/// crate versions are different we'll have to go through serialization.
pub fn input_module<T: Any>(
&mut self,
name: &str,
mut module: T,
into_bytes: impl FnOnce(T) -> Vec<u8>,
) -> &mut Bindgen {
pub fn input_module(&mut self, name: &str, module: Module) -> &mut Bindgen {
let name = name.to_string();
if let Some(module) = (&mut module as &mut Any).downcast_mut::<Module>() {
let blank = Module::new(Vec::new());
self.input = Input::Module(mem::replace(module, blank), name);
return self;
}

self.input = Input::Bytes(into_bytes(module), name);
self
self.input = Input::Module(module, name);
return self;
}

pub fn nodejs(&mut self, node: bool) -> &mut Bindgen {
Expand Down Expand Up @@ -153,11 +128,6 @@ impl Bindgen {
let blank_module = Module::new(Vec::new());
(mem::replace(m, blank_module), &name[..])
}
Input::Bytes(ref b, ref name) => {
let module = parity_wasm::deserialize_buffer::<Module>(&b)
.context("failed to parse input file as wasm")?;
(module, &name[..])
}
Input::Path(ref path) => {
let contents = fs::read(&path)
.with_context(|_| format!("failed to read `{}`", path.display()))?;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docopt = "1.0"
env_logger = "0.5"
failure = "0.1.2"
log = "0.4"
parity-wasm = "0.32"
parity-wasm = "0.34"
rouille = { version = "2.1.0", default-features = false }
serde = "1.0"
serde_derive = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/bin/wasm-bindgen-test-runner/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn rmain() -> Result<(), Error> {
let mut b = Bindgen::new();
b.debug(debug)
.nodejs(node)
.input_module(module, wasm, |w| parity_wasm::serialize(w).unwrap())
.input_module(module, wasm)
.keep_debug(false)
.generate(&tmpdir)
.context("executing `wasm-bindgen` over the wasm file")?;
Expand Down
2 changes: 1 addition & 1 deletion crates/gc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Support for removing unused items from a wasm executable
"""

[dependencies]
parity-wasm = "0.32"
parity-wasm = "0.34"
log = "0.4"
rustc-demangle = "0.1.9"
1 change: 1 addition & 0 deletions crates/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ impl<'a> LiveContext<'a> {
ValueType::I64 => {}
ValueType::F32 => {}
ValueType::F64 => {}
ValueType::V128 => {}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/wasm-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Micro-interpreter optimized for wasm-bindgen's use case
"""

[dependencies]
parity-wasm = "0.32"
parity-wasm = "0.34"

[dev-dependencies]
tempfile = "3"