delete ExternalPoints
This commit is contained in:
parent
027a46da2f
commit
89a035bcdb
@ -62,13 +62,18 @@ pub trait MentionableTop<'a, Ctx: Context<'a>>: 'a {
|
||||
/// See implementation for the definition.
|
||||
/// Hash of all the references' points concatenated, ordered, non-unique.
|
||||
/// Used for walking over object trees to ensure two objects with different references don't collide.
|
||||
fn topology(&self) -> Hash {
|
||||
fn topology(&self) -> Hash
|
||||
where
|
||||
Self: Mentionable<'a, Ctx>,
|
||||
{
|
||||
let mut vec = Vec::new();
|
||||
self.points_typed(&mut vec);
|
||||
Ctx::hash(&vec)
|
||||
}
|
||||
/// References ([Point]s) to other objects. Typed.
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>)
|
||||
where
|
||||
Self: Mentionable<'a, Ctx>;
|
||||
}
|
||||
|
||||
pub trait Mentionable<'a, Ctx: Context<'a>>:
|
||||
|
@ -3,7 +3,6 @@
|
||||
pub mod atomic;
|
||||
pub mod cast;
|
||||
pub mod collections;
|
||||
mod external_points;
|
||||
pub mod inject;
|
||||
pub mod inlining;
|
||||
mod local_origin;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
use crate::func::{context::*, controlflow::ControlFlow};
|
||||
use crate::rcore::*;
|
||||
use crate::rstd::external_points::*;
|
||||
use crate::rstd::{inlining::*, nullable::*, point::*, *};
|
||||
|
||||
/// Node containing a (nullable) reference to the next node and an element.
|
||||
@ -36,19 +35,6 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> Serializable for StackNo
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> MentionableBase<'a, Ctx>
|
||||
for StackNode<'a, Ctx, A>
|
||||
{
|
||||
@ -59,11 +45,14 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> MentionableBase<'a, Ctx>
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> MentionableTop<'a, Ctx>
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> MentionableTop<'a, Ctx>
|
||||
for StackNode<'a, Ctx, A>
|
||||
{
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
<A as ExternalPoints<'a, Ctx, _>>::ex_points_typed(&self.rest, points);
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>)
|
||||
where
|
||||
Self: Mentionable<'a, Ctx>,
|
||||
{
|
||||
self.rest.points_typed(points);
|
||||
self.element.points_typed(points);
|
||||
}
|
||||
}
|
||||
@ -117,19 +106,6 @@ impl<F: ParseMode> ImplMode for StackNodeFactory<F> {
|
||||
type Mode = F::Mode;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: ImplMode + RegularFactory<'a, Ctx>>
|
||||
ExternalPointsProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode<F, RegularMode>
|
||||
where
|
||||
F::Mtbl: MentionableTop<'a, Ctx>,
|
||||
{
|
||||
fn exp_points_typed(
|
||||
mentionable: &Stack<'a, Ctx, Mtbl<'a, Ctx, Self::F>>,
|
||||
points: &mut impl PointsVisitor<'a, Ctx>,
|
||||
) {
|
||||
mentionable.points_typed(points)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: ImplMode + RegularFactory<'a, Ctx>> RegularFactory<'a, Ctx>
|
||||
for StackNodeFactory<F>
|
||||
where
|
||||
@ -177,14 +153,14 @@ pub trait ExtStack<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>>:
|
||||
}
|
||||
|
||||
/// Extention trait with helper methods for [Stack]s.
|
||||
pub trait ExtStackClone<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx> + Clone>:
|
||||
pub trait ExtStackClone<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Clone>:
|
||||
MentionableBase<'a, Ctx>
|
||||
{
|
||||
/// Collect all the elements into a [`Vec`].
|
||||
fn vec(self) -> StackVecWrapped<'a, Ctx, A>;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx> + Mentionable<'a, Ctx>> ExtStack<'a, Ctx, A>
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Mentionable<'a, Ctx>> ExtStack<'a, Ctx, A>
|
||||
for Stack<'a, Ctx, A>
|
||||
where
|
||||
StackNode<'a, Ctx, A>: Mentionable<'a, Ctx, _Fctr = StackNodeFactory<A::Fctr>>,
|
||||
@ -206,7 +182,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx> + Mentionable<'a, Ctx> + Clone>
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Mentionable<'a, Ctx> + Clone>
|
||||
ExtStackClone<'a, Ctx, A> for Stack<'a, Ctx, A>
|
||||
where
|
||||
StackNode<'a, Ctx, A>: Mentionable<'a, Ctx, _Fctr = StackNodeFactory<A::Fctr>>,
|
||||
@ -229,19 +205,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: ImplMode + InliningFactory<'a, Ctx>>
|
||||
ExternalPointsProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode<F, InliningMode>
|
||||
where
|
||||
F::Mtbl: MentionableTop<'a, Ctx>,
|
||||
{
|
||||
fn exp_points_typed(
|
||||
mentionable: &Stack<'a, Ctx, Mtbl<'a, Ctx, Self::F>>,
|
||||
points: &mut impl PointsVisitor<'a, Ctx>,
|
||||
) {
|
||||
mentionable.points_typed(points)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: ImplMode + InliningFactory<'a, Ctx>> InliningFactory<'a, Ctx>
|
||||
for StackNodeFactory<F>
|
||||
where
|
||||
|
@ -1,21 +0,0 @@
|
||||
use crate::rcore::*;
|
||||
|
||||
pub trait ExternalPoints<'a, Ctx: Context<'a>, T> {
|
||||
fn ex_points_typed(mentionable: &T, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
}
|
||||
|
||||
pub trait ExternalPointsProxy<'a, Ctx: Context<'a>, T>: FactoryModeProxy<'a, Ctx> {
|
||||
fn exp_points_typed(mentionable: &T, points: &mut impl PointsVisitor<'a, Ctx>);
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>, T> ExternalPoints<'a, Ctx, T> for A
|
||||
where
|
||||
Fctr<'a, Ctx, A>: WithParseMode,
|
||||
<Fctr<'a, Ctx, A> as WithParseMode>::WithMode:
|
||||
ExternalPointsProxy<'a, Ctx, T, F = Fctr<'a, Ctx, A>>,
|
||||
{
|
||||
fn ex_points_typed(mentionable: &T, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
type Wm<'a, Ctx, A> = <Fctr<'a, Ctx, A> as WithParseMode>::WithMode;
|
||||
<Wm<'a, Ctx, A> as ExternalPointsProxy<'a, Ctx, _>>::exp_points_typed(mentionable, points)
|
||||
}
|
||||
}
|
@ -114,8 +114,8 @@ impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> MentionableBase<'a, Ctx>
|
||||
|
||||
impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> MentionableTop<'a, Ctx> for StaticPairObject<SP>
|
||||
where
|
||||
SP::A: MentionableTop<'a, Ctx>,
|
||||
SP::B: MentionableTop<'a, Ctx>,
|
||||
SP::A: Mentionable<'a, Ctx>,
|
||||
SP::B: Mentionable<'a, Ctx>,
|
||||
{
|
||||
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) {
|
||||
let (a, b) = self.pair.elements();
|
||||
|
Loading…
Reference in New Issue
Block a user