Skip to content

Commit

Permalink
Update some dependencies (bytecodealliance#1496)
Browse files Browse the repository at this point in the history
Update the `wast` crate to 13 and handle the new `QuoteModule` case as
well.
  • Loading branch information
alexcrichton authored Apr 10, 2020
1 parent 4cca510 commit 63c97e3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0.19"
wasmtime = { path = "../api", version = "0.15.0", default-features = false }
wast = "11.0.0"
wast = "13.0.0"

[badges]
maintenance = { status = "actively-developed" }
Expand Down
13 changes: 13 additions & 0 deletions crates/wast/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use anyhow::{anyhow, bail, Context as _, Result};
use std::path::Path;
use std::str;
use wasmtime::*;
use wast::parser::{self, ParseBuffer};
use wast::Wat;

/// Translate from a `script::Value` to a `RuntimeValue`.
fn runtime_value(v: &wast::Expression<'_>) -> Result<Val> {
Expand Down Expand Up @@ -234,6 +236,17 @@ impl WastContext {
let binary = module.encode()?;
self.module(module.id.map(|s| s.name()), &binary)?;
}
QuoteModule { span: _, source } => {
let mut module = String::new();
for src in source {
module.push_str(str::from_utf8(src)?);
module.push_str(" ");
}
let buf = ParseBuffer::new(&module)?;
let mut wat = parser::parse::<Wat>(&buf)?;
let binary = wat.module.encode()?;
self.module(wat.module.id.map(|s| s.name()), &binary)?;
}
Register {
span: _,
name,
Expand Down

0 comments on commit 63c97e3

Please sign in to comment.