Skip to content

Commit af969b1

Browse files
committed
Update wasm-tools to 227
This commit builds on #151 to update the wasm-tools crates to the 227 (current) track. This notably includes the removal of multiple named return types in WIT from the component model.
1 parent ae28c90 commit af969b1

25 files changed

+180
-382
lines changed

Cargo.lock

Lines changed: 97 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ wac-parser = { path = "crates/wac-parser", version = "0.7.0-dev", default-featur
6363
wac-resolver = { path = "crates/wac-resolver", version = "0.7.0-dev", default-features = false }
6464
wac-graph = { path = "crates/wac-graph", version = "0.7.0-dev" }
6565
wac-types = { path = "crates/wac-types", version = "0.7.0-dev" }
66-
wit-parser = "0.224.0"
67-
wasmparser = "0.224.0"
68-
wit-component = "0.224.0"
69-
wasm-encoder = "0.224.0"
70-
wasmprinter = "0.224.0"
71-
wasm-metadata = "0.224.0"
66+
wit-parser = "0.227.0"
67+
wasmparser = "0.227.0"
68+
wit-component = "0.227.0"
69+
wasm-encoder = "0.227.0"
70+
wasmprinter = "0.227.0"
71+
wasm-metadata = "0.227.0"
7272
anyhow = "1.0.81"
7373
clap = { version = "4.5.4", features = ["derive"] }
7474
semver = { version = "1.0.22", features = ["serde"] }

crates/wac-graph/src/encoding.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use indexmap::IndexMap;
33
use petgraph::graph::NodeIndex;
44
use std::collections::HashMap;
55
use wac_types::{
6-
CoreExtern, DefinedType, DefinedTypeId, Enum, Flags, FuncResult, FuncTypeId, InterfaceId,
7-
ItemKind, ModuleTypeId, PrimitiveType, Record, ResourceId, Type, Types, UsedType, ValueType,
8-
Variant, WorldId,
6+
CoreExtern, DefinedType, DefinedTypeId, Enum, Flags, FuncTypeId, InterfaceId, ItemKind,
7+
ModuleTypeId, PrimitiveType, Record, ResourceId, Type, Types, UsedType, ValueType, Variant,
8+
WorldId,
99
};
1010
use wasm_encoder::{
1111
Alias, ComponentBuilder, ComponentCoreTypeEncoder, ComponentExportKind,
@@ -227,27 +227,11 @@ impl<'a> TypeEncoder<'a> {
227227
.map(|(n, ty)| (n.as_str(), self.value_type(state, *ty)))
228228
.collect::<Vec<_>>();
229229

230-
let results = match &ty.results {
231-
Some(FuncResult::Scalar(ty)) => vec![("", self.value_type(state, *ty))],
232-
Some(FuncResult::List(results)) => results
233-
.iter()
234-
.map(|(n, ty)| (n.as_str(), self.value_type(state, *ty)))
235-
.collect(),
236-
None => Vec::new(),
237-
};
238-
230+
let result = ty.result.map(|ty| self.value_type(state, ty));
239231
let index = state.current.encodable.type_count();
240232
let mut encoder = state.current.encodable.ty().function();
241233
encoder.params(params);
242-
243-
match &ty.results {
244-
Some(FuncResult::Scalar(_)) => {
245-
encoder.result(results[0].1);
246-
}
247-
_ => {
248-
encoder.results(results);
249-
}
250-
}
234+
encoder.result(result);
251235

252236
log::debug!("function type encoded to type index {index}");
253237
index
@@ -271,7 +255,6 @@ impl<'a> TypeEncoder<'a> {
271255
DefinedType::Alias(ValueType::Defined(id)) => self.defined(state, *id),
272256
DefinedType::Stream(ty) => self.stream(state, *ty),
273257
DefinedType::Future(ty) => self.future(state, *ty),
274-
DefinedType::ErrorContext => self.error_context(state),
275258
};
276259

277260
log::debug!("defined type encoded to type index {index}");
@@ -583,12 +566,6 @@ impl<'a> TypeEncoder<'a> {
583566
index
584567
}
585568

586-
fn error_context(&self, state: &mut State) -> u32 {
587-
let index = state.current.encodable.type_count();
588-
state.current.encodable.ty().defined_type().error_context();
589-
index
590-
}
591-
592569
fn option(&self, state: &mut State, ty: ValueType) -> u32 {
593570
let ty = self.value_type(state, ty);
594571
let index = state.current.encodable.type_count();

0 commit comments

Comments
 (0)