mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-23 01:31:34 +00:00
Allow web-sys to emit correct typescript declarations from webidl (#1998)
* Update to emit typescript names * Update to use NamedAnyref * Update incoming / outgoing * Remove added space * Remove comment * Add basic typescript tests for web-sys
This commit is contained in:
@ -67,6 +67,13 @@ impl InstructionBuilder<'_, '_> {
|
||||
&[AdapterType::I32],
|
||||
);
|
||||
}
|
||||
Descriptor::NamedAnyref(name) => {
|
||||
self.instruction(
|
||||
&[AdapterType::NamedAnyref(name.clone())],
|
||||
Instruction::I32FromAnyrefOwned,
|
||||
&[AdapterType::I32]
|
||||
)
|
||||
}
|
||||
Descriptor::RustStruct(class) => {
|
||||
self.instruction(
|
||||
&[AdapterType::Struct(class.clone())],
|
||||
@ -161,6 +168,13 @@ impl InstructionBuilder<'_, '_> {
|
||||
&[AdapterType::I32],
|
||||
);
|
||||
}
|
||||
Descriptor::NamedAnyref(name) => {
|
||||
self.instruction(
|
||||
&[AdapterType::NamedAnyref(name.clone())],
|
||||
Instruction::I32FromAnyrefBorrow,
|
||||
&[AdapterType::I32],
|
||||
);
|
||||
}
|
||||
Descriptor::String | Descriptor::CachedString => {
|
||||
// This allocation is cleaned up once it's received in Rust.
|
||||
self.instruction(
|
||||
@ -224,6 +238,15 @@ impl InstructionBuilder<'_, '_> {
|
||||
&[AdapterType::I32],
|
||||
);
|
||||
}
|
||||
Descriptor::NamedAnyref(name) => {
|
||||
self.instruction(
|
||||
&[AdapterType::NamedAnyref(name.clone()).option()],
|
||||
Instruction::I32FromOptionAnyref {
|
||||
table_and_alloc: None,
|
||||
},
|
||||
&[AdapterType::I32],
|
||||
);
|
||||
}
|
||||
Descriptor::I8 => self.in_option_sentinel(AdapterType::S8),
|
||||
Descriptor::U8 => self.in_option_sentinel(AdapterType::U8),
|
||||
Descriptor::I16 => self.in_option_sentinel(AdapterType::S16),
|
||||
|
Reference in New Issue
Block a user