organic/src/wasm/section.rs

35 lines
800 B
Rust
Raw Normal View History

use serde::Deserialize;
use serde::Serialize;
2023-12-25 12:55:48 -05:00
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
2023-12-27 19:10:43 -05:00
use crate::compare::ElispFact;
use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSection {}
to_wasm!(
2023-12-29 12:49:43 -05:00
WasmSection,
2023-12-25 11:51:39 -05:00
Section<'s>,
2023-12-25 12:32:35 -05:00
original,
wasm_context,
{ WasmAstNode::Section(original) },
{ "section".into() },
{
2023-12-27 19:10:43 -05:00
let children = original
.children
.iter()
.map(|child| {
child
.to_wasm(wasm_context.clone())
2023-12-29 12:49:43 -05:00
.map(Into::<WasmAstNode>::into)
2023-12-27 19:10:43 -05:00
})
.collect::<Result<Vec<_>, _>>()?;
Ok((children, WasmSection {}))
}
);