Remove unnecessary additional properties in the already-implemented types.

This commit is contained in:
Tom Alexander
2023-12-29 21:04:31 -05:00
parent 83e4b72307
commit a4414369ce
6 changed files with 41 additions and 45 deletions

View File

@@ -4,15 +4,15 @@ 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::Planning;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlanning {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) scheduled: Option<Box<WasmAstNode>>,
pub(crate) deadline: Option<Box<WasmAstNode>>,
pub(crate) closed: Option<Box<WasmAstNode>>,
}
to_wasm!(
@@ -21,12 +21,41 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::Planning(original) },
{ "TODO".into() },
{ "planning".into() },
{
Ok((
Vec::new(),
WasmPlanning {
additional_properties: AdditionalProperties::default(),
scheduled: original
.scheduled
.as_ref()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.map_or(Ok(None), |r| r.map(Some))?
.map(|child| Box::new(child)),
deadline: original
.deadline
.as_ref()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.map_or(Ok(None), |r| r.map(Some))?
.map(|child| Box::new(child)),
closed: original
.closed
.as_ref()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.map_or(Ok(None), |r| r.map(Some))?
.map(|child| Box::new(child)),
},
))
}