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
SetsVariable(VariableId, TypeId, SpanWithSource)
Also used for DCE
Getter
Mostly trivial, sometimes can call a function :(
Setter
All changes to the value of a property
Fields
under: PropertyKey<'static>
new: PropertyValue
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
position: SpanWithSource
CallsType
This includes closed over variables, anything dependent
Fields
with: Box<[SynthesisedArgument]>
timing: CallingTiming
called_with_new: CalledWithNew
position: SpanWithSource
Conditionally
Run events conditionally
Iterate
Run events multiple times
Fields
kind: IterationKind
initial: ClosedOverVariables
Contains initial values that the iteration runs over. Without, initial iterations can’t access anything…?
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
prototype: PrototypeArgument
referenced_in_scope_as: TypeId
This is the id referencing a [Type::AliasTo
] that is created
This is also for the specialisation (somehow)
position: SpanWithSource
ExceptionTrap
aka try-catch-finally
Fields
FinalEvent(FinalEvent)
RegisterVariable
doesn’t affect type checking useful for linting WIP
EndOfControlFlow(u32)
TODO was trying to avoid
Trait Implementations§
source§impl From<FinalEvent> for Event
impl From<FinalEvent> for Event
source§fn from(value: FinalEvent) -> Self
fn from(value: FinalEvent) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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