2023-12-29 20:03:36 +00:00
|
|
|
use serde::Deserialize;
|
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::to_wasm::ToWasm;
|
2023-12-28 00:10:43 +00:00
|
|
|
use crate::compare::ElispFact;
|
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-29 20:03:36 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
2023-12-30 02:04:31 +00:00
|
|
|
pub struct WasmSection {}
|
2023-12-25 16:33:43 +00:00
|
|
|
|
|
|
|
to_wasm!(
|
2023-12-29 17:49:43 +00:00
|
|
|
WasmSection,
|
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,
|
2023-12-29 20:03:36 +00:00
|
|
|
{ WasmAstNode::Section(original) },
|
|
|
|
{ "section".into() },
|
2023-12-25 16:33:43 +00:00
|
|
|
{
|
2023-12-28 00:10:43 +00:00
|
|
|
let children = original
|
|
|
|
.children
|
|
|
|
.iter()
|
|
|
|
.map(|child| {
|
|
|
|
child
|
|
|
|
.to_wasm(wasm_context.clone())
|
2023-12-29 17:49:43 +00:00
|
|
|
.map(Into::<WasmAstNode>::into)
|
2023-12-28 00:10:43 +00:00
|
|
|
})
|
|
|
|
.collect::<Result<Vec<_>, _>>()?;
|
|
|
|
|
2023-12-30 02:04:31 +00:00
|
|
|
Ok((children, WasmSection {}))
|
2023-12-25 16:33:43 +00:00
|
|
|
}
|
|
|
|
);
|