EmptyInject
This commit is contained in:
parent
bab0b4169e
commit
f6cc23ff5f
@ -7,7 +7,7 @@ use sha2::{Digest, Sha256};
|
||||
|
||||
use crate::func::{context::FunctorContext, *};
|
||||
use crate::rcore::*;
|
||||
use crate::rstd::{cast::*, typeless::*};
|
||||
use crate::rstd::{cast::*, inject::*, typeless::*};
|
||||
|
||||
pub struct NoDiagnostic;
|
||||
|
||||
@ -92,9 +92,16 @@ impl<'a> Resolver<'a, TestContextPlain> for EmptyResolver {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reparse<'a, A: Mentionable<'a, TestContextPlain>>(mentionable: Rc<A>) -> A {
|
||||
let factory = mentionable.factory();
|
||||
TypelessMentionable::from_typed(mentionable)
|
||||
.cast(factory)
|
||||
.expect("cast failed")
|
||||
struct EmptyInject;
|
||||
|
||||
impl<'a, Ctx: Context<'a>> Inject<'a, Ctx> for EmptyInject {
|
||||
fn inject<A: 'a>(&self, fa: Wrapped<'a, Ctx, A>) -> Wrapped<'a, Ctx, A> {
|
||||
fa
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reparse<'a, A: Mentionable<'a, TestContextPlain>>(mentionable: Rc<A>) -> A {
|
||||
Rc::new(EmptyInject)
|
||||
.inject_mentionable(mentionable.as_ref())
|
||||
.expect("re-parsing failed")
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ use std::cmp::max;
|
||||
|
||||
use crate::func::{context::*, *};
|
||||
use crate::rcore::*;
|
||||
use crate::rstd::inject::*;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user