Implement table row.

This commit is contained in:
Tom Alexander 2023-12-30 18:30:44 -05:00
parent 4e18cbafba
commit e0fbf17226
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

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::TableRow; use crate::types::TableRow;
use crate::types::TableRowType;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmTableRow { pub struct WasmTableRow {
#[serde(flatten)] #[serde(rename = "type")]
pub(crate) additional_properties: AdditionalProperties, pub(crate) row_type: String,
} }
to_wasm!( to_wasm!(
@ -21,7 +21,7 @@ to_wasm!(
original, original,
wasm_context, wasm_context,
{ WasmAstNode::TableRow(original) }, { WasmAstNode::TableRow(original) },
{ "TODO".into() }, { "table-row".into() },
{ {
let children = original let children = original
.children .children
@ -36,7 +36,11 @@ to_wasm!(
Ok(( Ok((
children, children,
WasmTableRow { WasmTableRow {
additional_properties: AdditionalProperties::default(), row_type: match original.get_type() {
TableRowType::Standard => "standard",
TableRowType::Rule => "rule",
}
.to_owned(),
}, },
)) ))
} }