Switch everything over to the new to_wasm macro.

This commit is contained in:
Tom Alexander
2023-12-29 15:03:36 -05:00
parent cad2be43bf
commit 579cbb5d11
66 changed files with 1258 additions and 1252 deletions

View File

@@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainList;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainList {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@@ -20,17 +20,24 @@ to_wasm!(
PlainList<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PlainList(original) },
{ "TODO".into() },
{
Ok(WasmPlainList {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.iter()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmPlainList {
additional_properties: AdditionalProperties::default(),
},
))
}
);
impl Into<WasmAstNode> for WasmPlainList {
fn into(self) -> WasmAstNode {
WasmAstNode::PlainList(self)
}
}