Update some dependencies (#1496)

Update the `wast` crate to 13 and handle the new `QuoteModule` case as
well.
This commit is contained in:
Alex Crichton
2020-04-10 17:11:23 -05:00
committed by GitHub
parent 4cca510085
commit 63c97e365e
3 changed files with 25 additions and 12 deletions

View File

@@ -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" }

View File

@@ -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> {
@@ -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,