Repository navigation
v2.4.0 - Wasm: class inheritance (extends / super)
Wasm: class inheritance (extends / super)
The on-the-fly WebAssembly compiler now supports single inheritance, matching the AST interpreter.
- A subclass instance carries its superclass's fields first in its heap layout, so an inherited field sits at the same offset as on the superclass — a superclass method, compiled once, reads/writes the correct slot when invoked on a subclass instance.
- Method resolution walks the
extendschain: an override on the subclass wins, otherwise the inherited superclass method. - The subclass constructor runs inherited field initializers (superclass-first).
super.method(args)keeps the current instance as the receiver while dispatching to the superclass (skipping the override).
Covers inherited method calls (bare and via a receiver, with arguments), inherited field read/write (including double), own+inherited fields at distinct offsets, override-wins, super.method() / super.method(args), and multi-level extends chains.
Dispatch is static (by the receiver's declared type); virtual dispatch through an upcast receiver, super.field/super.getter, and inherited user-getters remain follow-ups. Static members are intentionally not inherited (matching Dart).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.4.0/CHANGELOG.md