Skip to main content

ClassPlan

Struct ClassPlan 

Source
pub struct ClassPlan { /* private fields */ }
Expand description

The class-emission plan, computed once and threaded through the codegen phases.

Implementations§

Source§

impl ClassPlan

Source

pub fn is_empty(&self) -> bool

Source

pub fn collect( ta: &TypedAst, imported: &BTreeMap<MangledName, ImportedClassLayout>, ) -> Result<Self, CompilerFailure>

Phase 0: gather class declarations from the typed AST, topologically ordered by extends (parents before children), and resolve each class’s full field + method slot layout across the inheritance chain.

Source

pub fn field_name_lists(&self) -> Vec<Vec<FieldName>>

The ordered list of class field-name vectors, for the shared field-names-array global emission (field_names::emit). Built from the same helper the instance payload is, so the two cannot drift.

Source

pub fn accessor_property_names(&self) -> Vec<String>

Accessor property names across all classes. They need per-name $string globals for the runtime property scan, but are not data fields, so they’re excluded from field_name_lists (no shape stores them).

Source

pub fn reserve_and_emit_types( &mut self, types: &mut TypeSection, next_type_idx: &mut u32, symbols: &mut SymbolTable, intrinsics: IntrinsicTypeIndices, ) -> Result<(), CompilerFailure>

Phase: emit standalone method fn-type sigs, then reserve struct/vtable type indices, then emit the class rec group. types/next_type_idx advance in lockstep with the wasm-encoder type section.

Source

pub fn allocate_funcs( &mut self, next_func_idx: &mut u32, symbols: &mut SymbolTable, ) -> Result<(), CompilerFailure>

Phase: reserve function indices — 4 shared universal stubs, then per-class method stubs (one per own method) + getter + setter.

Source

pub fn emit_function_entries( &self, functions: &mut FunctionSection, symbols: &SymbolTable, intrinsics: IntrinsicTypeIndices, ) -> Result<(), CompilerFailure>

Phase: function-section entries for every emitted function, in the same order as allocate_funcs / emit_bodies.

Source

pub fn emit_globals( &self, globals: &mut GlobalSection, symbols: &mut SymbolTable, next_global_idx: &mut u32, intrinsics: IntrinsicTypeIndices, ) -> Result<(), CompilerFailure>

Phase: vtable instance, getter, and setter globals (the field-names array global is emitted separately via field_names::emit).

Source

pub fn emit_bodies( &self, code: &mut CodeSection, debug: &mut DebugFunctions, ctx: &CodegenCtx<'_>, ) -> Result<(), CompilerFailure>

Phase: function bodies — constructor + init, method bodies and their closure adapters, then the retired getter/setter stubs (kept for stable numbering) and the four per-class universal vtable bodies (equals/toString/toJson/hash).

Source

pub fn exported_funcs( &self, symbols: &SymbolTable, is_exported: impl Fn(&MangledName) -> bool, ) -> Result<Vec<(MangledName, u32)>, CompilerFailure>

(export name, func index) pairs for every class function a cross-package consumer may import: the entry constructor, the self-first ctor-init, and every method body. Restricted to classes the package actually exports (is_exported). Method bodies include private methods — Wasm-level visibility is wider than source so a cross-package subclass can fill its inherited vtable slots (docs/classes.md §2, §6). Generic methods are excluded (still emitted as stubs this slice).

Source

pub fn exported_vtable_globals( &self, symbols: &SymbolTable, is_exported: impl Fn(&MangledName) -> bool, ) -> Result<Vec<(MangledName, u32)>, CompilerFailure>

Each exported class’s vtable-singleton global, for the export section — the class’s nominal identity, imported by consumers for instanceof’s ref.eq comparison and as a local subclass’s parent link.

Source

pub fn declared_funcs(&self, symbols: &SymbolTable) -> Vec<u32>

Function indices that appear in a ref.func const-expr and so must be covered by the declarative element section.

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