ExternalPoints
This commit is contained in:
parent
2e73ca8c50
commit
0fa540f7aa
@ -35,8 +35,21 @@ impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> Serializable for StackNo
|
||||
}
|
||||
}
|
||||
|
||||
pub trait StackCompatible<'a, Ctx: Context<'a>>: Mentionable<'a, Ctx> {
|
||||
fn points_typed_rest(stack: &Stack<'a, Ctx, Self>, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
pub trait ExternalPoints<'a, Ctx: Context<'a>, T: MentionableBase<'a, Ctx>> {
|
||||
fn ex_points_typed(mentionable: &T, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
}
|
||||
|
||||
pub trait StackCompatible<'a, Ctx: Context<'a>>:
|
||||
Mentionable<'a, Ctx> + ExternalPoints<'a, Ctx, Stack<'a, Ctx, Self>>
|
||||
{
|
||||
}
|
||||
|
||||
impl<
|
||||
'a,
|
||||
Ctx: Context<'a>,
|
||||
A: Mentionable<'a, Ctx> + ExternalPoints<'a, Ctx, Stack<'a, Ctx, A>>,
|
||||
> StackCompatible<'a, Ctx> for A
|
||||
{
|
||||
}
|
||||
|
||||
pub trait StackCompatibleProxy<'a, Ctx: Context<'a>>: FactoryProxy<'a, Ctx>
|
||||
@ -48,12 +61,13 @@ where
|
||||
fn points_typed_rest(stack: &Self::T, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> StackCompatible<'a, Ctx> for A
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> ExternalPoints<'a, Ctx, Stack<'a, Ctx, Self>>
|
||||
for A
|
||||
where
|
||||
<Fctr<'a, Ctx, A> as WithParseMode>::WithMode:
|
||||
StackCompatibleProxy<'a, Ctx, T = Stack<'a, Ctx, A>, F = Fctr<'a, Ctx, A>>,
|
||||
{
|
||||
fn points_typed_rest(stack: &Stack<'a, Ctx, Self>, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
fn ex_points_typed(stack: &Stack<'a, Ctx, Self>, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
<<Fctr<'a, Ctx, A> as WithParseMode>::WithMode as StackCompatibleProxy<'a, Ctx>>::points_typed_rest(stack, points)
|
||||
}
|
||||
}
|
||||
@ -102,7 +116,7 @@ impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> MentionableTop<'a, Ctx>
|
||||
for StackNode<'a, Ctx, A>
|
||||
{
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
<A as StackCompatible<'a, Ctx>>::points_typed_rest(&self.rest, points);
|
||||
<A as ExternalPoints<'a, Ctx, _>>::ex_points_typed(&self.rest, points);
|
||||
self.element.points_typed(points);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user