You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rich enums (enum entries are const class instances)
Enums are redesigned: an enum is a class and each entry is a cached const
instance — a singleton, so == is identity — replacing the int-ordinal model.
Every entry carries index (ordinal) and name, and EnumName.values lists
them. Dart enhanced enums work: entries with constructor arguments, fields,
and methods (Planet.earth.gravity()). Explicit-value entries (C#/TypeScript Medium = 5) expose the value via .value.
Generation: Java/Kotlin emit native rich enums; C#/TypeScript/Python emit a
class + static-const-instances idiom (simple enums are unchanged).
Wasm: enum entries compile to heap instances (lazily built, cached per entry); .index/.name/fields/methods and EnumName.values all work.
Breaking change: an enum entry is no longer an int — use Color.blue.index (and .value for explicit = N entries) instead of int x = Color.blue.
Constructors & instantiation for JavaScript and Python
JavaScript: a constructor(...) class method is now parsed as a real
constructor, and new Foo(...) / Foo(...) instantiate the class (running the
constructor, which can assign this.x = …). Round-trips to constructor(...)
and translates to other languages.
Python: self.x = … attribute assignment is now parsed, __init__ is
treated as the constructor, and Foo(...) instantiates the class. The
generator emits def __init__(self, …). (Previously instance-field assignment
was unimplemented, so __init__ wasn't usable end-to-end.)
Both round-trip across languages (e.g. a JS/Python class with a constructor
translates to a runnable Dart class). The README OOP table marks JS and Python
"Constructors & instantiation" as supported.
async/await for JavaScript, TypeScript, C# and Python
These languages now parseasync functions/methods (and async arrows /
lambdas) and the await expression, joining Dart. Parsed code executes on the
shared async runtime, round-trips back to its source language, and translates
across languages (e.g. C# async Task<int> ⇄ Dart Future<int> … async).
C# and Python also gained async code generation (async/async def); the
JavaScript and TypeScript generators already emitted it.
await now unwraps any awaitable type — Future<T>, Promise<T> (TypeScript)
and Task<T> (C#) — to its value type T, so awaiting a typed result infers
the correct type. A shared word-boundary keyword token keeps identifiers like awaiter from being read as await + er.
The README "Control flow & operators" table gains an async/await row.
Wasm: static methods + boxed Object
The WebAssembly compiler now supports static class methods: each is
synthesized as an exported module function under the qualified Class.method
name (no this), generated like a top-level function. ApolloRunnerWasm
gains executeClassMethod, resolving the export by that name.
New boxed representation for Object/dynamic values: an i32 pointer to a
16-byte heap cell [tag@0][typeId@4][payload@8]. Concrete values flowing into
an Object slot are boxed, and toString() dispatches on the box tag
(int/double/bool/String, plus boxed instances by typeId). Enables List<Object>/List<dynamic> literals and arguments with mixed element
types, marshalled host-side by ApolloRunnerWasm.
A homogeneous list literal initializing a List<Object>/List<dynamic>
variable (e.g. List<Object> x = [1, 2, 3]) now boxes its elements. The
literal infers a concrete element type (List<int>) and previously stored
unboxed values that the boxed read path misread (garbage output or an
out-of-bounds trap); the declared target element type is now honored.
Validated against both the AST interpreter and the compiled+executed Wasm
module.
Only static methods are callable without an instance
A non-static class method now requires a class instance to run. The
interpreter's executeClassMethod (and any internal call that reaches a
non-static method with no this in context, e.g. a static method calling an
instance sibling) throws ApolloVMRuntimeError instead of silently running
against an auto-created instance. Pass classInstanceObject / classInstanceFields to run a non-static method, or mark the entry method static. This matches the Wasm backend, where only static methods are
exported.
ApolloRunnerWasm.executeClassMethod now reports a clear error for a
non-static target (only static methods are exported) and rejects being given a
class instance (the Wasm backend has no instance-method entry points).
The Wasm generator rejects a receiver-less call to a non-static method (e.g. a static method calling an instance sibling) with a clear UnsupportedError.
Examples and the README run entry methods as static where they hold no
instance state, or supply an instance otherwise.
Tests
Test files now carry dart test tags: a backend tag (wasm, plus wasm-gc/wasm-chrome for browser-only Wasm tests) and per-source-language
tags (dart, java, kotlin, javascript, typescript, lua, csharp, python). E.g. dart test -t wasm, dart test -t kotlin, or dart test -x wasm-gc for the native wasm_run CI.