Introducing a trait for running compares.
This should enable us to invoke compares without needing a reference ast node type.
This commit is contained in:
parent
36b80dc093
commit
e83417b243
@ -1,5 +1,6 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use super::elisp_compare::WasmElispCompare;
|
||||
use crate::compare::Token;
|
||||
use crate::wasm::WasmAstNode;
|
||||
use crate::wasm::WasmDocument;
|
||||
@ -9,8 +10,7 @@ pub fn wasm_compare_document<'b, 's, 'p>(
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: WasmDocument<'s, 'p>,
|
||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
// wasm_compare_ast_node(
|
||||
todo!()
|
||||
wasm.compare_ast_node(source, emacs)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -153,33 +153,29 @@ fn wasm_compare_ast_node<'b, 's, 'p>(
|
||||
todo!()
|
||||
}
|
||||
|
||||
// fn wasm_compare_list<'b, 's, EI, WI, WC>(
|
||||
// source: &'s str,
|
||||
// emacs: EI,
|
||||
// wasm: WI,
|
||||
// // emacs: &'b Token<'s>,
|
||||
// // wasm: WasmDocument<'s>,
|
||||
// ) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>
|
||||
// where
|
||||
// EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
|
||||
// WI: Iterator<Item = WC>,
|
||||
// WasmAstNode<'b, 's>: From<WC>,
|
||||
// {
|
||||
// let mut this_status = WasmDiffStatus::Good;
|
||||
// let mut child_status = Vec::new();
|
||||
// let mut message = None;
|
||||
|
||||
// todo!()
|
||||
// }
|
||||
|
||||
fn impl_wasm_compare_document<'b, 's, 'p>(
|
||||
fn wasm_compare_list<'b, 's, 'p, EI, WI, WC>(
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: WasmDocument<'s, 'p>,
|
||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = WasmDiffStatus::Good;
|
||||
emacs: EI,
|
||||
wasm: WI,
|
||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>
|
||||
where
|
||||
EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
|
||||
WI: Iterator<Item = WC> + ExactSizeIterator,
|
||||
WC: WasmElispCompare<'s, 'p>,
|
||||
{
|
||||
// let mut this_status = WasmDiffStatus::Good;
|
||||
// let mut child_status = Vec::new();
|
||||
// let mut message = None;
|
||||
|
||||
todo!()
|
||||
}
|
||||
|
||||
impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDocument<'s, 'p> {
|
||||
fn compare_ast_node<'b>(
|
||||
&self,
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
10
src/wasm_test/elisp_compare.rs
Normal file
10
src/wasm_test/elisp_compare.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use super::compare::WasmDiffEntry;
|
||||
use crate::compare::Token;
|
||||
|
||||
pub trait WasmElispCompare<'s, 'p> {
|
||||
fn compare_ast_node<'b>(
|
||||
&'p self,
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
mod compare;
|
||||
mod elisp_compare;
|
||||
mod runner;
|
||||
|
||||
pub use runner::wasm_run_anonymous_compare;
|
||||
|
Loading…
Reference in New Issue
Block a user