Enum ezno_checker::events::Event

source ·
pub enum Event {
    ReadsReference {
        reference: RootReference,
        reflects_dependency: Option<TypeId>,
        position: SpanWithSource,
    },
    SetsVariable(VariableId, TypeId, SpanWithSource),
    Getter {
        on: TypeId,
        under: PropertyKey<'static>,
        reflects_dependency: Option<TypeId>,
        publicity: Publicity,
        position: SpanWithSource,
        bind_this: bool,
    },
    Setter {
        on: TypeId,
        under: PropertyKey<'static>,
        new: PropertyValue,
        initialization: bool,
        publicity: Publicity,
        position: SpanWithSource,
    },
    CallsType {
        on: TypeId,
        with: Box<[SynthesisedArgument]>,
        reflects_dependency: Option<TypeId>,
        timing: CallingTiming,
        called_with_new: CalledWithNew,
        possibly_thrown: Option<TypeId>,
        position: SpanWithSource,
    },
    Conditionally {
        condition: TypeId,
        truthy_events: u32,
        otherwise_events: u32,
        position: SpanWithSource,
    },
    Iterate {
        kind: IterationKind,
        initial: ClosedOverVariables,
        iterate_over: u32,
    },
    CreateObject {
        prototype: PrototypeArgument,
        referenced_in_scope_as: TypeId,
        position: SpanWithSource,
    },
    ExceptionTrap {
        investigate: u32,
        trapped_type_id: Option<Trapped>,
        handle: u32,
        finally: u32,
    },
    FinalEvent(FinalEvent),
    RegisterVariable {
        name: String,
        position: SpanWithSource,
        initial_value: Option<TypeId>,
    },
    EndOfControlFlow(u32),
}
Expand description

Events which happen

Used for getting values and states

reflects_dependency means the result goes into the type argument map. This corresponds to the type id (of constructor) it goes under

Variants§

§

ReadsReference

Reads a reference (as a free variable or this)

Can be used for DCE reasons, or finding variables in context

Fields

§reference: RootReference
§reflects_dependency: Option<TypeId>
§

SetsVariable(VariableId, TypeId, SpanWithSource)

Also used for DCE

§

Getter

Mostly trivial, sometimes can call a function :(

Fields

§under: PropertyKey<'static>
§reflects_dependency: Option<TypeId>
§publicity: Publicity
§bind_this: bool
§

Setter

All changes to the value of a property

Fields

§under: PropertyKey<'static>
§initialization: bool

THIS DOES NOT CALL SETTERS, JUST SETS VALUE! TODO this is [define] property see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields

§publicity: Publicity
§

CallsType

This includes closed over variables, anything dependent

Fields

§reflects_dependency: Option<TypeId>
§called_with_new: CalledWithNew
§possibly_thrown: Option<TypeId>
§

Conditionally

Run events conditionally

Fields

§condition: TypeId
§truthy_events: u32
§otherwise_events: u32
§

Iterate

Run events multiple times

Fields

§initial: ClosedOverVariables

Contains initial values that the iteration runs over. Without, initial iterations can’t access anything…?

§iterate_over: u32

TODO for of and in variants here:

§

CreateObject

lil bit magic, handles:

  • Creating objects {}
  • Creating objects with prototypes:
    • Arrays
    • Map & Sets
    • HTMLElement and derivatives
function x() {
    return {}
}

TODO this is only need if exposed by return typed. It may get added but needs some way of ignoring it if not in externally referenced set or something

Fields

§referenced_in_scope_as: TypeId

This is the id referencing a [Type::AliasTo] that is created

This is also for the specialisation (somehow)

§

ExceptionTrap

aka try-catch-finally

Fields

§investigate: u32

events in the try block

§trapped_type_id: Option<Trapped>

This can run subtyping

§handle: u32

events in catch block

§finally: u32

run Immediately before a control-flow statement (return, throw, break, continue) is executed in the try block or catch block

§

FinalEvent(FinalEvent)

§

RegisterVariable

doesn’t affect type checking useful for linting WIP

Fields

§name: String
§initial_value: Option<TypeId>

None for let x;

§

EndOfControlFlow(u32)

TODO was trying to avoid

Trait Implementations§

source§

impl Clone for Event

source§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<FinalEvent> for Event

source§

fn from(value: FinalEvent) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.