2023-12-25 16:33:43 +00:00
|
|
|
use serde::Serialize;
|
|
|
|
|
2023-12-25 17:55:48 +00:00
|
|
|
use super::ast_node::WasmAstNode;
|
2023-12-25 16:33:43 +00:00
|
|
|
use super::macros::to_wasm;
|
|
|
|
use super::standard_properties::WasmStandardProperties;
|
|
|
|
use super::to_wasm::ToWasm;
|
2023-12-27 16:36:47 +00:00
|
|
|
use crate::types::Section;
|
2023-12-25 16:33:43 +00:00
|
|
|
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
|
|
|
|
2023-12-25 17:42:38 +00:00
|
|
|
#[derive(Debug, Serialize)]
|
2023-12-25 16:33:43 +00:00
|
|
|
#[serde(tag = "ast_node")]
|
2023-12-25 17:55:48 +00:00
|
|
|
#[serde(rename = "section")]
|
2023-12-27 17:20:58 +00:00
|
|
|
pub struct WasmSection<'s, 'p> {
|
2023-12-25 16:33:43 +00:00
|
|
|
standard_properties: WasmStandardProperties,
|
2023-12-27 17:04:54 +00:00
|
|
|
children: Vec<WasmAstNode<'s, 'p>>,
|
2023-12-25 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
to_wasm!(
|
2023-12-27 16:36:47 +00:00
|
|
|
WasmSection<'s, 'p>,
|
2023-12-25 16:51:39 +00:00
|
|
|
Section<'s>,
|
2023-12-25 17:32:35 +00:00
|
|
|
original,
|
2023-12-25 16:33:43 +00:00
|
|
|
wasm_context,
|
|
|
|
standard_properties,
|
|
|
|
{
|
2023-12-25 16:51:39 +00:00
|
|
|
Ok(WasmSection {
|
2023-12-25 16:33:43 +00:00
|
|
|
standard_properties,
|
|
|
|
children: Vec::new(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
);
|
2023-12-25 17:55:48 +00:00
|
|
|
|
2023-12-27 16:36:47 +00:00
|
|
|
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSection<'s, 'p> {
|
|
|
|
fn into(self) -> WasmAstNode<'s, 'p> {
|
2023-12-25 17:55:48 +00:00
|
|
|
WasmAstNode::Section(self)
|
|
|
|
}
|
|
|
|
}
|