Skip to content
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
24 changes: 12 additions & 12 deletions crates/wasm-encoder/src/component/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,15 @@ impl ComponentBuilder {
inc(&mut self.core_funcs)
}

/// Declares a new `stream.close-readable` intrinsic.
pub fn stream_close_readable(&mut self, ty: u32) -> u32 {
self.canonical_functions().stream_close_readable(ty);
/// Declares a new `stream.drop-readable` intrinsic.
pub fn stream_drop_readable(&mut self, ty: u32) -> u32 {
self.canonical_functions().stream_drop_readable(ty);
inc(&mut self.core_funcs)
}

/// Declares a new `stream.close-writable` intrinsic.
pub fn stream_close_writable(&mut self, ty: u32) -> u32 {
self.canonical_functions().stream_close_writable(ty);
/// Declares a new `stream.drop-writable` intrinsic.
pub fn stream_drop_writable(&mut self, ty: u32) -> u32 {
self.canonical_functions().stream_drop_writable(ty);
inc(&mut self.core_funcs)
}

Expand Down Expand Up @@ -531,15 +531,15 @@ impl ComponentBuilder {
inc(&mut self.core_funcs)
}

/// Declares a new `future.close-readable` intrinsic.
pub fn future_close_readable(&mut self, ty: u32) -> u32 {
self.canonical_functions().future_close_readable(ty);
/// Declares a new `future.drop-readable` intrinsic.
pub fn future_drop_readable(&mut self, ty: u32) -> u32 {
self.canonical_functions().future_drop_readable(ty);
inc(&mut self.core_funcs)
}

/// Declares a new `future.close-writable` intrinsic.
pub fn future_close_writable(&mut self, ty: u32) -> u32 {
self.canonical_functions().future_close_writable(ty);
/// Declares a new `future.drop-writable` intrinsic.
pub fn future_drop_writable(&mut self, ty: u32) -> u32 {
self.canonical_functions().future_drop_writable(ty);
inc(&mut self.core_funcs)
}

Expand Down
16 changes: 8 additions & 8 deletions crates/wasm-encoder/src/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,18 +327,18 @@ impl CanonicalFunctionSection {
self
}

/// Defines a function to close the readable end of a `stream` of the
/// Defines a function to drop the readable end of a `stream` of the
/// specified type.
pub fn stream_close_readable(&mut self, ty: u32) -> &mut Self {
pub fn stream_drop_readable(&mut self, ty: u32) -> &mut Self {
self.bytes.push(0x13);
ty.encode(&mut self.bytes);
self.num_added += 1;
self
}

/// Defines a function to close the writable end of a `stream` of the
/// Defines a function to drop the writable end of a `stream` of the
/// specified type.
pub fn stream_close_writable(&mut self, ty: u32) -> &mut Self {
pub fn stream_drop_writable(&mut self, ty: u32) -> &mut Self {
self.bytes.push(0x14);
ty.encode(&mut self.bytes);
self.num_added += 1;
Expand Down Expand Up @@ -400,18 +400,18 @@ impl CanonicalFunctionSection {
self
}

/// Defines a function to close the readable end of a `future` of the
/// Defines a function to drop the readable end of a `future` of the
/// specified type.
pub fn future_close_readable(&mut self, ty: u32) -> &mut Self {
pub fn future_drop_readable(&mut self, ty: u32) -> &mut Self {
self.bytes.push(0x1a);
ty.encode(&mut self.bytes);
self.num_added += 1;
self
}

/// Defines a function to close the writable end of a `future` of the
/// Defines a function to drop the writable end of a `future` of the
/// specified type.
pub fn future_close_writable(&mut self, ty: u32) -> &mut Self {
pub fn future_drop_writable(&mut self, ty: u32) -> &mut Self {
self.bytes.push(0x1b);
ty.encode(&mut self.bytes);
self.num_added += 1;
Expand Down
20 changes: 10 additions & 10 deletions crates/wasm-encoder/src/reencode/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ pub mod component_utils {
..
} => (),
wasmparser::Payload::Version { .. } => {
return Err(Error::UnexpectedNonComponentSection)
return Err(Error::UnexpectedNonComponentSection);
}
wasmparser::Payload::TypeSection(_)
| wasmparser::Payload::ImportSection(_)
Expand All @@ -452,7 +452,7 @@ pub mod component_utils {
| wasmparser::Payload::DataSection(_)
| wasmparser::Payload::CodeSectionStart { .. }
| wasmparser::Payload::CodeSectionEntry(_) => {
return Err(Error::UnexpectedNonComponentSection)
return Err(Error::UnexpectedNonComponentSection);
}
wasmparser::Payload::ComponentTypeSection(section) => {
let mut types = crate::ComponentTypeSection::new();
Expand Down Expand Up @@ -1027,11 +1027,11 @@ pub mod component_utils {
wasmparser::CanonicalFunction::StreamCancelWrite { ty, async_ } => {
section.stream_cancel_write(ty, async_);
}
wasmparser::CanonicalFunction::StreamCloseReadable { ty } => {
section.stream_close_readable(reencoder.component_type_index(ty));
wasmparser::CanonicalFunction::StreamDropReadable { ty } => {
section.stream_drop_readable(reencoder.component_type_index(ty));
}
wasmparser::CanonicalFunction::StreamCloseWritable { ty } => {
section.stream_close_writable(reencoder.component_type_index(ty));
wasmparser::CanonicalFunction::StreamDropWritable { ty } => {
section.stream_drop_writable(reencoder.component_type_index(ty));
}
wasmparser::CanonicalFunction::FutureNew { ty } => {
section.future_new(reencoder.component_type_index(ty));
Expand All @@ -1056,11 +1056,11 @@ pub mod component_utils {
wasmparser::CanonicalFunction::FutureCancelWrite { ty, async_ } => {
section.future_cancel_write(ty, async_);
}
wasmparser::CanonicalFunction::FutureCloseReadable { ty } => {
section.future_close_readable(reencoder.component_type_index(ty));
wasmparser::CanonicalFunction::FutureDropReadable { ty } => {
section.future_drop_readable(reencoder.component_type_index(ty));
}
wasmparser::CanonicalFunction::FutureCloseWritable { ty } => {
section.future_close_writable(reencoder.component_type_index(ty));
wasmparser::CanonicalFunction::FutureDropWritable { ty } => {
section.future_drop_writable(reencoder.component_type_index(ty));
}
wasmparser::CanonicalFunction::ErrorContextNew { options } => {
let options = options
Expand Down
3 changes: 3 additions & 0 deletions crates/wasm-wave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ categories = ["wasm", "encoding", "parser-implementations"]
repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-wave"
readme = "README.md"

[lints]
workspace = true

[features]
default = ["wit"]
wit = ["dep:wit-parser"]
Expand Down
24 changes: 12 additions & 12 deletions crates/wasmparser/src/readers/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ pub enum CanonicalFunction {
/// `BLOCKED`.
async_: bool,
},
/// A function to close the readable end of a `stream` of the specified
/// A function to drop the readable end of a `stream` of the specified
/// type.
StreamCloseReadable {
StreamDropReadable {
/// The `stream` type to expect.
ty: u32,
},
/// A function to close the writable end of a `stream` of the specified
/// A function to drop the writable end of a `stream` of the specified
/// type.
StreamCloseWritable {
StreamDropWritable {
/// The `stream` type to expect.
ty: u32,
},
Expand Down Expand Up @@ -212,15 +212,15 @@ pub enum CanonicalFunction {
/// `BLOCKED`.
async_: bool,
},
/// A function to close the readable end of a `future` of the specified
/// A function to drop the readable end of a `future` of the specified
/// type.
FutureCloseReadable {
FutureDropReadable {
/// The `future` type to expect.
ty: u32,
},
/// A function to close the writable end of a `future` of the specified
/// A function to drop the writable end of a `future` of the specified
/// type.
FutureCloseWritable {
FutureDropWritable {
/// The `future` type to expect.
ty: u32,
},
Expand Down Expand Up @@ -331,8 +331,8 @@ impl<'a> FromReader<'a> for CanonicalFunction {
ty: reader.read()?,
async_: reader.read()?,
},
0x13 => CanonicalFunction::StreamCloseReadable { ty: reader.read()? },
0x14 => CanonicalFunction::StreamCloseWritable { ty: reader.read()? },
0x13 => CanonicalFunction::StreamDropReadable { ty: reader.read()? },
0x14 => CanonicalFunction::StreamDropWritable { ty: reader.read()? },
0x15 => CanonicalFunction::FutureNew { ty: reader.read()? },
0x16 => CanonicalFunction::FutureRead {
ty: reader.read()?,
Expand All @@ -350,8 +350,8 @@ impl<'a> FromReader<'a> for CanonicalFunction {
ty: reader.read()?,
async_: reader.read()?,
},
0x1a => CanonicalFunction::FutureCloseReadable { ty: reader.read()? },
0x1b => CanonicalFunction::FutureCloseWritable { ty: reader.read()? },
0x1a => CanonicalFunction::FutureDropReadable { ty: reader.read()? },
0x1b => CanonicalFunction::FutureDropWritable { ty: reader.read()? },
0x1c => CanonicalFunction::ErrorContextNew {
options: read_opts(reader)?,
},
Expand Down
Loading