Implement special block.

This commit is contained in:
Tom Alexander 2023-12-30 20:43:01 -05:00
parent efc4a04829
commit aa5629354e
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -2,10 +2,12 @@ use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::headline::Noop;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::GetAffiliatedKeywords;
use crate::types::SpecialBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
@ -13,6 +15,10 @@ use crate::wasm::to_wasm::ToWasmStandardProperties;
pub struct WasmSpecialBlock {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
#[serde(rename = "type")]
pub(crate) block_type: String,
pub(crate) parameters: Option<String>,
pub(crate) results: Noop,
}
to_wasm!(
@ -21,8 +27,12 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::SpecialBlock(original) },
{ "TODO".into() },
{ "special-block".into() },
{
let additional_properties = original
.get_affiliated_keywords()
.to_wasm(wasm_context.clone())?;
let children = original
.children
.iter()
@ -36,7 +46,10 @@ to_wasm!(
Ok((
children,
WasmSpecialBlock {
additional_properties: AdditionalProperties::default(),
additional_properties,
block_type: original.block_type.to_owned(),
parameters: original.parameters.map(|s| s.to_owned()),
results: Noop {},
},
))
}