Skip to main content

TypedExprKind

Enum TypedExprKind 

Source
pub enum TypedExprKind {
Show 43 variants Number(f64), BigInt(String), String(String), Boolean(bool), Null, Undefined, This, Regex { source: String, flags: String, }, LocalRef { ident: Ident, boxed: bool, }, LocalNarrowRef { binding: Ident, path: ReferencePath, }, GlobalRef { mangled: MangledName, name: Ident, }, FunctionRef { mangled: MangledName, name: Ident, }, EffectThen { effect: ExprId, result: ExprId, }, Sequence { stmts: Vec<StmtId>, result: ExprId, }, Binary { op: BinOp, lhs: ExprId, rhs: ExprId, }, Unary { op: UnOp, operand: ExprId, }, Call { mangled: MangledName, args: Vec<ExprId>, type_predicate: Option<Box<TypePredicate>>, }, CallClosure { callee: ExprId, args: Vec<ExprId>, }, McpCall { server: String, tool: String, args: Vec<ExprId>, }, GenericCall { mangled: MangledName, type_args: Vec<Type>, args: Vec<GenericArgument>, return_cast: Option<Type>, type_predicate: Option<Box<TypePredicate>>, }, IntrinsicCall { kind: Intrinsic, args: Vec<ExprId>, }, MethodCall { receiver: ExprId, iface: MangledName, name: Ident, args: Vec<ExprId>, type_predicate: Option<Box<TypePredicate>>, }, SuperCtorCall { parent: MangledName, args: Vec<ExprId>, }, SuperMethodCall { owner: MangledName, name: Ident, args: Vec<ExprId>, }, GenericMethodCall { receiver: ExprId, iface: MangledName, name: Ident, args: Vec<GenericArgument>, return_cast: Option<Type>, type_predicate: Option<Box<TypePredicate>>, }, ObjectLiteral { members: Vec<TypedObjectMember>, fields: Vec<TypedObjectFieldOrigin>, }, ArrayLiteral { elements: Vec<TypedArrayElement>, element_ty: Type, }, TupleLiteral { elements: Vec<ExprId>, element_types: Vec<Type>, }, FieldAccess { receiver: ExprId, name: Ident, }, InterfacePropertyAccess { receiver: ExprId, iface: MangledName, name: Ident, }, NumberEnumMember { enum_mangled: MangledName, variant: Ident, value: f64, }, StringEnumMember { enum_mangled: MangledName, variant: Ident, value: String, }, IndexAccess { receiver: ExprId, index: ExprId, }, Closure { runtime_generics: Vec<String>, params: Vec<TypedParam>, return_type: Type, body: ClosureBody, captured: Vec<CapturedVar>, }, TypeofTag { value: ExprId, tag: TypeofTagKind, }, Narrowed { path: ReferencePath, source: ExprId, binding: Ident, cast_info: CastInfo, inner: ExprId, }, Ternary { cond: ExprId, then_: ExprId, else_: ExprId, }, NullishCoalesce { lhs: ExprId, rhs: ExprId, }, OptionalChain { base: ExprId, parts: Vec<TypedChainPart>, }, PostfixUnary { op: PostfixOp, target: PostfixTarget, }, NonNullAssert { value: ExprId, }, Cast { value: ExprId, target_ty: Type, check: Option<Box<Type>>, }, InstanceOf { value: ExprId, class: Type, },
}

Variants§

§

Number(f64)

§

BigInt(String)

bigint literal — no n suffix, no sign; negatives are Unary { Neg, … }.

§

String(String)

§

Boolean(bool)

§

Null

§

Undefined

§

This

this inside a class method or constructor body. A leaf; TypedExpr.ty carries the enclosing class’s Type::ClassRef. Codegen lowers it to local.get <this-slot> (the receiver param for methods, the allocated instance local for constructors).

§

Regex

Fields

§source: String
§flags: String
§

LocalRef

Fields

§ident: Ident
§boxed: bool
§

LocalNarrowRef

Narrowed shadow of a LocalRef/GlobalRef. binding holds the synthetic #narrow_<N> ident so tooling can recover path without string-matching the # prefix. No boxed field — shadows are region-scoped and never mutated.

Fields

§binding: Ident
§

GlobalRef

Fields

§mangled: MangledName
§name: Ident
§

FunctionRef

Distinct from GlobalRef — codegen lowers to a closure adapter, not global.get.

Fields

§mangled: MangledName
§name: Ident
§

EffectThen

Evaluate effect, discard its value, then yield result.

The void operator lowers to this with an undefined result. It also lets a fold that decides an expression’s value statically keep the computation that produced the operand: typeof f() === "number" has a constant answer when f’s return type decides the tag, but JS evaluates the operand either way.

Fields

§effect: ExprId
§result: ExprId
§

Sequence

Run stmts in order, then yield result. An assignment used as a value lowers to this: its assignment statement, then a read of what it assigned. stmts declares no binding that outlives the expression.

Fields

§stmts: Vec<StmtId>
§result: ExprId
§

Binary

Fields

§

Unary

Fields

§op: UnOp
§operand: ExprId
§

Call

Static dispatch. Closure-through-value invocation goes through CallClosure instead.

Fields

§mangled: MangledName
§args: Vec<ExprId>
§type_predicate: Option<Box<TypePredicate>>

Type guard predicate from callee’s signature; codegen ignores it.

§

CallClosure

call_ref dispatch; distinct from Call (direct call instruction).

Fields

§callee: ExprId
§args: Vec<ExprId>
§

McpCall

@mcp/<server>.<tool>(args) — dispatched through the single submilli:mcp.call host fn rather than a per-tool import. Carries the server and tool names directly, so codegen needs no mangled-name parsing. The result type (on the containing TypedExpr) drives how the returned JSON text is materialized (a string, or a typed value via the JSON.parse validator).

Fields

§server: String
§tool: String
§args: Vec<ExprId>
§

GenericCall

Callee signature has bare Type::TypeVar slots. Per-position is_generic flags and return_cast drive box/cast at the call boundary. Always statically dispatched (no generic closures).

Fields

§mangled: MangledName
§type_args: Vec<Type>
§return_cast: Option<Type>

Some(T) when the unsubstituted return is a bare TypeVar; codegen emits a cast to materialize the call-site type. None when return is already concrete.

§type_predicate: Option<Box<TypePredicate>>
§

IntrinsicCall

Intrinsic recognised by name in the inferer; bypasses the normal Call path.

Fields

§args: Vec<ExprId>
§

MethodCall

Interface method dispatch. Codegen composes <iface>#<name> to find the direct-dispatch thunk, falling back to vtable dispatch.

Fields

§receiver: ExprId
§name: Ident
§args: Vec<ExprId>
§type_predicate: Option<Box<TypePredicate>>
§

SuperCtorCall

super(...) in a subclass constructor: a direct call of the parent’s constructor init fn on the current this (self-first ABI). Codegen pushes this then the args. Type is Void.

Fields

§args: Vec<ExprId>
§

SuperMethodCall

super.method(...): a direct call of the parent body that declares the method (owner), skipping vtable dispatch so it doesn’t re-resolve to the override. Codegen pushes this then the args.

Fields

§name: Ident
§args: Vec<ExprId>
§

GenericMethodCall

MethodSig has a bare TypeVar in args or return. HOF methods (map, filter, …) with TypeVar only inside composites stay as plain MethodCall. Variadic trailing args are pre-packed by the typechecker, so args.len() always matches params.len() 1:1.

Fields

§receiver: ExprId
§name: Ident
§return_cast: Option<Type>
§type_predicate: Option<Box<TypePredicate>>

Guard predicate after type-arg substitution; codegen ignores it.

§

ObjectLiteral

fields records the static shape in canonical order. members retains source evaluation order. In a spread literal, ordinary properties become singleton object sources so each source can be copied immediately.

Fields

§members: Vec<TypedObjectMember>

Every expression the literal evaluates, in source order, as JavaScript evaluates them. A value a later member overwrites is still here: it is evaluated for its effects and then discarded. Each field’s source refers to one of these.

§

ArrayLiteral

element_ty lets codegen pick the wrapper struct’s element type without re-running inference.

Fields

§element_ty: Type
§

TupleLiteral

Same source syntax as ArrayLiteral; emitted when the expected type is Type::Tuple. element_types drives per-slot boxing in codegen.

Fields

§elements: Vec<ExprId>
§element_types: Vec<Type>
§

FieldAccess

Fields

§receiver: ExprId
§name: Ident
§

InterfacePropertyAccess

Distinct from FieldAccess — codegen composes <iface>#<name> rather than a struct field offset.

Fields

§receiver: ExprId
§name: Ident
§

NumberEnumMember

Enum name is a compile-time namespace with no runtime representation; value is stored inline so codegen emits i32.const N.

Fields

§enum_mangled: MangledName
§variant: Ident
§value: f64
§

StringEnumMember

Codegen emits a string-pool reference rather than i32.const.

Fields

§enum_mangled: MangledName
§variant: Ident
§value: String
§

IndexAccess

Fields

§receiver: ExprId
§index: ExprId
§

Closure

captured is empty until the capture pass runs; codegen reads entries in order as env struct slots.

Fields

§runtime_generics: Vec<String>
§params: Vec<TypedParam>
§return_type: Type
§captured: Vec<CapturedVar>
§

TypeofTag

typeof x === "<tag>" check. Distinct from Is so primitive type-test codegen stays free of vtable/shape-disjunction logic (Object and Function need both).

Fields

§value: ExprId
§

Narrowed

Wraps the dependent side of &&/||/ternary. See docs/narrowing.md primitive #6.

Fields

§source: ExprId
§binding: Ident
§cast_info: CastInfo
§inner: ExprId
§

Ternary

Narrowing on cond flows into then_ (true env) and else_ (false env).

Fields

§cond: ExprId
§then_: ExprId
§else_: ExprId
§

NullishCoalesce

a ?? b. Result type is union(strip_null(lhs.ty), rhs.ty).

Fields

§

OptionalChain

Each part carries result_ty so codegen steps through without re-running inference. Containing TypedExpr.ty is union(tail_result_ty, Null).

Fields

§base: ExprId
§

PostfixUnary

Statement-position uses are desugared into AssignLocal/AssignGlobal/etc. before codegen; only expression-position uses reach here.

Fields

§

NonNullAssert

value! — runtime-checked non-null assertion. Throws Error on null.

Fields

§value: ExprId
§

Cast

value as target_ty. check carries the structural shape to validate at runtime (the target with interfaces reduced to object shapes) when the source isn’t a static subtype of the target; None for a statically-proven upcast (repr-only narrow, no runtime test).

Fields

§value: ExprId
§target_ty: Type
§check: Option<Box<Type>>
§

InstanceOf

x instanceof Foo — lowers to ref.test (ref $Foo). class is the resolved Type::ClassRef; the result type is boolean.

Fields

§value: ExprId
§class: Type

Trait Implementations§

Source§

impl Clone for TypedExprKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TypedExprKind

Source§

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

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

impl PartialEq for TypedExprKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TypedExprKind

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more