Implement dynamic block.
Some checks failed
clippy Build clippy has failed
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-build Build rust-build has failed
rust-test Build rust-test has failed

This commit is contained in:
Tom Alexander 2023-12-30 20:56:35 -05:00
parent 03c8c07fe0
commit ff3e0a50af
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -7,12 +7,16 @@ use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::DynamicBlock;
use crate::types::GetAffiliatedKeywords;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmDynamicBlock {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
#[serde(rename = "block-name")]
pub(crate) block_name: String,
pub(crate) arguments: Option<String>,
}
to_wasm!(
@ -21,8 +25,12 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::DynamicBlock(original) },
{ "TODO".into() },
{ "dynamic-block".into() },
{
let additional_properties = original
.get_affiliated_keywords()
.to_wasm(wasm_context.clone())?;
let children = original
.children
.iter()
@ -36,7 +44,9 @@ to_wasm!(
Ok((
children,
WasmDynamicBlock {
additional_properties: AdditionalProperties::default(),
additional_properties,
block_name: original.block_name.to_owned(),
arguments: original.parameters.map(|s| s.to_owned()),
},
))
}