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