Switch everything over to the new to_wasm macro.

This commit is contained in:
Tom Alexander
2023-12-29 15:03:36 -05:00
parent cad2be43bf
commit 579cbb5d11
66 changed files with 1258 additions and 1252 deletions

View File

@@ -2,42 +2,6 @@
///
/// This exists to make changing the type signature easier.
macro_rules! to_wasm {
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
fn to_wasm(
&self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> {
let $original = self;
$fnbody
}
}
};
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
fn to_wasm(
&self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> {
let $original = self;
let $standard_properties =
self.to_wasm_standard_properties($wasm_context.clone())?;
$fnbody
}
}
};
}
pub(crate) use to_wasm;
/// Write the implementation for the intermediate ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! new_to_wasm {
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
@@ -83,7 +47,7 @@ macro_rules! new_to_wasm {
}
#[cfg(feature = "wasm_test")]
impl<'s> ElispFact<'s> for $ostruct {
impl<'s> crate::compare::ElispFact<'s> for $ostruct {
fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> {
let $original = self;
let ret = $elispnamebody;
@@ -93,4 +57,4 @@ macro_rules! new_to_wasm {
};
}
pub(crate) use new_to_wasm;
pub(crate) use to_wasm;