Implement babel call.

This commit is contained in:
Tom Alexander 2023-12-30 18:15:58 -05:00
parent c46a935cfc
commit 46c36d7f3e
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -7,12 +7,20 @@ use super::to_wasm::ToWasm;
use super::AdditionalProperties; use super::AdditionalProperties;
use crate::compare::ElispFact; use crate::compare::ElispFact;
use crate::types::BabelCall; use crate::types::BabelCall;
use crate::types::GetAffiliatedKeywords;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmBabelCall { pub struct WasmBabelCall {
#[serde(flatten)] #[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties, pub(crate) additional_properties: AdditionalProperties,
pub(crate) call: Option<String>,
#[serde(rename = "inside-header")]
pub(crate) inside_header: Option<String>,
pub(crate) arguments: Option<String>,
#[serde(rename = "end-header")]
pub(crate) end_header: Option<String>,
pub(crate) value: String,
} }
to_wasm!( to_wasm!(
@ -21,12 +29,21 @@ to_wasm!(
original, original,
wasm_context, wasm_context,
{ WasmAstNode::BabelCall(original) }, { WasmAstNode::BabelCall(original) },
{ "TODO".into() }, { "babel-call".into() },
{ {
let additional_properties = original
.get_affiliated_keywords()
.to_wasm(wasm_context.clone())?;
Ok(( Ok((
Vec::new(), Vec::new(),
WasmBabelCall { WasmBabelCall {
additional_properties: AdditionalProperties::default(), additional_properties,
call: original.call.map(|s| s.to_owned()),
inside_header: original.inside_header.map(|s| s.to_owned()),
arguments: original.arguments.map(|s| s.to_owned()),
end_header: original.end_header.map(|s| s.to_owned()),
value: original.value.to_owned(),
}, },
)) ))
} }