Implement node property.

This commit is contained in:
Tom Alexander 2023-12-30 19:01:07 -05:00
parent c2b3509b6a
commit 4bd5f3bec7
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -4,15 +4,14 @@ use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::NodeProperty;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmNodeProperty {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) key: String,
pub(crate) value: Option<String>,
}
to_wasm!(
@ -21,12 +20,13 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::NodeProperty(original) },
{ "TODO".into() },
{ "node-property".into() },
{
Ok((
Vec::new(),
WasmNodeProperty {
additional_properties: AdditionalProperties::default(),
key: original.property_name.to_owned(),
value: original.value.map(|s| s.to_owned()),
},
))
}