Skip to main content

Module package_declaration

Module package_declaration 

Source
Expand description

Top-level declarations of a module, indexed by symbol space.

PackageDeclaration is to a Submilli module what a .d.ts file is to a TypeScript module — a description of what the module exposes to the outside world. Codegen consumes its own module’s declaration as well as the declarations of every imported module to translate symbolic names into Wasm import entries and (post-MVP) to look up signatures for cross-module calls.

Structs§

ClassExtends
A class’s resolved extends clause. Parent and type args are one fact: every chain walker that hops to the parent must zip args against the parent’s generics, so they travel together.
FieldSig
A class instance field. Unlike PropertySig, a field may be mutable and carries visibility; readonly fields are writeable only inside the declaring constructor. Optional fields widen reads to T | undefined.
MethodSig
NamespaceSymbol
No runtime representation; member resolution is fully static. Recursive derived operations require the containing declaration’s successful PackageDeclaration::check_type_limits check since its last mutation. Namespaced types are also mirrored into PackageDeclaration::types under their full dotted key.
PackageDeclaration
Maps are BTreeMap for deterministic iteration order; codegen derives stable function-index assignments from it.
Param
PropertySig
readonly mirrors the declared modifier and forbids writes through the interface (shallow — it does not affect assignability). Optional properties widen reads to T | undefined.
RuntimeFunction
TypeSymbol
ValueSymbol

Enums§

AccessorSig
One accessor function on a class property. Getter and setter are independent (TS 4.3+): a property may declare a getter, a setter, or both, and their types need not match. The setter carries its parameter (name + write type).
DefaultValue
Restricted to shapes materializable without re-evaluating arbitrary source. Re-evaluated per call (matching JS/TS) — a fresh TypedExpr is spliced at each call site.
Dispatch
EnumVariantValue
TypeKind
ValueKind