2023-10-29 17:29:16 -04:00
|
|
|
/// Write the implementation for the intermediate ast node for a type that is a noop or is not yet implemented.
|
|
|
|
///
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
macro_rules! inoop {
|
|
|
|
($istruct:ident, $pstruct:ident) => {
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub(crate) struct $istruct {}
|
|
|
|
|
|
|
|
impl $istruct {
|
|
|
|
pub(crate) async fn new<'reg, 'orig, 'parse>(
|
|
|
|
registry: &'reg mut Registry<'orig, 'parse>,
|
|
|
|
original: &'orig organic::types::$pstruct<'parse>,
|
|
|
|
) -> Result<$istruct, CustomError> {
|
|
|
|
Ok($istruct {})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) use inoop;
|
|
|
|
|
|
|
|
/// Write the implementation for the intermediate ast node.
|
|
|
|
///
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
macro_rules! intermediate {
|
|
|
|
($istruct:ident, $pstruct:ident, $fnbody:expr) => {
|
|
|
|
impl $istruct {
|
|
|
|
pub(crate) async fn new<'reg, 'orig, 'parse>(
|
|
|
|
registry: &'reg mut Registry<'orig, 'parse>,
|
|
|
|
original: &'orig organic::types::$pstruct<'parse>,
|
|
|
|
) -> Result<$istruct, CustomError> {
|
|
|
|
$fnbody(registry, original).await
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) use intermediate;
|
|
|
|
|
|
|
|
/// Write the implementation for the intermediate ast node.
|
|
|
|
///
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
macro_rules! iselector {
|
|
|
|
($istruct:ident, $pstruct:ident, $fnbody:expr) => {
|
|
|
|
impl $istruct {
|
|
|
|
pub(crate) fn new<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
|
|
|
|
registry: &'reg mut Registry<'orig, 'parse>,
|
|
|
|
original: &'orig organic::types::$pstruct<'parse>,
|
|
|
|
) -> BoxFuture<'inp, Result<$istruct, CustomError>> {
|
|
|
|
$fnbody(registry, original).boxed()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) use iselector;
|
2023-10-29 18:26:52 -04:00
|
|
|
|
|
|
|
macro_rules! iitem {
|
|
|
|
($registry:expr, $original:expr, $(($penum:path, $ienum:path, $istruct:ident),)*) => {
|
|
|
|
match $original {
|
|
|
|
$(
|
|
|
|
&$penum(inner) => Ok($ienum(
|
|
|
|
$istruct::new($registry, &inner).await?,
|
|
|
|
)),
|
|
|
|
)*
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) use iitem;
|