Use macros for creating the intermediate stage.

This is to make it easier to change function signatures by consolidating the places where the signatures exist.
This commit is contained in:
Tom Alexander
2023-10-29 17:29:16 -04:00
parent ba511b7f9e
commit f98a09bc59
62 changed files with 565 additions and 972 deletions

View File

@@ -1,24 +1,21 @@
use crate::error::CustomError;
use super::ast_node::IAstNode;
use super::macros::intermediate;
use super::registry::Registry;
use super::IElement;
use super::IObject;
use super::IAstNode;
use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IFootnoteDefinition {}
impl IFootnoteDefinition {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::FootnoteDefinition<'parse>,
) -> Result<IFootnoteDefinition, CustomError> {
intermediate!(
IFootnoteDefinition,
FootnoteDefinition,
|registry, original| async {
registry
.register_footnote_definition(original.label, &original.children)
.await?;
Ok(IFootnoteDefinition {})
}
}
);
#[derive(Debug)]
pub(crate) struct IRealFootnoteDefinition {
@@ -27,8 +24,8 @@ pub(crate) struct IRealFootnoteDefinition {
}
impl IRealFootnoteDefinition {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
pub(crate) async fn new<'reg, 'orig, 'parse>(
registry: &'reg mut Registry<'orig, 'parse>,
footnote_id: usize,
contents: Vec<IAstNode>,
) -> Result<IRealFootnoteDefinition, CustomError> {