delete ExternalPoints

This commit is contained in:
AF 2023-07-29 21:34:58 +00:00
parent 027a46da2f
commit 89a035bcdb
5 changed files with 18 additions and 72 deletions

View File

@ -62,13 +62,18 @@ pub trait MentionableTop<'a, Ctx: Context<'a>>: 'a {
/// See implementation for the definition. /// See implementation for the definition.
/// Hash of all the references' points concatenated, ordered, non-unique. /// 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. /// 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(); let mut vec = Vec::new();
self.points_typed(&mut vec); self.points_typed(&mut vec);
Ctx::hash(&vec) Ctx::hash(&vec)
} }
/// References ([Point]s) to other objects. Typed. /// 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>>: pub trait Mentionable<'a, Ctx: Context<'a>>:

View File

@ -3,7 +3,6 @@
pub mod atomic; pub mod atomic;
pub mod cast; pub mod cast;
pub mod collections; pub mod collections;
mod external_points;
pub mod inject; pub mod inject;
pub mod inlining; pub mod inlining;
mod local_origin; mod local_origin;

View File

@ -2,7 +2,6 @@
use crate::func::{context::*, controlflow::ControlFlow}; use crate::func::{context::*, controlflow::ControlFlow};
use crate::rcore::*; use crate::rcore::*;
use crate::rstd::external_points::*;
use crate::rstd::{inlining::*, nullable::*, point::*, *}; use crate::rstd::{inlining::*, nullable::*, point::*, *};
/// Node containing a (nullable) reference to the next node and an element. /// 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> impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> MentionableBase<'a, Ctx>
for StackNode<'a, Ctx, A> 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> for StackNode<'a, Ctx, A>
{ {
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>)
<A as ExternalPoints<'a, Ctx, _>>::ex_points_typed(&self.rest, points); where
Self: Mentionable<'a, Ctx>,
{
self.rest.points_typed(points);
self.element.points_typed(points); self.element.points_typed(points);
} }
} }
@ -117,19 +106,6 @@ impl<F: ParseMode> ImplMode for StackNodeFactory<F> {
type Mode = F::Mode; 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> impl<'a, Ctx: Context<'a>, F: ImplMode + RegularFactory<'a, Ctx>> RegularFactory<'a, Ctx>
for StackNodeFactory<F> for StackNodeFactory<F>
where where
@ -177,14 +153,14 @@ pub trait ExtStack<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>>:
} }
/// Extention trait with helper methods for [Stack]s. /// 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> MentionableBase<'a, Ctx>
{ {
/// Collect all the elements into a [`Vec`]. /// Collect all the elements into a [`Vec`].
fn vec(self) -> StackVecWrapped<'a, Ctx, A>; 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> for Stack<'a, Ctx, A>
where where
StackNode<'a, Ctx, A>: Mentionable<'a, Ctx, _Fctr = StackNodeFactory<A::Fctr>>, 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> ExtStackClone<'a, Ctx, A> for Stack<'a, Ctx, A>
where where
StackNode<'a, Ctx, A>: Mentionable<'a, Ctx, _Fctr = StackNodeFactory<A::Fctr>>, 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> impl<'a, Ctx: Context<'a>, F: ImplMode + InliningFactory<'a, Ctx>> InliningFactory<'a, Ctx>
for StackNodeFactory<F> for StackNodeFactory<F>
where where

View File

@ -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)
}
}

View File

@ -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> impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> MentionableTop<'a, Ctx> for StaticPairObject<SP>
where where
SP::A: MentionableTop<'a, Ctx>, SP::A: Mentionable<'a, Ctx>,
SP::B: MentionableTop<'a, Ctx>, SP::B: Mentionable<'a, Ctx>,
{ {
fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) {
let (a, b) = self.pair.elements(); let (a, b) = self.pair.elements();