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
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
6 changed files with 41 additions and 45 deletions

View File

@ -4,16 +4,12 @@ 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::Bold;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmBold {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
pub struct WasmBold {}
to_wasm!(
WasmBold,
@ -33,11 +29,6 @@ to_wasm!(
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmBold {
additional_properties: AdditionalProperties::default(),
},
))
Ok((children, WasmBold {}))
}
);

View File

@ -129,7 +129,7 @@ to_wasm!(
})
.map_or(Ok(None), |r| r.map(Some))?
.map(|child| Box::new(child)),
pre_blank: 0,
pre_blank: 0, // TODO: Should this be a no-op?
},
))
}

View File

@ -4,16 +4,12 @@ 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::PlainText;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainText {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
pub struct WasmPlainText {}
to_wasm!(
WasmPlainText,
@ -22,12 +18,5 @@ to_wasm!(
wasm_context,
{ WasmAstNode::PlainText(original) },
{ "plain-text".into() },
{
Ok((
Vec::new(),
WasmPlainText {
additional_properties: AdditionalProperties::default(),
},
))
}
{ Ok((Vec::new(), WasmPlainText {},)) }
);

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)),
},
))
}

View File

@ -4,16 +4,12 @@ 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::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSection {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
pub struct WasmSection {}
to_wasm!(
WasmSection,
@ -33,11 +29,6 @@ to_wasm!(
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmSection {
additional_properties: AdditionalProperties::default(),
},
))
Ok((children, WasmSection {}))
}
);

View File

@ -4,15 +4,12 @@ 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::StatisticsCookie;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmStatisticsCookie {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) value: String,
}
@ -27,7 +24,6 @@ to_wasm!(
Ok((
Vec::new(),
WasmStatisticsCookie {
additional_properties: AdditionalProperties::default(),
value: original.value.to_owned(),
},
))