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

View File

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

View File

@ -4,15 +4,15 @@ 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::Planning; use crate::types::Planning;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlanning { pub struct WasmPlanning {
#[serde(flatten)] pub(crate) scheduled: Option<Box<WasmAstNode>>,
pub(crate) additional_properties: AdditionalProperties, pub(crate) deadline: Option<Box<WasmAstNode>>,
pub(crate) closed: Option<Box<WasmAstNode>>,
} }
to_wasm!( to_wasm!(
@ -21,12 +21,41 @@ to_wasm!(
original, original,
wasm_context, wasm_context,
{ WasmAstNode::Planning(original) }, { WasmAstNode::Planning(original) },
{ "TODO".into() }, { "planning".into() },
{ {
Ok(( Ok((
Vec::new(), Vec::new(),
WasmPlanning { 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::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::Section; use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmSection { pub struct WasmSection {}
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!( to_wasm!(
WasmSection, WasmSection,
@ -33,11 +29,6 @@ to_wasm!(
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
Ok(( Ok((children, WasmSection {}))
children,
WasmSection {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );

View File

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