From ff3e0a50af68611dcda55560a0bf7079df5900fd Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 30 Dec 2023 20:56:35 -0500 Subject: [PATCH] Implement dynamic block. --- src/wasm/dynamic_block.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wasm/dynamic_block.rs b/src/wasm/dynamic_block.rs index 3b4f1ac4..76e3c9ce 100644 --- a/src/wasm/dynamic_block.rs +++ b/src/wasm/dynamic_block.rs @@ -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, } 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()), }, )) }