NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev
pub.dev, #3776 most downloaded on pub.dev
Portable multi-language VM: parse, run and translate Dart, Java, Kotlin, Go, C#, JavaScript, TypeScript, Lua and Python — with on-the-fly Wasm compilation and MCP/LSP servers.
Latest stable
2.36.0
Last release 17 days ago
05 Nov 2026
Ships unpredictably
gaps range from 8 days to 2.1 years
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
166 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
New Dart syntax, run by the interpreter and compiled to Wasm: labeled loops, collection if / for / spread, user operators, generic functions, static a
New Dart syntax, run by the interpreter and compiled to Wasm: labeled loops,
collection if / for / spread, user operators, generic functions, static
and top-level getters, mixins and member chains on calls and literals. The
Wasm backend gains catches of what a called function throws, recursive local
functions, lists of instances, static access from outside a class and number
methods. Several interpreter bugs are fixed too.
outer: for (…) with break outer; / continue outer;,
from nested loops and from inside a switch. Generated for Dart, Java, Go,
JS/TS (outer: for) and Kotlin (outer@ for, continue@outer). C#, Lua and
Python refuse them with UnsupportedSyntaxError, and Go and Kotlin refuse a
labeled block (b: { … break b; }), which they can't express.if (c) a else b,
for (var i = 0; i < n; i++) i, for (var e in l) e, ...l and ...?l,
nested in each other. Regenerated as Dart and kept by the binary format
(new tags 131–137). Other targets and Wasm refuse them.V operator +(V o), and the same for
- * / ~/ % < > <= >= == & | ^ << >>. They dispatch on the left operand's
class, and != negates a user ==. Dart output keeps them; JS/TS/Kotlin and
the other targets refuse them instead of emitting invalid code.T first<T>(List<T> l), called as
first<int>(l) or first(l). Erased at run time, like generic classes.static and top-level getters: static int get three => 3; (read as
C.three) and int get two => 2;. Dart output keeps static; Kotlin
refuses a static getter.mixin M { … } and class A with M1, M2 (after an extends,
too). The mixin's fields, methods and accessors are copied into each class
that doesn't declare them; a later mixin wins over an earlier one.P(3).twice().x, P.zero().x,
g()?.x, [1, 2].length, {1, 2}.length, 'abc'.length.List<String> log is first tried as a
generic function named List. That attempt erased String as a type, so a
later String f() parsed with a dynamic return.catch of what a called function throws. An untyped catch (e)
whose try calls a throwing function binds the value boxed from its
runtime tag. It used to bind the raw value as an int, printing a String's
pointer (e.g. 24).
return 'ok ${g(a)}' inside a try compiles. The value is computed
first, and the handler runs if the call threw.var r = g(a); inside a try no longer produces an invalid module.[P(1), P(2)], List<Shape>, m.add(P(2))).
A var list or loop variable takes the element type, and printing uses a
user toString().static members from outside the class: C.n, C.n = v, C.n += v,
C.m(args) and static getters. A static field initializer that isn't a
literal number runs in __init_globals; before, the field started at 0.toString, toDouble, toInt, round, floor,
ceil, truncate, abs, clamp, isEven, isOdd, isNegative,
int.parse. Call chains (a.abs().toString(), (a - b).abs()) used to be
ignored after the first call.break / continue, user operators, mixins,
top-level getters and member chains. A user operator that returns bool
works as a condition.for (var i …) loops in one function declared an extra local, which
shifted the types of the scratch locals;var typed dynamic in one loop and as a class in another clashed.for-each loops shared their iteration locals, so after the inner
loop the outer one resumed over the inner list;n.clamp(0, m.clamp(1, 5)) clamped m instead of n;a + b + c + …) compiles each operand once; it
used to compile them again at every level. a == null doesn't call a user
operator ==.join, sort (with a comparator), map, where, any, every,
fold, reduce, forEach, toList, reversed.forEach, putIfAbsent, entries (each entry reads e.key /
e.value).isEven, isOdd, isNegative.toString() is used by string interpolation and print, also for
instances inside a List, Set or Map, and through print('$l').double prints as one (5.0) in the browser too, where JavaScript
formats a whole double without its .0.a() + b() ran b() first.x += e reads x before e.'${c.b()} ${c.count}' read count
before b().static fields. Concurrent first reads of a class's static fields no
longer see a half-initialized store ('${C.n} ${C.s}' read null). A
static initializer can read another static of its class
(static int b = C.a + 1;, or a static final C instance = C(); whose
constructor updates C.count).make().bump(), make().bump().v and
make().g used to call make() two to seven times.p == null is false without calling a user operator ==.Map ({...m}) is refused: map literals don't take spreads
yet, so {...m} silently built a Set of entries.s += '…$x' on a String, and compound assignment with a dynamic
operand.dynamic / var value keeps its class instance: a for (var p in l)
over List<P> lost p's class.h.fn(4) calls a function stored in the field fn.try { return g(); } catch … and try { return 'ok ${g()}'; } catch …
catch what g() throws.Your coding agent can read these notes before it upgrades. Set up the MCP server →
The Wasm backend now compiles every Dart example of the web playground: nullable values, top-level variables, setters, extensions, records and set lit
The Wasm backend now compiles every Dart example of the web playground:
nullable values, top-level variables, setters, extensions, records and set
literals, plus fixes to async methods.
int?, double?, num? and bool? are stored boxed. They use the
same representation as an Object: a pointer, where 0 is null.
String?, List?, Map? and class types are already pointers, and 0 is
their null. This applies to locals, parameters, fields, returns and
globals.String? holding null came back as "", so ?? never fell back;s?.length and l?[0] on null gave 0 instead of null.null crosses the host boundary. A null argument for a nullable
parameter used to fail with Cannot convert null to a BigInt. A null
return now reaches the caller as null.??= compiles, and is assigned only when the target is null. Before,
it failed with Wasm Operator not supported: nullCoalesce.?? unboxes int? ?? int to a plain int, and tests a nullable
pointer against 0.== null works on a nullable pointer. Before, it was constant false.! unboxes the value. On null it raises
ApolloVMNullPointerException: Null check operator used on a null value,
which a catch inside the function catches; elsewhere it traps. It used to
pass null through.?., ?[, !. and member-access chains work on any receiver
expression: a.next.name, a.next?.next?.name, a.next!.name,
head.next.value = 20, and on top-level variables and fields. Nullable
class-typed fields (Node? next) compile.null String? or instance gives null.Top-level variables compile to module globals. Before, compilation crashed
with Can't find local variable. A literal number seeds its global. Any
other initializer (final List<String> log = [];) runs in an exported
__init_globals, which the runner calls once per module instance before the
entry function. An exported function also calls it on entry (it runs only
once), so another host sees the globals initialized. Functions lowered for
try/catch or async don't make that call yet, and rely on the runner.
Locals and fields shadow them, and g++, compound assignment,
interpolation and method calls (log.add(…)) work on them, and on static
fields too.
A setter compiles to a method named x=. obj.x = v, compound assignment
(which reads through the getter) and a bare x = v inside the class call it.
A bare getter name inside the class reads through the getter. Static setters
are still refused.
Extension methods and getters on a core type (int, String, …) or a user
class compile to functions that take the receiver first. A call picks the
extension by the receiver's static type; a member the class declares itself
wins. Inside an extension, this.toUpperCase() and other implicit-this
calls work. Extension setters and static extension members are refused.
r.$1 / r.name, structural
== (nested records too), printing in Dart's format ((1,),
(a: 1, b: 2)), and records as list and set elements. A record converts
to a declared layout: return (1, 2); from a (double, int) or an
(int?, int) function.length,
isEmpty / isNotEmpty, printing ({1, 2}).async methods: var x = await doubleIt(n) on a sibling static
method typed x as Future<int>. With a typed local, Chrome rejected the
module. The class-method wrappers dropped the async modifier, so their
Wasm return type was Future<T>. Inside an async method, an awaited
sibling static is now resolved as a module function, not a host import.next('x');) left its result
on the stack, and the module failed to validate.?: takes its type from its arms when the static type is dynamic,
e.g. inside a setter. Before, it could produce an i32 block for int
arms.double field initialized with an int literal (double c = 0;) is
converted. Before, the module failed to validate. Field assignments convert
too.[a, 5],
where a is a parameter) takes its type from the elements. Before, it
stored boxes that a List<int> parameter misread.print(x) with Object x = 5) exports the
__alloc its host conversion needs. Before, it failed at run time.count = 7 and count++ wrote the top-level count,
while reads used the field count.Two gaps from `doc/dart_language_gaps.md`: top-level variables, and records.
Two gaps from doc/dart_language_gaps.md:
top-level variables, and records.
Names now resolve lexically: a function or method sees the module it is declared in, not its caller.
int count = 0;
int next() { count++; return count; }
int run() {
var count = 100; // a local: `next()` still uses the top-level `count`
next();
return next(); // 2
}
this.
Before, a call resolved names through the caller's scope (dynamic scoping).
So a caller's local shadowed a top-level variable inside the callee, and a
function could read a variable that only its caller declared.executeClassMethod failed with Can't find variable when a member read
one.import 'lib.dart'; makes lib's
variables readable and writable. An imported function or class uses its
own module's variables. An imported module runs its variable initializers
on first use.local declared after the functions that use
it is invisible to them.global x in a function that assigns a
module-level variable, which Python requires. The Python parser reads
global back.(int, {String name}) make(int n) => (n, name: 'r$n');
var r = make(3);
print('${r.$1} ${r.name}'); // 3 r3
print((1, x: 2) == (1, x: 2)); // true
(1, 'a'), (x: 1, y: 2), positional and named fields
interleaved, and (1,). Fields are evaluated in source order.(int, String), ({int x, int y}), (int, {String name}),
(int,), nullable (int, int)?, and inside collection types
(List<(int, int)>, <(int, int)>{}, <String, (int, int)>{}). A record type accepts a record of the same shape whose
fields it accepts, so (num, num) accepts (1, 2.5).r.$1, r.name. A missing field is a runtime error.toString are Dart's: structural == and hashCode, so
records work as set elements and map keys, and '$r' renders as
(1, a, x: 2).is: r is (int, int) tests the shape and the field types.VMRecord.0x18) and
are generated as Dart. The other targets, and Wasm, refuse them. The
rest of Dart 3's record features need patterns, which aren't supported yet:
destructuring, and switch on records.return null from a nullable function returned the wrong value. From a
String? function or getter it gave void, and from a List<int>?
function a non-null value. It now returns null.var x = C().m() was typed as C (the receiver), so the first
assignment failed. It now has the call's return type.var x = f([a, 2]) failed when f takes a List<int> and a has no
static type, because inferring x matched List<dynamic> against
List<int> strictly. An argument whose type arguments are unknown now
matches; the call is still checked against the actual values when it runs.l[0].field didn't parse, and a field read off an instance kept in a
collection failed. Both work now, including pairs[i].$2.v2.34.0 - Records and top-level variables (lexical scope)
Compare
Casts as receivers lost their parentheses in generated code. (x as A).v came out as x as A.v in Dart, TypeScript and Kotlin, and as (A) x.v in Java an
Fixes from a review of 2.33.0.
(x as A).v came out as x as A.v in Dart, TypeScript and Kotlin, and as(A) x.v in Java and C#. A compound receiver is now always parenthesized,(a + b).field.v++ / --v on a bare getter/setter pair was silently lost. It wroteB(this.x, super.y) passed x as y. A formal the superclass constructorsuper(v); as a constructor's firstsuper(), which had been added on top of it and failed with anthis(v); redirects,x as int ?? 5 didn't parse. The ? of ?? was read as a nullablex is double was true for integers. It is nowint is not a double.instanceof on a primitive operand didn't compile. A test againstInteger, Double, Number or Boolean now boxes the operand:((Object) (1 + 2)) instanceof Integer.Four gaps from `doc/dart_language_gaps.md`: subtyping, type tests and casts, the implicit superclass constructor call, and bare getter reads.
Four gaps from doc/dart_language_gaps.md:
subtyping, type tests and casts, the implicit superclass constructor call,
and bare getter reads.
A a = B(); // was: Can't cast value type (B) to variable type (A)
Shape s = Square(); // through `implements` too
Type checks now follow the class hierarchy (superclasses and implemented
interfaces, at any depth). This covers variables, parameters, return values
and fields, and on A catch now catches a B. A supertype is still rejected
in a subtype slot.
is, is! and asif (a is B) return (a as B).onlyB(); now parses and runs, at Dart's
relational precedence: a + b is int tests the sum, and x is int ? a : b
stays a conditional. The semantics are Dart's:
null passes only a nullable type.int is not a double.as throws ApolloVMCastException.Every target generates its own idiom: Kotlin is/!is/as, Java
instanceof and (T) x, C# is and (T) x, JS/TS
typeof/Array.isArray/instanceof, and Python isinstance. Go, Lua and
Wasm refuse.
A subclass constructor without super(…) never ran its superclass
constructor. What should happen differs per language, so the AST now records
the language it was parsed from (ASTRoot.language, kept by the binary AST):
super(), from a declared constructor and
from the default one. Dart passes its super parameters to it.__init__ is not called.Behaviour change: in Dart, Java and C#, a superclass constructor body now runs where it was skipped before. A superclass constructor that requires arguments now makes an implicit call an error, as it would be at compile time.
return value; for int get value => … now works inside a class or extension
member. Before, only this.value did. The read dispatches on the receiver,
and a local or parameter of the same name still shadows it.
The Dart constructor kinds beyond the plain unnamed one. All four were syntax errors; they now parse, run, generate back to Dart and survive the binar
The Dart constructor kinds beyond the plain unnamed one. All four were
syntax errors; they now parse, run, generate back to Dart and survive the
binary AST. See doc/dart_language_gaps.md.
class Point {
int x;
int y;
Point(this.x, this.y);
Point.origin() : x = 0, y = 0;
}
var p = Point.origin(); // was: [SyntaxError] "$" expectedDeclared with this.x formals, an initializer list and/or a body (private
ones such as Point._() included), and called as Point.origin(),
new Point.origin() or const Point.origin(). As in Dart, a class that
declares only named constructors has no unnamed one.
R(int w, int h) : assert(w > 0), w = w, this.h = h, area = w * h; —
field initializers and asserts run in order, after the this.x formals and
before the body.
super(…) and this(…)B(int v) : super(v + 1) and : super.named(v) now run the superclass
constructor in full, body included, before the subclass body. Until now
the superclass constructor never ran. Super parameters (B(super.x)) are
passed along to the explicit super(…). A redirecting constructor
(Point.diagonal(int v) : this(v, v);) hands the same instance to the target.
What is still missing is the implicit superclass call that Dart makes when a
subclass constructor has no super(…). Without an explicit one, the
superclass constructor still does not run.
factory Shape(String kind) { … } and factory Shape.square() => …; run their
body like a static method; the instance is whatever it returns, an existing one
included. Redirecting factories (factory A() = B;) are not supported yet.
UnsupportedSyntaxError for a class that uses these forms. Most of them emit123). Its initializers use new124–127. Every other constructor, named ones included, keeps itsASTNodeCodec gained a when: predicate: one classv2.32.0 - Named, factory and redirecting constructors, initializer lists
Compare
Dependency refresh only; no API or behavior changes.
Dependency refresh only; no API or behavior changes.
Minimum Dart SDK is now 3.13.0 (was 3.10.0): petitparser 7.1.0 and
web 1.1.2 require it, so the old floor could no longer resolve.
crypto: ^3.0.8petitparser: ^7.1.0web: ^1.1.2archive: ^4.6.0pub_semver: ^2.2.1yaml: ^3.1.4dependency_validator: ^5.1.0, test: ^1.33.0,build_web_compilers: ^4.8.12, build_runner: ^2.16.2v2.31.1 - Dependency refresh, Dart SDK 3.13
Compare
Five features from the Dart language evolution that the Dart front end did not support yet. All five are parsed, interpreted and translated; see `doc/
Five features from the Dart language evolution
that the Dart front end did not support yet. All five are parsed, interpreted
and translated; see doc/dart_language_gaps.md
for what is still missing.
{1, 2} was a syntax error, and Set was not a type ApolloVM knew:
var s = {1, 2, 2}; // was: [SyntaxError] ";" expected
Set literals now parse ({1, 2}, <int>{}, and Set<T> as a declared type),
with the Dart disambiguation kept intact: a bare {} is still an empty map,
and {k: v} is still a map literal, so an empty set has to be written <T>{}.
At run time a set answers to length, isEmpty/isNotEmpty, first/last,
contains, add/addAll, remove, clear, toList and for-in, and
duplicate elements collapse to the first occurrence.
Every target can be generated, using each language's own set — or, for the two that have none, its idiom:
var s = {1, 2};
new HashSet<int>(){{ add(1); add(2); }} // Java
mutableSetOf<Int>(1, 2) // Kotlin
new HashSet<int>(){1, 2} // C#
new Set<number>([1, 2]) // TypeScript / JavaScript
{1, 2} # Python (`set()` when empty)
map[int]struct{}{1: {}, 2: {}} // Go
{ [1] = true, [2] = true } -- Lua
Only the Dart grammar parses a set literal so far. The Wasm backend refuses to
compile one (UnsupportedSyntaxError) rather than lower it to a list and
silently drop the uniqueness the program relies on.
Rich enums accepted fields, a const constructor and methods, but an accessor
in the body was a syntax error:
enum Level {
low(1), high(10);
final int weight;
const Level(this.weight);
int get doubled => this.weight * 2; // was: [SyntaxError] "=" expected
}
An enum body now takes the same members a class body does. Dart round-trips
them, Kotlin emits val doubled: Int get() { … }, and every other target
refuses an enum accessor exactly as it refuses a class accessor, instead of
dropping it.
A constructor could not initialize a field it inherits: this.x is only legal
for a field of the class itself, and super.x — the form Dart 2.17 added for
exactly this — was a syntax error.
class Shape {
final int x;
Shape(this.x);
}
class Square extends Shape {
final int border;
Square(super.x, this.border); // was: [SyntaxError] "$" expected
}
Super parameters now parse and run, positionally, named (with required), with
a default, in a primary constructor header, and through however many levels of
inheritance the field is declared at. The value is assigned to the inherited
field on the instance being built.
Dart output spells it super. again, and this. for a field the class owns.
The distinction is re-derived from the class hierarchy when a binary AST is
decoded — an initializing formal may only name a field of its own class, so one
that names an inherited field is a super parameter by construction — which is
why the image format is unchanged. Targets with no equivalent name the
parameter and drop the qualifier.
Still missing, and unchanged by this: the rest of the initializer list (an
explicit : super(v) call), and running the superclass constructor's body
— no subclass instantiation does that yet.
An initializing formal for a private field could only be called by its private name, which is not what Dart 3.12 means:
class Point {
final int _x;
Point({required this._x});
}
Point(x: 1); // was: Can't find function "Point" ... {namedTypes: [x: int]}
The leading _ is now stripped from the parameter name, so the call site uses
the public name while the parameter keeps writing the private field. Only named
parameters are renamed (a positional this._x has no call-site name), and only
when what is left is a valid public name — __x and _ have none and are left
alone. The declaration keeps this._x in generated Dart, and the rename is
re-derived when a binary AST is decoded, so images stay readable by builds that
predate the feature.
A constructor can now be declared in the class header:
class Point(final int x, var int y) {
int sum() => this.x + this.y;
}
class Counter(var count);
A parameter marked var or final is a declaring parameter: it also declares
the field it initializes (mutable for var, final for final). A parameter
with neither is an ordinary constructor parameter and declares no field. Named
{…} and optional […] groups, required and default values all work, the
body may be replaced by ;, and the class may still declare members, extends
and implements.
The header is desugared as it is parsed into the classic form — the induced
fields plus a constructor taking this.x formals — so every runner, generator
and codec sees a shape it already handles, and Dart output comes back classic:
class Point {
final int x;
int y;
Point(this.x, this.y);
int sum() { return this.x + this.y; }
}
Not supported yet: a named primary constructor (class Point.custom(…)),
class const Point(…), and the in-body this : … form — each needs a
constructor feature ApolloVM does not have (named constructors, compile-time
constants, initializer lists).
List.valueOf(x) — the static conversion Java-shaped source uses — failed the
parse with type 'Null' is not a subtype of type 'ASTClass'. Resolving the
core List class asked for the element type, and a List named in source
carries none, so the lookup returned null into a cast. It now falls back to
the element-type-less List class and the call resolves (List.valueOf(5) →
[5], a list passes through, null becomes []).
An empty map literal with explicit type arguments (<K,V>{}) threw
type 'String' is not a subtype of type 'ASTType?' while parsing, because the
value type was read from the comma's position. That is the form an empty {}
is generated as, so a program containing one could not re-parse its own
translated Dart.
Dart: multiple variables per declaration
A declaration could only introduce one variable, so the ordinary Dart form of declaring several at once was a syntax error:
void main() {
num nr = 0.96, ng = 0.24, nb = 0.56; // was: [SyntaxError] ";" expected
print(nr);
print(ng);
print(nb);
}Every declarator is now accepted, in a function body and at the top level, sharing the declared type and the final / const / late modifier of the first one. A declarator may omit its initializer (int a, b = 5;) and may read the ones before it (int p = 1, q = p + 1;), matching Dart's left-to-right initialization.
The declarators are expanded into one declaration each as the code is parsed, so translation emits the form every target already supports:
num nr = 0.96;
num ng = 0.24;
num nb = 0.56;nr: float = 0.96
ng: float = 0.24
nb: float = 0.56A for initializer still takes a single declarator: a for header has no place for the extra declarations the expansion produces, and the comma-separated form does not exist in every target language.
Full changelog: v2.29.0...v2.30.0
v2.30.0 - Multiple variables per Dart declaration
Compare
int and double now expose the same num interface
int and double now expose the same num interfaceEach primitive only carried the conversion that changed its type: int had
toDouble() and double had toInt(), so the identity half of the pair was
missing on both. 3.toInt() and 1.5.toDouble() — both valid Dart, since
num.toInt() / num.toDouble() return this — failed with
Bad state: Can't find core function: int.toInt(...).
The same gap covered the rest of the num interface on int, which had none
of the members that only double had been given:
on int |
before | now |
|---|---|---|
toInt() |
✗ | ✓ (identity) |
round(), floor(), ceil(), truncate() |
✗ | ✓ (identities) |
toStringAsFixed(), toStringAsExponential(), toStringAsPrecision() |
✗ | ✓ |
toDouble() |
✓ | ✓ |
and on double, toDouble() is added as the matching identity.
This mattered most for a num-typed variable. ApolloVM has no num core
class, so num n = ... dispatches on the runtime value's class — meaning
n.toInt() worked or failed depending on whether n happened to hold a
double or an int. Both now work either way:
num n = 3; // was: Can't find core function: int.toInt
n.toInt(); // 3
n.toDouble(); // 3.0toNum() remains unsupported, as it is not a method on num, int or
double in Dart.
v2.29.0 - int and double share the same num interface
Compare
Fixed: compile <file> --target=ast silently compiled to Wasm
compile <file> --target=ast silently compiled to WasmAn option written after the source file was not parsed at all. The
source-file commands shared a parser built with allowTrailingOptions: false,
so apollovm compile foo.dart --target=ast left the flag sitting in the
leftover positional arguments, --target kept its wasm default, and the
command compiled to WebAssembly without saying that it had ignored anything.
It surfaced as an unrelated Wasm codegen crash — UnimplementedError: Wasm maps with value type dynamic are not supported yet — for a program that was
never meant to reach the Wasm backend. 2.28.0's own compile --help showed
that exact ordering.
Trailing options are now parsed for compile and translate, whose only
positional argument is the source file, so both orderings work. run keeps
them unparsed, because everything after the file there belongs to the program
being executed and must reach it untouched — including arguments that look
like apollovm's own flags.
A leftover positional argument is now reported rather than ignored:
apollovm compile foo.dart oops fails with Unexpected argument after the source file: oops.
compile: target inferred from the output extension, and -t--output now selects the target when --target is omitted, so naming the
file is enough:
apollovm compile foo.dart -o foo.avma # binary AST
apollovm compile foo.dart -o foo.wasm # WebAssembly.avma means the AST target and .wasm means Wasm; any other extension falls
back to the wasm default as before. An explicit --target always wins, so
-t ast -o out.bin still writes an image under that name. The extension is
read from the final path segment, so a . in a parent directory
(build.v2/out) is not mistaken for it.
--target also gained the abbreviation -t, on both compile and
translate.
…silently producing a wrong AST. Raising it is a breaking change and will only ever ship in a major release, announced here.
A parsed AST can now be saved as a compact binary image and loaded back without
running a parser. Parsing dominates the cost of loading code, so an application
can parse once — at build time, or on first run — and afterwards load the same
code unit by decoding bytes.
Such an image is an .avma file: an Apollo Virtual Machine
Archive. It holds one parsed code unit, or a whole VM's worth of them.
Measured on a ~4 KB Dart program: decoding is about 11× faster than parsing
and the image is about two thirds the size of the source. For a very small
unit the fixed header and pools cost more than the source is worth; the saving
appears once there is a program to speak of.
import 'package:apollovm/apollovm_serialization.dart';
var image = vm.saveCodeUnitAST(codeUnit); // Uint8List
await ApolloVM().loadCodeUnitAST(image); // no parser involvedvm.saveAllAST() / vm.loadAllAST() do the same for a whole VM, bundling every
loaded code unit into one archive. The CLI gained
apollovm compile --target=ast, and apollovm run recognizes an image by its
magic bytes — not its extension — taking the language from the image itself.
Everything is Uint8List in and Uint8List out, so file access stays with the
caller and the whole feature works unchanged on the web. The Chrome suite covers
it, including the places where a JavaScript double behaves unlike a VM int.
Loading a decoded unit needs no new path: ApolloVM.loadCodeUnit only reaches
for a parser when a unit has no AST yet, so namespace registration, the
null-safety check and incremental-resolution invalidation all behave exactly as
they do for parsed source. Nothing derivable is stored — parent links,
scope-variable resolution, superclass and extension targets and the this.field
constructor-parameter promotion are re-established by one resolveNode call
after decoding, exactly as every grammar does after a parse.
Nodes holding live Dart state are refused with an error naming where in the
program they were found: external functions and getters, which carry a closure,
and runtime values such as a class instance or a pending future. All of them are
injected by the VM at run time rather than produced by a parser, so a parsed AST
never contains them and the same bindings are re-injected after a binary load.
Coverage is enforced by a test that scans lib/src/ast/ and requires every
concrete AST* class to be registered, pooled as a type, encoded inline by a
parent, or listed as refused with a written reason — so adding a node kind and
forgetting its codec fails the build rather than silently dropping a field.
Every image carries a CRC-32, verified on load. It detects corruption, not
tampering: anyone who can modify a file can recompute the checksum in
microseconds. Only a signature made with a key the attacker does not have makes
an image tamper-evident, and an unsigned image deserves exactly as much trust as
the source it came from — loading one and running it is equivalent to running
arbitrary code from that source.
Signing is optional and pluggable (ASTBinarySigner / ASTBinaryVerifier), so
an HMAC, a public-key signature or a hardware key store all fit;
HmacSha256Signer is built in, which is why crypto becomes a direct
dependency — it was already present transitively. The signature covers
everything up to and including the CRC, so an attacker who edits a section and
recomputes the checksum still fails verification.
An image records two version numbers: the container revision that wrote it, and
the oldest revision that can decode it correctly. Every section is
length-prefixed, so a reader skips any section it does not recognize, and every
section is decoded from a bounded view, so fields appended by a newer writer are
ignored rather than misread. A newer ApolloVM's output therefore keeps loading
in an older ApolloVM for as long as the new information is purely additive, and
an older image keeps loading in every future ApolloVM — the reader retains the
decode path for every format version it has ever supported. When a change
genuinely cannot be understood by an older reader, the writer raises the minimum
reader version and that older reader fails immediately with an
ASTBinaryException naming both versions, rather than silently producing a
wrong AST. Raising it is a breaking change and will only ever ship in a major
release, announced here.
A real image written by format version 1 is committed in the test suite and must
keep loading; it is the only check that can catch an accidental incompatible
change, since an image synthesized by the current writer would move with it.
data_serializer 1.2.3The dependency is raised to ^1.2.3, and this is a requirement rather than a
preference: earlier versions decode LEB128 incorrectly, which silently
corrupts a binary AST image.
Building this format surfaced four bugs there, fixed in 1.2.3:
BytesBuffer.readLeb128SignedInt sign-extended from the wrong byte on every-2 decoded as 126 and 64 as -16320. The binary AST formatdart2js — butshiftLeftInt/shiftRightInt fell back to a 32-bit <</>>,0.|=, also a 32-bit operation, and2^shift — the rangeDateTime.microsecondsSinceEpoch occupies.Together those meant an integer literal of 2^32 or more decoded to the wrong
number on the web: 4294967296 came back as 0, and 1000000000000000 as
2764472320. A test now covers literals from 2^28 upwards, positive and
negative, and it runs under --platform chrome.
set name(T value) { … } is implemented. It was the last accessor with no support at all — no grammar rule, no AST node, no dispatch. 2.26.0 turned it
set name(T value) { … } is implemented. It was the last accessor with no
support at all — no grammar rule, no AST node, no dispatch. 2.26.0 turned it
from a silent misparse (into a method named name returning a type named set)
into a clean parse error; it now works.
Parsed on classes and extensions, with a typed or untyped parameter and an arrow
or block body:
class Box {
int _v = 0;
int get value => _v;
set value(int x) { _v = x; }
set scaled(v) => _v = v * 10;
}A setter runs on every write position — obj.x = v, this.x = v, and an
unqualified x = v inside the class, the write-side mirror of an unqualified
getter read. A real variable in scope still wins, so a setter's own parameter
cannot re-enter it. Compound assignment (obj.x += 1) reads through the getter
when there is one and falls back to the backing field; ??= short-circuits, so
the setter does not run when the current value is non-null. Inherited and
overridden setters resolve through the superclass chain, and extension setters
work like extension getters.
Only Dart generates setters. Every other target refuses with
UnsupportedSyntaxError, and Wasm refuses rather than letting an assignment
silently write the backing field instead of running the setter body.
An arrow-bodied setter regenerates as an arrow: emitting it as a block would
produce set x(v) { return …; }, which Dart rejects because a setter returns
void. The generated output is verified with the real dart analyze.
Those three generators never iterated the class's accessors, so a class with a
getter translated to any of them lost the accessor entirely while the method
bodies kept referencing the property — broken code that looked fine, rather than
the honest UnsupportedSyntaxError Java/C#/JS/TS already produced. They now
refuse, like the others.
ASTBlock.set dropped settersIt copied functions, getters and statements, so every class member survived the
temporary parse block except the new ones.
For getters and setters alike: static accessors, top-level accessors, and an
unqualified read of a getter (return value; inside a method — this.value
works). Kotlin generates getters but not setters.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.27.0/CHANGELOG.md
Annotations ( @override , @Deprecated('x') , @pragma(...) , @a.B(1) ) at every position Dart allows. There was no @ in any grammar in the repo, so a s…
for (var e in l) print('- $e'); is ordinary Dart, and it did not parse. Only
the plain if accepted an unbraced single-statement body — every loop, every
if/else and every else if demanded { }.
All seven remaining rules now accept either form, in Dart, Java 11, Kotlin,
C#, JavaScript and TypeScript: for, for-in/for-each, while,
do/while, if/else, the else if chain, and the final else. A braced
body is still tried first, so nothing about existing sources changes.
singleLineStatement was also far too narrow — return …; or an expression
statement, nothing else — so even the if that already supported it rejected
if (x) break;, if (x) throw e; and a nested if. It is now each language's
full statement set minus declarations and bare blocks.
A dangling else binds to the nearest if, matching every target
language. Python gains the equivalent construct, the inline suite
(if x: return 1, def f(): pass, while c: i += 1; j += 1), at every
suite() position.
Go is deliberately excluded — its spec defines
Block = "{" StatementList "}" — and Lua has no such form. A single-statement
body translated to either is emitted braced / do…end.
Not supported, on purpose: the empty statement as a body (while (c) ;),
for (;;), and ;-separated statements on an ordinary (non-suite) Python line.
else-prefix miscompile, fixed firstBaseGrammarLexer.token() is a prefix matcher with no word-boundary guard, so
string('else') matches the start of an identifier like elseCount. That was
unreachable while every else arm followed a mandatory braced block, and would
have become a silent miscompile the moment bodies could be unbraced:
if (a) x();
elseCount = 1; // `else` matches; `Count = 1;` becomes the else armThe branch and loop rules of all six C-style grammars now use whole-word
keyword tokens. Also covers Kotlin's when entry labels and if expression.
'''Hello $name''' yielded$name. Wrong output, not an error.assert(c) / assert(c, m) as a real statement (it parsed as a call to aassert). Each target emits its own idiom: Javaassert c : m;, Python assert c, m, Kotlin assert(c) { m }, C#Debug.Assert, Lua's built-in, JS/TS/Go lowered to an explicit check. Wasmrequired named parameters on plain, constructor-typed and this.({required int a}) was a hard parse failure.@override, @Deprecated('x'), @pragma(...), @a.B(1))@ in any grammar in the repo,@override broke the whole class body — which matters beyondlib/src/pub loads real pub packages. Parsed andlate on locals and fields (accepted and dropped).const at use sites: const Foo(), const [], const {}.async bodies on local and anonymous functions.catch (e, s) now binds the stack trace — it was parsed and thrown away,s failed.%= &= |= ^= <<= >>=.get twice => …) now parse.if (a) {} else if (b) {} with no trailing else failed toelse non-optional, unlike every other language.do/while translated to Python emitted literaldo { … } while (c);. Now lowers to while True: … if not (c): break.a += 1), which Lua doesa = a + 1.const [1] silently misparsed as an index read on a variable named const.set value(int v) {} silently became a method named value returning aset. Now a clean parse error at the set. Full setter supportFull changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.26.0/CHANGELOG.md
for (var e in l) print('- $e'); is ordinary Dart, and it did not parse. Only
the plain if accepted an unbraced single-statement body — every loop, every
if/else and every else if demanded { }.
All seven remaining rules now accept either form, in Dart, Java 11, Kotlin,
C#, JavaScript and TypeScript: for, for-in/for-each, while,
do/while, if/else, the else if chain, and the final else. A braced
body is still tried first, so nothing about existing sources changes.
singleLineStatement was also far too narrow — return …; or an expression
statement, nothing else — so even the if that already supported it rejected
if (x) break;, if (x) throw e; and a nested if. It is now the language's
full statement set minus declarations and bare blocks.
A dangling else binds to the nearest if, matching every target
language. Python gets the equivalent construct, the inline suite
(if x: return 1, def f(): pass, while c: i += 1; j += 1), for every
suite() position: if/elif/else, for, while, try, def, class
and case.
Go is deliberately excluded — its spec defines Block = "{" StatementList "}"
and every control-flow statement takes a Block — and Lua has no such form. A
single-statement body translated to either is emitted braced / do…end.
Not supported, on purpose: the empty statement as a body (while (c) ;),
for (;;), and ;-separated statements on an ordinary (non-suite) Python line.
else-prefix miscompile, latent until nowBaseGrammarLexer.token() is a prefix matcher with no word-boundary guard, so
string('else') matches the start of an identifier such as elseCount. That
was unreachable while every else arm was preceded by a mandatory braced
block, and would have become a silent miscompile the moment bodies could be
unbraced:
if (a) x();
elseCount = 1; // `else` matches; `Count = 1;` becomes the else arm
The branch and loop rules of all six C-style grammars now use whole-word
keyword tokens. Also covers Kotlin's when entry labels and if expression.
if (a) {} else if (b) {} with no trailing else failed to
parse — both made the final else non-optional, unlike every other language.do/while translated to Python emitted literal
do { … } while (c);. It now lowers to while True: … if not (c): break.a += 1), which is not
valid Lua. It now lowers to a = a + 1.codeBlockOrSingleLineBlock cluster that was defined
but never referenced.'''Hello $name''' yielded
the literal text $name — wrong output, not an error. Raw r'''…''' is
unaffected.assert(c) / assert(c, m) as a real statement. It previously parsed as
a call to a user function named assert and failed later with a confusing
message. A failed assertion throws and is catchable. Every target emits its
own idiom (Java assert c : m;, Python assert c, m, Kotlin
assert(c) { m }, C# Debug.Assert, Lua's built-in, JS/TS/Go lowered to an
explicit check). Wasm refuses to compile it rather than mis-compile it.required named parameters on plain, constructor-typed and this.
forms. ({required int a}) was a hard parse failure. Dart output keeps the
modifier; other targets express required-ness by the absence of a default.@override, @Deprecated('x'), @pragma(...), @a.B(1)
— at every position Dart allows. There was no @ in any grammar in the repo,
so one @override broke the whole class body; this matters beyond
hand-written sources, since lib/src/pub loads real pub packages. Parsed and
discarded for now.late on locals and fields (accepted and dropped).const at use sites: const Foo(), const [], const {}. const [1]
used to silently misparse as an index read on a variable named const.async bodies on local and anonymous functions:
int f(int x) => x * 2; inside a function, and (x) async => ….catch (e, s) now binds the stack trace. It was parsed and thrown away,
so any handler that referenced s failed. ApolloVM has no stack traces, so
it binds to an empty string; targets whose catch header has no second
variable declare it as the handler's first statement.%= &= |= ^= <<= >>=. In JS/TS %= was already in
the grammar but missing from the shared operator enum, so it surfaced as a
SyntaxError.get twice => …) now parse. They failed because
type().optional() greedily ate get and petitparser's optional() cannot
backtrack.set no longer misparses into a methodsimpleType() accepted any identifier, so set value(int v) {} silently became
a method named value returning a type named set, failing much later with
a confusing error. get/set are now rejected in a type position, turning that
into a parse error at the set.
Full setter support remains unimplemented: it would mirror the entire getter subsystem plus assignment dispatch, and getters are generated for only 2 of 9 targets. This change converts a silent misparse into a clear error.
v2.26.0 - Control-flow bodies no longer require braces
Compare
No change to this package's code — this release exists to carry the apollovm_wasm bump, the way 2.23.2 carried apollovm_wasm 1.1.0.
No change to this package's code — this release exists to carry the
apollovm_wasm bump, the way 2.23.2 carried apollovm_wasm 1.1.0.
apollovm_wasm declared apollovm: ^2.0.0, but it is not a loosely-coupled
consumer: it decodes what this package's Wasm generator encodes. The
boxed-Object cell layout and its _boxTag* values are a contract, and both
wasm_runner.dart and wasm_generator.dart carry a comment saying the
constants must match.
That constraint let pub pair the runtime with any 2.x, including releases whose
box encoding it was never built against — a mismatch that shows up as a wrong
value or a trap at run time, not as a resolution failure. It is now
apollovm: ^2.25.0, widened deliberately rather than by default. Its wasm_run
also moves to ^0.2.0+2 (patch, no API change).
Wasm: ?. on a boxed slot no longer refuses to compile
?. on a boxed slot no longer refuses to compilevar x = null; x?.length was an UnimplementedError — "Wasm getter .length
on Null is not supported yet". That was reachable from ordinary code, and the
advice the neighbouring error gives ("declare the variable as var / Object?
/ dynamic") led straight into it.
A boxed slot is the only Wasm representation that can hold null, so it is also
the only place ?. has anything to do — on a concrete slot the receiver cannot
be null and the null-awareness is vacuous. .length / .isEmpty / .isNotEmpty
on a boxed receiver now dispatch on the box tag at runtime:
var missing = null;
var n = missing?.length; // -> null
return n ?? -1; // -> -1Only a boxed String carries these members — List/Map have no boxed form
at all, and the int/double/bool/instance tags have no length — so any other tag
traps rather than reading a length word out of a payload that is not a string
pointer. A plain . on a null box traps too, matching the interpreter's
ApolloVMNullPointerException.
The null-aware result is itself boxed, because it can be null and a nullable
value has no unboxed encoding. That is what lets it flow into ?? and
== null, which already understand boxes. The plain form still yields an
unboxed int/bool.
An explicitly-declared Object? local initialized from a concrete value keeps
the initializer's type instead of being boxed, so Object? s = '' makes s a
String slot. s?.isEmpty then takes the concrete-String path and stores its i32
boolean into a slot sized i64, producing a module that compiles but fails Wasm
validation. That reproduces byte-identically on 2.24.0, so it is a separate
defect in the declaration path rather than a consequence of this change; it is
pinned as a skipped test in test/wasm/apollovm_wasm_boxed_member_test.dart.
Full Changelog: v2.24.0...v2.25.0
v2.25.0 - Wasm: ?. on a boxed slot no longer refuses to compile
Compare
Null-aware access is now really checked on every target, not dropped
a?.b was emitted as a plain a.b on Java, C#, JavaScript, Lua and Python: the
generated code compiled, but the null check was gone — it threw on exactly the
input ?. exists to handle. The README's null-safety matrix marked those cells
⚠️ lossy.
Java, Lua and Python now lower the access to an explicit guard, and the guard
wraps the whole chain rather than the null-aware link alone:
// Dart source
int chain(A? a) { return a?.m().toInt(); }// Java, before: threw when `a` was null
return a.m().toInt();
// Java, now
return (a != null ? a.m().toInt() : null);# Python
return (a.m().toInt() if a is not None else None)C# and JavaScript were lossy for a simpler reason — both have had the operator
all along (C# 6, ES2020) and merely never declared it — so they now emit a?.b
natively. JavaScript uses ?.[i] for element access, and its postfix ! is
handled separately: JavaScript has no null-assertion operator (a postfix ! is
logical NOT), so a! is emitted as plain a rather than negating the value.
Go continues to report ?. / ?[ as unsupported: it represents a nullable T?
as *T, so a degraded access would both skip the nil check and yield the wrong
type.
??, &&, || and x == null are AST nodes of their ownThese four were shapes encoded on the generic binary-operation node and
special-cased ahead of its operator switch, because each of them short-circuits.
Every consumer had to re-detect them by inspecting operands — the null-safety
analyzer reconstructed x != null to promote a variable, the Go backend probed
for a null literal to compare the pointer instead of dereferencing it, and the
Wasm backend re-tested the operator — and the enum's exhaustiveness forced
throw StateError('unreachable') arms in three places.
ASTExpressionNullCoalesce, ASTExpressionLogicalAnd, ASTExpressionLogicalOr
and ASTExpressionNullCheck now carry those shapes, built by the new
astExpressionOperation() factory that the shared grammar reduction uses, so
all nine front-ends get them. Consumers dispatch on the node type instead of
pattern-matching, and evaluating x == null no longer concretizes both operands
and runs them through equality dispatch.
This is internal structure — the generated source is unchanged, except where a
target has a better idiom that the dedicated node makes reachable. Python is the
one such case:
# before
if a == None:
# now
if a is None:== dispatches through __eq__, which a class can redefine to return True
for None; is cannot be intercepted, and is the form PEP 8 mandates.
The Python grammar learned is None / is not None to match, so the
generated source still round-trips — ApolloVM can now read back what it writes.
This is deliberately limited to the None comparison: general a is b is
identity, and mapping it to == would silently turn it into equality, so it
stays unparsed as before.
Building a binary operation directly with ASTExpressionOperation still works
for the ordinary operators. Constructing one with ??, && or || now throws
rather than silently evaluating both operands, which would no longer be a
short-circuit.
Full Changelog: v2.23.3...v2.24.0
v2.24.0 - Null-aware access is now really checked on every target, not dropped
Compare
A signature mismatch is no longer reported as a missing entry function
apollovm.execute returned the same diagnostic whether the entry name was absent or existed but rejected the passed arguments, so a caller that guessed the parameters was told to fix the name:
$ apollovm mcp call apollovm.execute --language dart --args '[1,2,3]' \
--source 'int main(int a, String b){ return 1; }'
{
"diagnostics": [
{ "severity": "error", "message": "Entry function not found: main" }
],
"isError": true
}
ApolloRuntime.execute now separates the two causes. When the name exists but no overload matches, the diagnostic shows the call that was attempted — with the passed argument types — and every declared signature of that name:
No entry function matching the passed arguments: `main(int, int, int)`.
A function named `main` exists, but with a different signature:
`int main(int a, String b)`. Adjust the arguments to match a declared signature.
Several declarations are all listed, so an overload set or a name shared across classes shows the full menu:
No entry function matching the passed arguments: `run(double, double, double)`.
2 functions named `run` exist, but with different signatures:
`int A.run(int a)`, `int B.run(bool x, bool y)`.
Signatures are qualified with their class, including for a method reached through the auto-discovery order (no className given) — the case where the caller cannot otherwise tell which class answered.
An explicit className that does not exist is now reported as a missing class instead of blaming the method: Entry class not found: Bar (looking for the method `run`). A name that is genuinely absent from the source still reports Entry function not found, unchanged.
The extra lookup is read-only and runs only on the failure path, so successful execution is untouched.
Full Changelog: v2.23.2...v2.23.3
Calling apollovm.execute with arguments that no declaration of the entry name
accepts reported the same thing as a typo in the name — Entry function not found: main — leaving the caller with nothing to correct:
$ apollovm mcp call apollovm.execute --language dart --args '[1,2,3]' \
--source 'int main(int a, String b){ return 1; }'
{
"diagnostics": [
{ "severity": "error", "message": "Entry function not found: main" }
],
"isError": true
}
ApolloRuntime.execute now separates the two causes. When the name exists but
no overload matches, the diagnostic shows the call that was attempted and every
declared signature of that name (qualified with the class when it is a method,
including one reached by the auto-discovery order):
No entry function matching the passed arguments: `main(int, int, int)`.
A function named `main` exists, but with a different signature:
`int main(int a, String b)`. Adjust the arguments to match a declared signature.
An explicit className that does not exist now reports Entry class not found: Bar (looking for the method run) instead of blaming the method. A name that
is genuinely absent from the source still reports Entry function not found.
v2.23.3 - Signature mismatch is no longer reported as a missing entry function
Compare
apollovm_wasm 1.1.0 — wasm_run ^0.2.0+1
apollovm_wasm 1.1.0 — wasm_run ^0.2.0+1wasm_run 0.2.0 is a breaking release. It is absorbed inside apollovm_wasm, so consumers keep the same WasmRuntimeIO API and gain one thing: there is no install step any more.
dart run wasm_run:setup is gone. The SDK's build hooks download the native library into .dart_tool/lib/ during dart run / dart test / dart compile, so that directory is now searched first — walking up to every enclosing package root, so a nested package finds a library fetched by its workspace — along with .dart_tool/wasm_run/ (the wasm_run:build_binaries output).
Three further breaks needed handling:
flutter_rust_bridge 2.x, so the symbol that identifies a genuine wasm_run library changed: wire_compile_wasm → frb_get_rust_content_hash. Validating the old one rejected every 0.2 library.WasmRunLibrary.isReachable() became Future<bool>.wasm_run 0.2 initializes its Rust bindings asynchronously, and no longer locates its own library in a pure-Dart application. WasmRunLibrary.setUp() is now awaited once, lazily, on the first module compile — ensureBooted() and isSupported stay synchronous, as WasmRuntime requires, and only probe for the library.WASM_RUN_DART_DYNAMIC_LIBRARY (the variable wasm_run itself reads) now overrides the library path. The older WASM_RUN_LIB_PATH is still honored, and is finally read as a path: it used to be consulted only on platforms with no known library name, and then joined with candidate directories as if it were a file name.
apollovm_wasm now requires Dart >= 3.10, matching wasm_run 0.2.
apollovm 2.23.2Nothing changes for package:apollovm itself — it still compiles Wasm everywhere and pulls in no native toolchain. This release only corrects the places that told people to run a command that no longer exists: mcp doctor, the Wasm test suite and WASM_BACKEND_PLAN.md. CI drops its three wasm_run:setup steps.
The upstream aarch64-apple-darwin 0.2.0 binary is killed by macOS (SIGKILL, Code Signature Invalid) the moment wasmtime executes JIT-compiled Wasm inside the JIT Dart VM — i.e. under dart run and dart test. Compiling and instantiating modules is fine; only the call into generated code trips it, and wasm_run 0.1.0+2 does not hit it on the same machine.
Ahead-of-time compilation is unaffected, so on macOS arm64 run Wasm through dart test --compiler exe / dart compile exe. It is a macOS code-signing enforcement, so other platforms are not expected to be affected — Linux is verified in CI (2541 tests, JIT and AOT).
Full Changelog: v2.23.1...v2.23.2
apollovm_wasm 1.1.0 moves to wasm_run 0.2, which dropped dart run wasm_run:setup in favor
of the SDK's build hooks: the native library is downloaded automatically by dart run,
dart test and dart compile. mcp doctor and the Wasm test suite said otherwise, so they now
just point at package:apollovm_wasm.
Nothing changes for package:apollovm itself — it still compiles Wasm everywhere and pulls in no
native toolchain. See the apollovm_wasm changelog for the details,
including a macOS/Apple-Silicon issue in the upstream 0.2.0 binary.
v2.23.2 - apollovm_wasm 1.1.0: wasm_run 0.2, no install step
Compare
A client that fills in every field rather than omitting the optional ones sends "" — and "" was taken as a real name to look up, so nothing matched:
className/function no longer breaks executionA client that fills in every field rather than omitting the optional ones sends "" — and "" was taken as a real name to look up, so nothing matched:
$ apollovm mcp call apollovm.execute --language dart --class-name "" \
--source 'int main(List a){ return 7; }'
{
"result": null,
...
"diagnostics": [
{ "severity": "error", "message": "Entry function not found: .main" }
],
"isError": true
}
ApolloRuntime.execute now normalizes both entry names: they are trimmed, and a name that is empty after trimming means not specified — className falls back to the full discovery order (top-level function, then any class method) and function falls back to main. Trimming also makes " main " resolve, which previously did not. A name that is genuinely absent from the source still reports Entry function not found, now with the trimmed name in the message.
Class lookup is guarded at the source as well, so an empty name can never match an entry regardless of the caller: LanguageNamespaces.getClass, CodeNamespace.getClass/containsClass, ASTRoot.getClass and ApolloRunner.getClassMethod return early for a blank class name.
lsp/example_workspace/broken.dart is intentionally unparseable — that is what makes the language server emit a parse diagnostic — which made dart format . fail with exit 65 and made the analyzer report it whenever it was opened in an editor. The root analyzer: exclude: covers neither case (an explicit path overrides it), and the formatter has no exclude option at all: formatter: exclude: is rejected as unsupported_option in Dart 3.12.
The fixture is now .broken.dart. Both dart format and dart analyze skip dot-prefixed paths on a directory walk, while the editor still sees a .dart file and hands it to the ApolloVM language server, so the demo is unchanged. A local analysis_options.yaml silences the remaining fixture diagnostics. No published code is affected — lsp/ is .pubignored.
Full Changelog: https://github.com/ApolloVM/apollovm_dart/compare/v2.23.0...v2.23.1
2.22.0 added ApolloVM(nullSafetyChecks: true), but the only way to turn it on was to construct the VM in Dart. It is now reachable from every entry po
2.22.0 added ApolloVM(nullSafetyChecks: true), but the only way to turn it on was to construct the VM in Dart. It is now reachable from every entry point that actually loads code.
--null-safety on run, translate and compile, added once on the shared CommandSourceFileBase alongside --pub:
$ apollovm run --null-safety foo.dart
** NULL SAFETY: Can't load `foo.dart` (dart): 1 null-safety error(s).
- The operand 'b' can be 'null', so it can't be used in an operation
unconditionally. Use '??', '!' or a null check.
$ echo $?
1
The rejection prints as a report rather than escaping as an unhandled error with a stack trace, and is not restated as a parse failure. main now maps a command result of false to exit status 1 so the flag can gate a build — no existing command path returns false.
Every source tool takes an optional nullSafety argument, and --null-safety on both mcp serve and mcp call sets the default (a per-call value always wins). The two tool kinds behave differently, by design:
execute, translate, wasm — reject the source, returning the findings as diagnostics rather than throwing.parse, ast, symbols, types — never call loadCodeUnit, so "fail the load" would be meaningless. They add the findings to diagnostics and still succeed, which is the useful form for inspection: the problem is visible without executing anything.$ apollovm mcp call parse -f foo.dart -l dart --null-safety
{ "ok": true,
"diagnostics": [ { "severity": "error",
"code": "unchecked-nullable-operand",
"message": "The operand 'b' can be 'null' ..." } ], ... }
The server default is merged into the tool arguments at the single dispatch point shared by the in-process and isolate paths. _IsolateJob carries only the arguments and limits, so a field on the server object would never reach a spawned isolate — and apollovm.execute runs in one by default. It is deliberately not stored in McpLimits, which is documented as resource/security limits.
Adds mcpCoerceBool beside mcpCoerceInt, so a client sending "true" or 1 is handled instead of crashing the tool on a hard cast — the same class of bug 2.16.0 fixed for the integer arguments.
Its Analyzer uses its VM only for getParser and never loads a code unit, and it already surfaces null-safety findings as diagnostics. An editor must report, not refuse to open a file.
2533 passing (from 2510), plus Chrome wasm-gc and wasm-chrome. New CLI coverage spawns the real script (bin/ cannot be imported); new MCP coverage checks both tool kinds, the server-default merge, the per-call override, mcpCoerceBool across its input forms, and the argument surviving the isolate boundary.
nullSafetyChecks is reachable from the CLI and MCP2.22.0 added ApolloVM(nullSafetyChecks: true), but the only way to turn it on
was to construct the VM in Dart. It is now exposed at every entry point that
actually loads code.
CLI — --null-safety on run, translate and compile (added once on the
shared CommandSourceFileBase, like --pub):
$ apollovm run --null-safety foo.dart
** NULL SAFETY: Can't load `foo.dart` (dart): 1 null-safety error(s).
- The operand 'b' can be 'null', so it can't be used in an operation
unconditionally. Use '??', '!' or a null check.
$ echo $?
1
The rejection is printed as a report rather than escaping as an unhandled error
with a stack trace, and it is not restated as a parse failure. main now maps a
command result of false to exit status 1, so a check can gate a build; no
existing command path returns false.
MCP — every source tool takes an optional nullSafety argument, and
--null-safety on both apollovm mcp serve and apollovm mcp call sets the
default (a per-call value always wins). The two tool kinds behave differently,
by design:
apollovm.execute, apollovm.translate,
apollovm.wasm — reject the source, returning the findings as diagnostics
rather than throwing;apollovm.parse, apollovm.ast,
apollovm.symbols, apollovm.types — never load anything, so a "fail the
load" flag would be meaningless. They add the findings to diagnostics and
still succeed, which is the useful form for inspection.The server default is merged into the tool arguments at the single dispatch
point shared by the in-process and isolate paths. That matters: _IsolateJob
carries only the arguments and limits, so a field on the server object would
never reach a spawned isolate — and apollovm.execute runs in one by default.
It is deliberately not stored in McpLimits, which is documented as resource
and security limits.
Adds mcpCoerceBool beside mcpCoerceInt, so a client sending "true" or 1
is handled rather than crashing the tool on a hard cast — the same class of bug
2.16.0 fixed for the integer arguments.
The LSP was checked and deliberately left alone: its Analyzer uses its VM only
for getParser and never loads a code unit, and it already reports null-safety
findings as diagnostics. An editor must report, not refuse to open a file.
Reported: this should fail before it runs, not partway through.
Reported: this should fail before it runs, not partway through.
class Foo {
static void main(int a, int? b) {
print(a);
print(b);
var c = a + b; // should be a null-safety error at resolution
print(c);
}
}
Investigating it turned up something worse than the request.
NullSafetyAnalyzer.analyze walked root.descendantChildren for ASTInvocableDeclaration. But ASTBlock.children is only [functions, statements], and ASTRoot keeps its classes in a separate map — so the traversal never entered a class body. ASTClass compounds it by keeping constructors and getters outside children as well.
Every method, constructor and getter of every class went unanalyzed, in the LSP/Problems panel too. Only top-level functions were ever checked — which is exactly why the existing analyzer tests, all written against top-level functions, never caught it.
analyze now walks each class and extension explicitly, plus their constructors and getters. No rule changed: the rules were correct, nothing was reaching them.
ApolloVM(nullSafetyChecks: true) makes loadCodeUnit throw the new NullSafetyError when the AST has null-safety errors, before the unit is registered:
[checks OFF] ApolloVMNullPointerException: Can't perform '+' with types: int + Null
printed before throw: "5 | null"
[checks ON ] NullSafetyError: Can't load `t` (dart): 1 null-safety error(s).
- The operand 'b' can be 'null', so it can't be used in an operation
unconditionally. Use '??', '!' or a null check.
printed before throw: ""
NullSafetySeverity.error blocks. Warnings (null!) and info stay diagnostic-only, exactly as in the LSP.BinaryCodeUnit (Wasm) carries no AST and is skipped.findings.loadCodeUnit already throws SyntaxError on a bad parse, so throwing here matches its existing contract. No language gate is needed — only the Dart grammar parses ?, and a test asserts that rather than assuming it.
2510 passing (from 2499), plus Chrome wasm-gc and wasm-chrome.
Class-member coverage coming first mattered: the getter and constructor cases failed on the first attempt, which is how the second-level ASTClass gap surfaced. Load-enforcement coverage includes the default being off, off still failing mid-run with [5, null] already printed, on throwing before anything executes, a warning-only source still loading, and a syntax error still surfacing as SyntaxError.
NullSafetyAnalyzer.analyze walked root.descendantChildren looking for
invocables. But ASTBlock.children is only [functions, statements], and
ASTRoot keeps its classes in a separate map — so the traversal never entered a
class body. ASTClass compounds it by keeping constructors and getters outside
children too.
The effect: every method, constructor and getter of every class went unanalyzed, including in the LSP/Problems panel. Only top-level functions were ever checked, which is also why the existing tests — all written against top-level functions — never caught it.
class Foo {
static void main(int a, int? b) {
var c = a + b; // reported no diagnostic at all
}
}
analyze now walks each class and extension explicitly, plus their constructors
and getters. The reported case produces unchecked-nullable-operand with no rule
changes — the rules were fine, nothing was reaching them.
ApolloVM(nullSafetyChecks: true) makes loadCodeUnit throw the new
NullSafetyError when the AST has null-safety errors, before the unit is
registered:
var vm = ApolloVM(nullSafetyChecks: true);
await vm.loadCodeUnit(unit); // throws — nothing printed, nothing executed
Without it, the snippet above prints 5 and null and then throws
ApolloVMNullPointerException from the +, having already produced output.
NullSafetySeverity.error blocks; warnings (e.g. null!) and info stay
diagnostic-only, exactly as in the LSP.BinaryCodeUnit (Wasm) carries no AST and is skipped.NullSafetyError carries the offending findings.No language gate is needed — only the Dart grammar parses ?, so every other
language's types are non-nullable and produce no findings. There is a test
asserting that rather than assuming it.
The README's feature tables covered control flow, operators and OOP — but nothing of the null-safety work from 2.16.0 through 2.20.0. Five releases of
The README's feature tables covered control flow, operators and OOP — but nothing of the null-safety work from 2.16.0 through 2.20.0. Five releases of behaviour were documented only in the changelog.
A per-language table for nullable types (T?), ?? / ??=, ?. / ?[, !, cascades, == null, and the static analyzer.
Every cell was verified by generating the construct into each target and reading the output, not written from memory. That mattered — it caught two targets emitting source that is not valid in their language.
The table introduces a ⚠️ lossy marker, distinguishing three previously-conflated situations:
?:, TS ?., C# ??).??, Lua's IIFE with an explicit nil test, Go's (*a) for !).a?.x → a.x, a! → a). Correct-looking output with different runtime behaviour, which the single 🧩 marker used to hide.?? / ??= are never lossy: every target either has the operator or gets a faithful desugaring.
xs?[0]. Kotlin has no ?[ operator — it is the call xs?.get(0). The shared nullAwareIndexOpen hook gained a matching nullAwareIndexClose, so a target can close with ) instead of ].null. Lua's is nil, so the generated source referenced an undefined global and a == null was always false rather than a nil test.a.b.c, a.b?.c, chained writes, parenthesized receivers, (expr).m().field).null / None / nil row was ✅ for Wasm, which overstated it — Wasm has no null value of its own and represents it as a boxed pointer. Now 🧩, pointing at the limits.null domain and the concrete-slot error.2492 passing (from 2463). Beyond regressions for both fixes, a new unit test calls both null hooks directly on all nine generators. generateASTValueNull — the resolved-value hook — turned out to be uncovered in every generator including the base, so a wrong spelling there would have gone unnoticed: exactly the class of bug Lua had.
Writing the README's null-safety matrix meant generating every construct into every target and reading the result. Two cells were emitting source that is not valid in the target language:
xs?[0]. Kotlin has no ?[ operator — its
null-aware element access is the call xs?.get(0). The shared
nullAwareIndexOpen hook gained a matching nullAwareIndexClose, so a target
can close with ) instead of ].null. Lua's is nil, so the generated code
referenced an undefined global: a == null was always false rather than a nil
test. Both null-rendering hooks are now overridden for Lua.The feature tables covered control flow, operators and OOP, but nothing of the
null-safety work from 2.16.0 onwards. A new Null safety section carries a
per-language table for nullable types, ?? / ??=, ?. / ?[, !, cascades,
== null and the static analyzer — each cell verified by generating the
construct and reading the output, not from memory.
It adds a ⚠️ lossy marker for targets that emit a form which compiles but
drops the null check (a?.x → a.x), distinguishing those from a faithful
idiom (🧩) such as Java's ternary for ?? or Go's pointer dereference for !.
A Member-access chains section covers the 2.17.0 chain support, the null
row in the operators table now points at the Wasm limits, and the Wasm status
paragraph mentions the boxed-null domain.
Closes the last open item from the null-safety series. Go had no representation for nullability: a nullable local was emitted as var s string = nil —
Closes the last open item from the null-safety series. Go had no representation for nullability: a nullable local was emitted as var s string = nil — source that does not compile — and ?? was reported as unsupported because a Go value type cannot be compared to nil. 2.19.0 turned the broken output into an explicit error; this implements the representation.
T? → *TA pointer is the one Go form that can hold nil.
| Dart | Go |
|---|---|
int? a (param) |
a *int |
String? name (field) |
name *string |
int? x = null |
var x *int = nil |
int? x = 5 |
var x *int = goPtr(5) |
read x |
(*x) |
x == null |
x == nil (no deref) |
a ?? b |
func() int { if a != nil { return *a }; return b }() |
List<int>? |
[]int (already nilable — left alone) |
return x needed its own handling, since it takes a separate generation path that bypasses the read hook.goPtr is a generated helper, because Go cannot write &5. It is emitted only in modules that use it.List<int>? stays []int.var s string = nil shipped because the generator's output was only ever asserted against text. Every shape above is now checked by writing the generated source into a module and running go build with a real toolchain — which is how the two bugs above were found, both producing plausible-looking Go that did not type-check.
?. — the shared fallback degrades it to ., which was merely lossy when a nullable was a plain T. Against a *T it would skip the nil check and yield a value where a pointer is expected. Lowering it needs the accessed member's type at generation time.??= — lowering to t = t ?? v needs the target's element type to build the inline function's return type. Plain ?? is unaffected.2463 passing (from 2460), plus Chrome wasm-gc and wasm-chrome.
T? is generated as a pointer *TGo had no representation for nullability at all. A nullable local was emitted as
var s string = nil — source that does not compile — and ?? was reported as
unsupported because a plain Go value type cannot be compared to nil. 2.19.0
turned the broken output into an explicit error; this release implements the
representation.
A nullable T? now becomes a Go pointer *T, which is the one Go form that can
hold nil:
int? a is a *int,
a String? name field is name *string.(*a)), including a bare return x, which takes its own
generation path.x == null is x == nil, not a deref.func goPtr[T any](v T) *T helper, since Go cannot write &5. The helper is
emitted only in modules that need it.a ?? b lowers to an inline function that nil-checks the pointer:
func() int { if a != nil { return *a }; return b }(). Go has no conditional
expression, so this is the only correct form.List<int>? stays []int,
not *[]int, and likewise for maps and interfaces.Every shape above is verified by compiling the generated source with a real Go
toolchain (go build), not by asserting on text — which is what let
var s string = nil ship in the first place.
Two constructs remain unsupported in Go, and both now report rather than emit something wrong:
?. — the shared fallback degrades it to ., which was merely lossy when
a nullable was a plain T. Against a *T it would skip the nil check and
yield a value where a pointer is expected. Lowering it needs the accessed
member's type at generation time, which the generator does not resolve yet.??= — lowering it to t = t ?? v needs the target's element type to
build the inline function's return type, and the text-level assignment hook
does not have it. Plain ?? is unaffected.Four gaps fixed. The first is the serious one.
Four gaps fixed. The first is the serious one.
x == null no longer throwsThe most common null check in Dart threw for any typed left operand:
int? a = 1; if (a == null) { … } // _TypeError: 'Null' is not a subtype of 'FutureOr<int>'
String s = 'x'; if (s == null) { … } // 'Null' is not a subtype of 'FutureOr<String>'
No ternary, nullable slot or ?. needed. Only the reversed null == x worked.
ASTValue.equals read the other operand through _getValue, which casts it to this value's T — right for arithmetic, where a mismatched operand is a real error, but wrong for equality, where a different type must compare false. Equality now reads both operands uncast, so x == null is false and 1 == 'x' is false, and neither throws. The three equals overrides (ASTValueStatic, ASTValuePrimitive, ASTValueNum) carried the same cast and were fixed with it.
This predates the null-safety work — it is in the base ASTValue — but 2.16.0 made x == null the idiom people reach for, so it went from obscure to prominent.
== null / != null against the null boxWith null representable since 2.18.0, the equality paths had to learn about it. A comparison against a null literal is now recognised before the String and numeric paths:
a[0] == null on a List<Object> answers correctly. It previously took the __streq route and compared contents against address 0, reporting a non-null String as null.int, double, String, an instance) can never be the null box, so the result is constant — and a valid module. String s; s == null previously pushed two i32 handles into an i64.eq and produced a module that failed to validate.(expr).m().fieldA group invocation followed by member access did not parse — the group-invocation rule chains only further invocations, so a trailing .field had nothing to match it. A new rule reuses that rule for the head and folds the trailing segments. It requires at least one trailing segment, so (expr).m() keeps its own rule and parenthesized arithmetic is untouched.
var s string = nilThe Go generator emitted var s string = nil for a nullable local — source that does not compile. It now reports an UnsupportedSyntaxError naming the type, consistent with how ?? is already handled. A List/Map still accepts nil, since those become a Go slice/map, which are nilable.
Go's nullable representation remains open: supporting T? properly means generating *T throughout — declarations, zero values, every dereference, and parameter/return types.
+10 tests, 2460 passing (from 2450), plus Chrome wasm-gc and wasm-chrome. The equality bug survived because the suite compiled == null in flow-promotion cases but never ran one against a typed operand; the new tests do.
x == null no longer throwsx == null — the most common null check in Dart — threw for any typed left
operand:
int? a = 1; if (a == null) { … }
// _TypeError: type 'Null' is not a subtype of type 'FutureOr<int>' in type cast
No ternary, nullable slot or ?. was needed; String s = 'x'; s == null failed
the same way. Only the reversed null == x worked, because ASTValueNull.equals
type-tests instead of casting.
ASTValue.equals read the other operand through _getValue, which casts it to
this value's T. That is right for arithmetic — a mismatched operand there is
a real error — but wrong for equality, where a different type must compare
false. Equality now reads both operands uncast, so x == null is false,
x == 'other type' is false, and neither throws. The three equals overrides
(ASTValueStatic, ASTValuePrimitive, ASTValueNum) had the same cast and were
fixed with it.
This predates the null-safety work — it is in the base ASTValue — but 2.16.0
made x == null the idiom people reach for, so it went from obscure to
prominent.
== null / != null against the null boxWith null representable since 2.18.0, the equality paths had to learn about it.
A comparison against a null literal is now recognised before the String and
numeric paths:
a[0] == null on a List<Object> answers correctly (it previously took the
__streq route and compared contents against address 0, reporting a non-null
String as null);int, double, String, an instance) can never be
the null box, so the result is a constant — and, importantly, a valid module.
String s; s == null previously pushed two i32 handles into an i64.eq and
produced a module that failed to validate.(expr).m().fieldA group invocation followed by member access did not parse — the
group-invocation rule chains only further invocations, so a trailing .field had
nothing to match it. A new rule reuses that rule for the head and folds the
trailing segments. It requires at least one trailing segment, so (expr).m()
keeps its own rule and parenthesized arithmetic is untouched (reordering the
rules instead changes how the operation chain groups and breaks round-trip
generation).
var s string = nilThe Go generator emitted var s string = nil for a nullable local — source that
does not compile. It now reports an UnsupportedSyntaxError naming the type,
consistent with how ?? is already handled. A List/Map still accepts nil,
since those become a Go slice/map, which are nilable.
Go's nullable representation remains the open item: supporting T? properly
means generating *T throughout — declarations, zero values, every dereference,
and parameter/return types.
Compiling a null literal to Wasm threw a bare UnimplementedError: generateASTExpressionNullValue — a leftover TODO — so an ordinary Dart idiom could n
Compiling a null literal to Wasm threw a bare UnimplementedError: generateASTExpressionNullValue — a leftover TODO — so an ordinary Dart idiom could not be compiled at all:
var a = args.length > 0 ? args[0] : null;
null as a boxed valuenull is now a real value in the backend's boxed domain: the boxed-Object pointer 0. The heap never allocates at address 0, so it needs no cell, costs no allocation, and is distinguishable from every real box.
null forces that type to a boxed Object — otherwise c ? 1 : null mixed an i64 with an i32 and produced a module that failed to validate.?? tests a boxed operand. It previously always yielded its left operand ("a Wasm value is never null"), which remains correct in the numeric domain. A boxed operand is now compared against the null box, so a ?? 99 falls back when a is null.null, checking the null box before dereferencing a tag.__alloc look-ahead. Boxing allocates, but the alloc export is decided before the Code section while the boxing is only discovered while writing it — so [1, null, 3] and a ?? 99 aborted at run time with No exported Wasm function __alloc. The generator now scans function bodies for a null literal up front.Object? return decodes to null instead of the raw pointer 0. Two causes: the return path had no Object case, and _typeTag's fallback gave tag 5 to both Object and a class instance, so the runner could not tell a box from a bare instance pointer. A class instance now carries tag 8, leaving 5 unambiguously "boxed value".Where null genuinely has no representation — a slot whose Wasm type is concrete, such as int (i64) or String (a string pointer) — the compiler now reports an UnsupportedSyntaxError naming the type and suggesting var / Object? / dynamic, rather than emitting a module that fails to validate.
The analyzer checked unconditional member/method/index access on a nullable, and the null literal assigned to a non-nullable slot. Two adjacent mistakes went unreported:
void run(int? a, int b) {
int? x = a;
int? y = b;
var base = x + (y ?? 0); // x can be null — now reported
}
void run(int? a) {
int x = a; // int? into int — now reported
}
unchecked-nullable-operand — a nullable operand in an operation. ??, == and != are exempt (a nullable operand is exactly what they exist to handle), and ! or a preceding null check still suppress it.nullable-to-non-nullable — a nullable value assigned to a non-nullable slot: the existing literal-null error, one step removed.+15 tests, 2450 passing (from 2435), plus Chrome wasm-gc and wasm-chrome. Coverage targets the shapes that were failing: null in a var/Object? slot, ternary arm boxing, Object? return decoding, == null, ?? fallback, both clean-error cases, and the two analyzer rules with their suppression and negative cases.
null in the boxed-Object domainCompiling a null literal to Wasm threw a bare
UnimplementedError: generateASTExpressionNullValue — a leftover TODO — so an
ordinary Dart idiom such as var a = args.length > 0 ? args[0] : null; could
not be compiled at all.
null is now a real value in the backend's boxed domain: the boxed-Object
pointer 0. The heap never allocates at address 0, so it needs no cell, costs no
allocation, and is distinguishable from every real box.
null forces that type to a boxed
Object — otherwise c ? 1 : null mixed an i64 with an i32 and produced a
module that failed to validate.?? tests a boxed operand. It previously always yielded its left operand
("a Wasm value is never null"), which remains correct in the numeric domain.
A boxed operand is now compared against the null box, so a ?? 99 falls back
when a is null.null. The box-to-string helper checks the
null box before dereferencing a tag.__alloc look-ahead. Boxing allocates, but the alloc export is decided
before the Code section while the boxing is only discovered while writing
it — so [1, null, 3] and a ?? 99 aborted at run time with
No exported Wasm function __alloc. The generator now scans function bodies
for a null literal up front.Object? return decodes to null instead of the raw pointer 0. Two
causes: the return path had no Object case, and _typeTag's fallback gave
tag 5 to both Object and a class instance, so the runner could not tell
a box from a bare instance pointer. A class instance now carries tag 8,
leaving 5 unambiguously "boxed value".Where null genuinely has no representation — a slot whose Wasm type is
concrete, such as int (i64) or String (a string pointer) — the compiler now
reports an UnsupportedSyntaxError naming the type and suggesting var /
Object? / dynamic, rather than emitting a module that fails to validate.
The analyzer checked unconditional member/method/index access on a nullable,
and the null literal assigned to a non-nullable slot. Two adjacent mistakes
went unreported:
x + (y ?? 0) where x is int?)
now reports unchecked-nullable-operand. ??, == and != are exempt — a
nullable operand is exactly what they exist to handle — and ! or a preceding
null check still suppress it.int x = a; where a
is int?) now reports nullable-to-non-nullable. Previously only a literal
null was caught, so the same error one step removed passed silently.Four gaps found by exercising the 2.16.0 null-safety surface end-to-end, plus one pre-existing parser limitation found alongside them.
Four gaps found by exercising the 2.16.0 null-safety surface end-to-end, plus one pre-existing parser limitation found alongside them.
T? parameter now accepts a T argumentCalling a method with a String? parameter and a non-null String failed with parameters signature not compatible, though passing null worked. Passing an argument is an assignment, so ASTFunctionParameters.parameterAcceptsType now uses ASTType.acceptsAssignment instead of acceptsType.
ASTTypeString compares nullable in its ==, so String? != String and acceptsType rejected the argument; int?/double? only appeared to work because StrictType ignores nullable. A non-nullable parameter still rejects null.
Storing a short-circuited result in a local failed — var v = s?.length on a null receiver threw Class not set for type: Null, and var v = xs?[0] threw Can't cast initial (null) value to type: int. ?. (getter and method) and ?[ now resolve to T?, and resolving the type of an access whose receiver is null reports Null instead of looking for a class. Using the result in a return, inline with ??, or in a string interpolation already worked and is unchanged.
a.b.c, a.b?.c, a.b!.c, a.b.m(), a.b?.m(x) and chained writes (a.b.c = v) previously failed: the grammar accepted only a single identifier receiver, so a.next?.value reported SyntaxError: digit expected (the ? read as the start of a number) and even plain a.next.value reported "(" expected.
A new chain rule folds each segment onto the previous one, wrapping it in the new ASTExpressionVariable (an ASTVariable backed by an expression), so the existing object-access nodes supply the runtime, null-aware and code-generation behaviour. Chains work at any depth, in any mix of ., ?. and !.
The rule requires two or more segments, so single-segment access keeps its own rules and enum entries, static fields and import prefixes resolve exactly as before.
A field read off a parenthesized receiver ((a).v, (a)?.v) also parses now — previously only (expr).method() did. (expr).m().field remains unsupported.
?? and ??= no longer leak into targets that cannot compile themJava, Lua, Python and Go emitted a ?? b verbatim, and ??= leaked into every target — including Kotlin, which had a correct ?: for ?? but no hook for the assignment form.
?? now goes through an overridable renderNullCoalesce, and ??= is lowered to t = t ?? v wherever supportsNullCoalesceAssignment is false, so each target defines only one desugaring:
| Target | a ?? b |
|---|---|
| Java | (a != null ? a : b) |
| Python | (a if a is not None else b) — is not None, so 0/''/False survive |
| Lua | IIFE with an explicit nil test |
| Kotlin | ?: (and t = t ?: v for ??=) |
| Dart, C#, JS, TS | unchanged — both operators are native |
| Go | UnsupportedSyntaxError |
Lua needs the IIFE because both a or b and the a ~= nil and a or b idiom return b for a non-nil false. It also binds a to a local, so it is evaluated once rather than twice like the ternary targets.
Go is deliberately unsupported: it has neither a null-coalescing operator nor a conditional expression, and this generator maps a nullable T? onto a plain Go T, which for a value type cannot be compared to nil — any rendering would be code that does not compile. Representing T? as *T throughout the Go generator is separate work.
Also adds an overridable resolveASTAssignmentOperatorText, which lets the Python generator drop its whole generateASTExpressionVariableAssignment override.
The null-safety suite previously exercised ?. only in return position on user classes — precisely the shape that already worked, which is why these slipped through. New coverage targets the failing shapes directly, and the generation suite gains per-target desugaring assertions plus a guard that no target leaks a literal ??/??=.
2435 VM tests pass (up from 2410), plus WasmGC and wasm-chrome in Chrome.
Four gaps found by exercising the 2.16.0 null-safety surface end-to-end.
T? parameter now accepts a T argument. Calling a method with a
String? parameter and a non-null String failed with parameters signature not compatible, though passing null worked. Argument passing is an
assignment, so ASTFunctionParameters.parameterAcceptsType now uses
ASTType.acceptsAssignment instead of acceptsType. (int?/double? only
appeared to work because StrictType ignores nullable in ==, while
ASTTypeString compares it — so String? and String were unequal and
ASTTypeString.acceptsType rejected the argument.) A non-nullable parameter
still rejects null.var v = s?.length on a null
receiver threw Class not set for type: Null, and var v = xs?[0] threw
Can't cast initial (null) value to type: int. ?. (getter and method) and
?[ now resolve to T?, and resolving the type of an access whose receiver
is null reports Null instead of trying to find a class for it. Using the
result in a return, inline with ??, or in a string interpolation already
worked and is unchanged.a.b.c, a.b?.c, a.b!.c, a.b.m(),
a.b?.m(x) and chained writes (a.b.c = v) previously failed — the grammar
accepted only a single identifier receiver, so a.next?.value reported
SyntaxError: digit expected (the ? was read as the start of a number)
and even plain a.next.value reported "(" expected. A new chain rule
folds each segment onto the previous one, wrapping it in the new
ASTExpressionVariable (an ASTVariable backed by an expression) so the
existing object-access nodes supply the runtime, null-aware and
code-generation behaviour. Chains of any depth work, in any mix of ., ?.
and !. Single-segment access keeps its own rules — the chain rule requires
two or more segments — so enum entries, static fields and import prefixes
resolve exactly as before. A field read off a parenthesized receiver
((a).v, (a)?.v) also parses now; only (expr).m().field remains
unsupported.?? and ??= no longer leak into targets that cannot compile them.
Java, Lua, Python and Go emitted a ?? b verbatim, and ??= leaked into
every target — including Kotlin, which had a correct ?: for ?? but no
hook for the assignment form. ?? now goes through an overridable
renderNullCoalesce, and ??= is lowered to t = t ?? v wherever
supportsNullCoalesceAssignment is false, so each target defines only one
desugaring:
(a != null ? a : b)(a if a is not None else b) — an is not None test, so 0/''/
False are preservednil test, because
both a or b and the a ~= nil and a or b idiom return b for a non-nil
false; it also binds a to a local, so it is evaluated once?: for ??, and t = t ?: v for ??=UnsupportedSyntaxError. Go has neither a null-coalescing
operator nor a conditional expression, and this generator maps a nullable
T? onto a plain Go T, which for a value type cannot be compared to
nil — any rendering would be code that does not compile. Representing
T? as *T throughout the Go generator is separate work.Also adds an overridable resolveASTAssignmentOperatorText, which lets the
Python generator drop its whole generateASTExpressionVariableAssignment
override (it existed only to spell integer division //=).
Full Dart null-safety support across parse, type-check, runtime, and transpilation, plus a static null-safety analysis pass and Wasm lowering.
Full Dart null-safety support across parse, type-check, runtime, and transpilation, plus a static null-safety analysis pass and Wasm lowering.
T? on simple, generic, collection and function types (String?, List<String?>, Map<String, User?>, Future<User?>, void Function()?, String? Function(int)).ASTType.nullable via asNullable() / withoutNullability(); nullability-aware acceptsAssignment (T? accepts T and Null; T rejects Null).??, ??=, ?. (getter + method), ?[, postfix ! (standalone and before access: x!.f, x!.m(), x![i]), and .. / ?.. cascades — parsed, evaluated with correct short-circuit semantics, and Dart round-tripped. ?? is the loosest binary operator in the precedence reducer.
NullSafetyAnalyzer — flow-aware: flags null→non-nullable assignment and unchecked nullable access, with if (x != null) promotion and ?./! suppression. Surfaced through the LSP analyzer.
?: (Elvis), !!, ?., nullable T?.??, ?., ?.[, !.??. Java / Go / Python / Lua: best-effort.Lowers null-safety within its non-null numeric domain (x!→x, a ?? b→left operand, ?./?[→plain access, T?→numeric type); a null literal remains an explicit unsupported-construct error.
Full test suite green (feature, analyzer, unit, cross-language generation, Wasm codegen, and two declarative .test.xml defs).
T?). The Dart grammar now parses the ? suffix on
simple, generic, collection and function types (String?, List<String?>,
Map<String, User?>, Future<User?>, void Function()?,
String? Function(int)). ASTType carries an isNullable/nullable flag
(via asNullable() / withoutNullability()), and the Dart/Kotlin generators
round-trip the ? suffix (TypeScript renders nullable types without the
suffix — T? on a member isn't valid TS — and other targets drop it,
best-effort).?? (null-coalescing), ??= (null-coalescing assignment), ?.
(null-aware getter and method invocation), ?[ (null-aware indexing), postfix
! (null assertion — standalone x! and before access: x!.f, x!.m(),
x![i] — throwing ApolloVMNullPointerException on null), and cascades
.. / ?.. (null-aware). ?? is wired into the operator-precedence
reducer as the loosest binary operator (relational/equality/logical tiers were
made explicit at the same time).ASTType.acceptsAssignment (used by the
runtime declaration/instance-of checks) accepts null only for nullable slots
and lets a T? slot accept a T value.NullSafetyAnalyzer) reports assigning null to a non-nullable
declaration/parameter and unconditional member/method/index access on a
nullable local, with flow promotion for if (x != null) { … } /
if (x == null) … else { … } and suppression via ?./!. Its diagnostics are
surfaced through the LSP analyzer for Dart documents.?: for ??
and !! for !; TypeScript emits ??, ?., ?.[ (element access) and !.
Java, JavaScript, C#, Go, Python and Lua are best-effort (C#/JS keep native
??; the rest render the closest form without failing).x! compiles to x, a ?? b to its left operand,
?./?[ to plain access, and a nullable T? to the underlying numeric type.
A null literal stays an explicit unsupported-construct error (Wasm has no
null value) rather than a silent miscompilation.textDocument/references now honors context.includeDeclaration. The
flag was plumbed through every layer but discarded, so the declaration
occurrence was always returned. When includeDeclaration is false, the
occurrence that coincides with the symbol's declaration is now excluded.documentSymbol range covers the whole declaration. A
field/variable range previously stopped at the name; it now extends to the
terminating ; (skipping over any (/[/{ } in an initializer), matching
how methods and enum members already cover their full entry.double (e.g. 1000.0) or as strings, so
timeoutMs/maxDepth/args/className were coerced via new
mcpCoerceInt/_strOrNull/_listOrEmpty helpers rather than an unsafe
as int?/as List? that threw a raw TypeError and crashed the tool. Applies
to apollovm.execute/apollovm.ast and both isolate executors.HttpSseTransport now
responds to OPTIONS with Access-Control-Allow-Origin/Methods/Headers
(204) instead of a 404, unblocking cross-origin browser POSTs.&^ (AND NOT / bit clear) now computes a & (~b). It was mapped to a
plain bitwise-AND (a & b), silently producing wrong results and corrupting
Go→Go round-trips. It is now desugared at parse time to a bitwise-AND whose
right operand is the bitwise complement of the right-hand side, at the same
precedence as &.... A + whose operands are
statically String-typed (e.g. s1 + s2, with no string literal to trip
the old heuristic) now generates Lua .. instead of an invalid +.list[0]) now generates list[1]
(list[i] → list[(i) + 1]). Map/table key access is left unchanged. The Lua
grammar does not parse index-access expressions, so no Lua→Lua round-trip is
double-shifted... (e.g. "${a < b}") is now wrapped in
parentheses ("x" .. (a < b)) so it no longer mis-associates under Lua's
concatenation precedence.Correctness fixes across the LSP, MCP, Go and Lua subsystems.
Correctness fixes across the LSP, MCP, Go and Lua subsystems.
textDocument/references now honors context.includeDeclaration. The flag was plumbed through every layer but discarded; when false, the declaration occurrence is now excluded.documentSymbol range covers the whole declaration (extends to the terminating ; instead of stopping at the name).timeoutMs/maxDepth/args/className go through mcpCoerceInt/_strOrNull/_listOrEmpty, so a JSON double (1000.0) or wrong-typed value no longer throws a raw TypeError.OPTIONS → 204 with Allow-Origin/Methods/Headers) instead of a 404.&^ (AND NOT / bit clear) now computes a & (~b) instead of a plain a & b (desugared at parse time, same precedence as &)... for statically String-typed operands (s1 + s2), not an invalid +.list[0] → list[1], list[i] → list[(i) + 1]); map key access unchanged."${a < b}" → "x" .. (a < b)) to fix mis-association under .. precedence.Full diff: https://github.com/ApolloVM/apollovm_dart/compare/v2.14.0...v2.15.0
String == String and String != String now compile to content equality via the __streq synth helper (the same byte comparison already used for switch c
String == / String != content equalityString == String and String != String now compile to content equality via the __streq synth helper (the same byte comparison already used for switch cases and Map<String, …> key lookups), instead of letting the two String handles flow into a numeric comparison — which tested pointer identity and, once the handles reached an i64.eq, produced invalid Wasm.
The result is a proper bool, so it can be returned directly, used as an if / && / || condition, or otherwise combined logically. != inverts the helper's result with i32.eqz.
Adds a dual-harness test (AST interpreter + compiled Wasm parity) covering literal/variable operands, the empty string, if-conditions and logical AND.
String == / String != content equalityThe on-the-fly WebAssembly compiler now compiles String == String and
String != String to content equality via the __streq synth helper (the same
byte-comparison already used for switch cases and Map<String, …> key
lookups), instead of leaving the two String handles to flow into a numeric
comparison — which tested pointer identity and, when the handles reached an
i64.eq, produced invalid Wasm. The result is a proper bool, so it can be
returned directly, used as an if/&&/|| condition, or otherwise combined
logically. != inverts the helper's result with i32.eqz. Covers
literal/variable operands and the empty string.
The on-the-fly WebAssembly compiler now supports a generic class with a type-parameter field (class Box { T value; ... }). The field is stored boxed (
Box<T>) + aggregate-return coverageThe on-the-fly WebAssembly compiler now supports a generic class with a type-parameter field (class Box<T> { T value; ... }). The field is stored boxed (the constructor boxes the argument), and reading it back at the instantiation type unboxes to the concrete representation. Two fixes closed this: the return-expression path now threads its context into the value-conversion helper (it previously hit a module-less path and threw), and that helper gained an Object → String / bool / instance unbox case alongside the existing numeric one. Covers Box<int|double|String|bool>, generic fields in arithmetic, and multi-parameter classes such as Pair<int, String>.
Also adds regression tests confirming that returning a List/Map across the module boundary works (List<int|double|String> via literal, arrow, or built-with-.add, and Map<String,int>).
With this, every lettered gap in WASM_BACKEND_PLAN.md (A–G) is closed.
Adds String[i] — Dart's index operator, which returns the character at i as a length-1 String — to the AST interpreter core (which was missing it) and
s[i] (interpreter + Wasm)Adds String[i] — Dart's index operator, which returns the character at i as a length-1 String — to the AST interpreter core (which was missing it) and to the on-the-fly WebAssembly compiler. Both backends now agree.
This restores functionality briefly dropped in 2.11.0, where s[i] had been mistaken for invalid Dart; it is valid, so it is now supported end to end.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.12.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports String.split(sep), returning a List . Compiled as two passes over the [len][utf8] layout: the first c
splitThe on-the-fly WebAssembly compiler now supports String.split(sep), returning a List<String>. Compiled as two passes over the [len][utf8] layout: the first counts the separators to size the list, the second allocates each piece as a fresh String and stores its pointer in the list buffer. Handles multi-char separators and leading/trailing empty pieces; an empty sep yields a single whole-string piece.
With this, the String method surface in Wasm is broadly complete (case, length, slice/search, trim/pad, replace, compareTo, split).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.11.0/CHANGELOG.md
splitThe on-the-fly WebAssembly compiler now supports String.split(sep), returning a
List<String>. It is compiled as two passes over the [len][utf8] layout: the
first counts the separators to size the list (pieces = count + 1), the second
allocates each piece as a fresh String and stores its pointer in the list buffer.
Handles multi-char separators and leading/trailing empty pieces; an empty sep
yields a single whole-string piece (Dart's char-split for '' is a follow-up).
With this, the String method surface in Wasm is broadly complete (case, length,
slice/search, trim/pad, replace, compareTo, split). The main remaining Wasm
backend gaps are value-representation ones: generic-typed fields and returning a
List/Map across the module boundary.
Adds String.compareTo(other) to the AST interpreter core (which was missing it) and to the on-the-fly WebAssembly compiler, so it now works on both ba
compareTo (interpreter + Wasm)Adds String.compareTo(other) to the AST interpreter core (which was missing it) and to the on-the-fly WebAssembly compiler, so it now works on both backends with matching results.
The Wasm implementation is a lexicographic byte comparison over the [len][utf8] layout, returning -1 / 0 / 1 (a shorter string that is a prefix of the other sorts first).
This closes the item deferred from 2.8.0, where the Wasm compareTo was dropped because the interpreter couldn't run it.
Still to come for String in Wasm: split (returns a List) and index [].
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.10.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports replaceAll(from, to) and replaceFirst(from, to) over its [len][utf8] layout.
replaceAll / replaceFirstThe on-the-fly WebAssembly compiler now supports replaceAll(from, to) and replaceFirst(from, to) over its [len][utf8] layout.
Each is compiled as two passes: the first counts non-overlapping matches to size the output buffer, the second builds it (copying to for a match, else one byte). Handles a replacement that grows, shrinks, or removes the match, and matches at either end; an empty from returns a copy (avoiding a non-terminating scan).
These join the String methods added in 2.7.0/2.8.0 (substring, codeUnitAt, startsWith/endsWith, indexOf, contains, trim family, padLeft/padRight).
Still to come for String: split (returns a List), index [], and compareTo (which also needs String.compareTo in the interpreter core first).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.9.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports the String trim/pad methods over its [len][utf8] layout:
The on-the-fly WebAssembly compiler now supports the String trim/pad methods over its [len][utf8] layout:
trim() / trimLeft() / trimRight() — strip ASCII whitespace (space, \t..\r)padLeft(width, [pad]) / padRight(width, [pad]) — single-byte pad (default space); a width not exceeding the length is a plain copyThese join the slice/search methods (substring, codeUnitAt, startsWith/endsWith, indexOf, contains) from 2.7.0. Byte-indexed, so exact for ASCII text.
Still to come: split, replaceAll / replaceFirst, index [], and compareTo (which also needs String.compareTo in the interpreter core first).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.8.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports the String trim and pad methods
over its [len][utf8] layout: trim() / trimLeft() / trimRight() (ASCII
whitespace stripping) and padLeft(width, [pad]) / padRight(width, [pad])
(single-byte pad, default space). These join the slice/search methods added in
2.7.0. Byte-indexed, so exact for ASCII text.
Still to come: split, replaceAll / replaceFirst, index [], and
compareTo (which also needs String.compareTo in the interpreter core first).
The on-the-fly WebAssembly compiler now supports the common String slice/search methods over its [len][utf8] layout:
The on-the-fly WebAssembly compiler now supports the common String slice/search methods over its [len][utf8] layout:
substring(start, [end]) — a fresh-buffer memory.copy slicecodeUnitAt(i)startsWith / endsWith — OOB-guarded byte compareindexOf (returns -1 when absent) / containsThese join the already-supported length / isEmpty / isNotEmpty getters and toUpperCase / toLowerCase. Methods are byte-indexed, so results are exact for ASCII text.
Still to come: trim, split, replaceAll / replaceFirst, padLeft / padRight, compareTo, index []; and chaining a method onto a method result (the receiver must be a named local).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.7.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports the common String slice/search
methods over its [len][utf8] layout: substring(start, [end]) (a fresh-buffer
memory.copy slice), codeUnitAt(i), startsWith / endsWith, indexOf, and
contains (byte scans, guarded against out-of-bounds reads). These join the
already-supported length / isEmpty / isNotEmpty getters and
toUpperCase / toLowerCase. Methods are byte-indexed, so results are exact for
ASCII text.
Still to come: trim, split, replaceAll / replaceFirst, padLeft /
padRight, compareTo, and index []; chaining a method onto a method result
(the receiver must be a named local).
The on-the-fly WebAssembly compiler now supports collections nested inside collections and chained subscript access.
m[0][1])The on-the-fly WebAssembly compiler now supports collections nested inside collections and chained subscript access.
List/Map literal can hold List/Map elements ([[1, 2], [3, 4]], {'a': {'b': 5}}).m[0][1], m['a']['b'], m[0]['x'], m['k'][1]), including compound assignment (m[0][1] += 5) and multi-level nesting.Writing into an innermost Map (list[0]['k'] = v) — reads of that shape already work — and a subscript/method on a non-variable receiver (getList()[0], m[1].length) remain follow-ups.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.6.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports user-declared instance getters (int get x { ... }).
The on-the-fly WebAssembly compiler now supports user-declared instance getters (int get x { ... }).
c.x) lowers to a 0-arg method call — reusing the whole instance-method path (argument marshalling, return conversion) and the extends-chain resolution.int/double/bool/String getters, a computed-expression getter body, and a getter used inside an expression (read once or twice).Bare getter access inside a method body (x resolving to this.x, no receiver) and setters remain follow-ups — bare access is not resolved by the interpreter yet either.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.5.0/CHANGELOG.md
The on-the-fly WebAssembly compiler now supports user-declared instance getters
(int get x { ... }). A getter is synthesized as a zero-argument instance method,
so an access via a receiver (c.x) lowers to a 0-arg method call — reusing the
whole instance-method path (argument marshalling, return conversion) and the
superclass-chain resolution, so inherited and overridden getters resolve just like
methods. Covers int/double/bool/String getters, a computed-expression
getter body, and a getter used inside an expression (read once or twice), plus
inherited and overridden getters.
Bare getter access inside a method body (x resolving to this.x, no receiver)
and setters remain follow-ups (bare access is not resolved by the interpreter yet
either).
The on-the-fly WebAssembly compiler now supports single inheritance, matching the AST interpreter.
extends / super)The on-the-fly WebAssembly compiler now supports single inheritance, matching the AST interpreter.
extends chain: an override on the subclass wins, otherwise the inherited superclass method.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
The on-the-fly WebAssembly compiler now supports static class fields (bringing it toward parity with the interpreter, which gained them in 2.1.1).
static class fieldsThe on-the-fly WebAssembly compiler now supports static class fields (bringing it toward parity with the interpreter, which gained them in 2.1.1).
static field becomes a typed, mutable module global (i64 for int, f64 for double, i32 for bool/other), seeded with its literal initializer.static method reads and writes it (global.get/global.set), including compound assignment (c += 1), and values persist across calls.Qualified Class.field from another class, inherited static fields, and non-literal initializers remain follow-ups (WASM_BACKEND_PLAN.md, GAP D).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.3.0/CHANGELOG.md
static class fieldsThe on-the-fly WebAssembly compiler now supports static class fields (bringing
it toward parity with the interpreter, which gained them in 2.1.1). Each static
field becomes a typed, mutable module global seeded with its literal
int/double/bool initializer; a bare reference inside a static method
reads and writes it (including compound assignment like c += 1), and values
persist across calls. Qualified Class.field from another class, inherited
static fields, and non-literal initializers remain follow-ups.
extends was parsed but had no runtime effect. Now:
extends) is now functionalextends was parsed but had no runtime effect. Now:
static fields (Sub.staticField).super: super.method() (overridden parent, resolved relative to the class where the call is written → correct for multi-level), super.getter, and super.field (read/write).extends), C# (: Base) and JavaScript (extends) grammars now record the superclass they were dropping, so inheritance works across those languages (and TypeScript / Python) too. Kotlin's class B : A() base clause is not parsed yet; constructor : super(v) initializer lists are not parsed yet (set inherited fields from the constructor body or this.param).m[0][1])Indexing into a nested collection now works for reads and writes: m[0][1], m['a']['b'], m['a'][0], deeper chains, and compound assignment (m[1][0] += 5). Previously only a single [...] on a bare variable was supported (unchanged). Parsed from Dart source today; the shared interpreter and code generator are language-agnostic.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.2.0/CHANGELOG.md
m[0][1])Indexing into a nested collection now works for both reads and writes:
m[0][1], m['a']['b'], m['a'][0], and deeper chains, including compound
assignment (m[1][0] += 5). Previously only a single [...] on a bare variable
was supported. Single-index access is unchanged.
extends) is now functionalextends was parsed but had no runtime effect — inherited methods and fields
were invisible and super was unresolved. Now:
base() inside a subclass) and receiver calls (obj.base()); a subclass
override still wins over the inherited method.static fields read/write the base
class that declares them (Sub.staticField).super dispatches to the parent: super.method() calls the overridden
parent method (resolved relative to the class where the call is written, so it
is correct for multi-level hierarchies), super.getter reads the parent
getter, and super.field reads/writes the inherited field.extends), C# (: Base) and JavaScript (extends)
grammars now record the superclass they were previously dropping, so
inheritance works across those languages (and TypeScript / Python) too.
(Kotlin's class B : A() base clause is not parsed yet.)Not yet supported: constructor initializer lists with an explicit
super-constructor call (B(v) : super(v)) — inherited fields are still set from
a constructor body or a this.param.
static fields previously had no class-level storage — they were initialized onto every instance, and reading one (ClassName.field, or a bare reference
static class fields are now supportedstatic fields previously had no class-level storage — they were initialized onto every instance, and reading one (ClassName.field, or a bare reference inside a static method) threw at runtime. Now each class has a lazily initialized static-field store, shared by qualified ClassName.field access and bare references inside the class's own static methods, for read, write and compound assignment. The Java and C# grammars also now record the static field modifier (they were dropping it), so this works across those languages too.
~/= no longer crashes the parser. ~/= (Dart) and //= (Python) matched the grammar but had no handler, so parsing threw an uncaught error out of loadCodeUnit. ~/=///= are now fully supported, and any other still-unsupported compound operator (e.g. JavaScript/TypeScript %=) surfaces as a clean SyntaxError instead of an uncaught crash.Enum.values can be assigned to a typed or inferred list. It was built with a dynamic element type while its declared type is List<Enum>, so var v = Color.values; / List<Color> v = Color.values; failed the declaration cast. It now carries the enum's own element type.ASTValue.fromValue<int> on a non-whole double now throws a clean ApolloVMCastException instead of a raw Dart TypeError.Division semantics are unchanged and remain intentionally per-language (Dart/JS/TS/Python / yields a double; Java/C#/Go/Kotlin / on ints is truncating integer division); regression guards now pin both.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.1.1/CHANGELOG.md
Fixed: a `++`/`--` statement inside a `while`/`do-while` body produced an invalid module. A bare increment/decrement (i++, ++i, i--, --i) used as a st
++/-- statement inside a while/do-while body produced an invalid module. A bare increment/decrement (i++, ++i, i--, --i) used as a statement left the operator's value on the operand stack; inside a loop's void block that value reached the block end and the compiled module failed WebAssembly validation ("values remaining on stack at end of block"). Only explicitly int-typed counters written as i = i + 1 happened to avoid it. The discarded value is now dropped in statement position; the expression form (x = i++) still yields its value, and for-header updates are unchanged.String.length, .isEmpty, .isNotEmpty compile to Wasm (read the [len:i32][utf8] header length word).String.toUpperCase() / .toLowerCase() compile to Wasm for ASCII text — a fresh buffer is allocated and each ASCII letter is shifted by the case bit; other bytes are copied unchanged.The stored String length is the UTF-8 byte count, so these match Dart semantics for ASCII input. See WASM_BACKEND_PLAN.md for the re-verified backend status (8 of the 9 previously documented gaps already work) and the remaining gaps.
Substantially expanded coverage: AST values/types/variables/annotations, the core library, external-function/getter mapping, runner tryExecute* fallbacks, in-memory code storages, cross-language translation and generator emit paths, native parse+execute across every non-Dart language, and a transpile-then-execute integration matrix (Dart → Java/JS/TS/C#).
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.1.0/CHANGELOG.md
A Dart enum constant is a constructor invocation, but the language server's declaration scanner recorded its range as the name alone: earth(5.97, 6371
A Dart enum constant is a constructor invocation, but the language server's declaration scanner recorded its range as the name alone: earth(5.97, 6371) selected only earth, dropping the arguments. Every other declaration kind has its range extended past the name — a class member's covers its parameters and body — so enum constants were the one exception, and folding, hover and the document outline all saw a truncated span.
.named constructor, <T> type arguments, the argument list, or an = value (Red = 1). Its name span is unchanged, so go-to-definition and rename still target the name alone., even when nested inside the argument list, so scanning resumed mid-arguments and read the argument label as another constant: earth(mass: 5.97, radius: 6371) emitted a phantom radius enum member into the outline. Entry consumption is now depth-aware — only a ,/;/} outside brackets ends an entry — which fixes both the truncated range and the phantom symbols.Constructors declared in an enum body (const Planet(this.mass);) were already correct and are unchanged.
Full Changelog: https://github.com/ApolloVM/apollovm_dart/compare/v2.0.0...v2.0.1
Executing a compiled Wasm module on the Dart VM needs a native engine (package:wasm_run), which brings an FFI/Rust toolchain and a long-abandoned flut
apollovm no longer drags a native/FFI toolchain into every consumerExecuting a compiled Wasm module on the Dart VM needs a native engine
(package:wasm_run), which brings an FFI/Rust toolchain and a long-abandoned
flutter_rust_bridge 1.x with it. That dependency was paid by every consumer
of apollovm — including the many that only parse, translate or generate code
and never execute Wasm at all. Worse, flutter_rust_bridge 1.x pins
shelf_web_socket ^1.0.2 and web_socket_channel ^2.2.0, so anything depending
on apollovm (however indirectly) could not also use a modern shelf/WebSocket
stack.
The native runtime now lives in its own package, apollovm_wasm. Nothing
else moved: Wasm compilation is unchanged and still in core.
package:wasm_run is no longer a dependency. On the Dart VM,
WasmRuntime() now returns an unsupported runtime
(isSupported == false) unless the native engine is registered. Wasm still
compiles; it just cannot be executed out of the box.
To execute Wasm on the VM, add apollovm_wasm and register it once:
import 'package:apollovm/apollovm.dart';
import 'package:apollovm_wasm/apollovm_wasm.dart';
void main() {
registerApolloVMWasmRuntime();
final runtime = WasmRuntime()..ensureBooted();
print(runtime.isSupported); // true
}
Browsers are unaffected — they have a Wasm engine built in, and the browser runtime remains in core.
createWasmRuntime() is no longer part of the VM conditional-import
chain. The platform default is now resolved through
WasmRuntime.registerProvider(), which apollovm_wasm calls.
WasmRuntime.registerProvider() — installs the implementation that
WasmRuntime() instantiates, so an engine can be supplied from outside the
package.Also released from this repo: apollovm_wasm 1.0.0 — the native (Dart VM) Wasm runtime extracted out of core.
Every ApolloVM grammar's top rule is compilationUnit().star().trim().end(). When a syntax error appeared deep in a file, the last top-level definition
Every ApolloVM grammar's top rule is compilationUnit().star().trim().end(). When a syntax error appeared deep in a file, the last top-level definition failed deep in the input, but star() discarded that failure and end() reported a generic end of input expected at offset 0 (line 1). petitparser's plain parse() does not track the farthest failure, so the deep position was lost.
Parsers now record the farthest point the grammar actually reached and report the error there — at or immediately adjacent to the real mistake.
ApolloSourceCodeParser.trackFarthestFailure: on failure, the source is re-parsed with a copy of the grammar (petitparser transformParser + callCC) in which every parser records each Failure if it is the deepest seen — capturing failures that star()/optional() would swallow. The deeper of the two positions is used, so the reported position never gets worse. The happy path is untouched: the fast plain parser runs first; the tracking re-parse only runs on failure.locateParseError now runs its structural heuristics (bracket-imbalance, missing ;) before trusting the raw parser position, then falls back to the now-precise position — preserving editor-friendly locations while improving the fallback for every other failure.Full Changelog: https://github.com/ApolloVM/apollovm_dart/compare/v1.9.2...v1.10.0
Every ApolloVM grammar's top rule is compilationUnit().star().trim().end().
When a syntax error appeared deep in a file, the last top-level definition failed
deep in the input, but star() treated that as "stop, success" and discarded
the failure, so end() reported a generic end of input expected at offset 0
(line 1) — technically correct, useless in an editor. petitparser's plain
parse() does not track the farthest failure, so the deep position was lost.
Parsers now record the farthest point the grammar actually reached and report the error there, at or immediately adjacent to the real mistake:
ApolloSourceCodeParser.trackFarthestFailure. When a parse fails,
the source is re-parsed with a copy of the grammar (built via petitparser's
transformParser + callCC) in which every parser records each Failure it
produces if it is the deepest seen. This captures failures that star() /
optional() would otherwise swallow. The deeper of the two positions is used,
so the reported position never gets worse. The happy path is untouched — the
fast plain parser still runs first; the tracking re-parse only runs on failure.locateParseError now runs its structural heuristics (bracket-imbalance,
missing ;) before trusting the raw parser position, then falls back to the
now-precise parser position. Editor-friendly locations (a missing ; reported
at the end of the offending value; '(' is never closed) are preserved, while
the fallback for every other failure is far better than the old offset 0.Three defects made Dart → Go → parse → run fail — or, in the first case, silently produce a wrong answer — for programs the 1.9.1 fixtures did not cov
Three defects made Dart → Go → parse → run fail — or, in the first case, silently produce a wrong answer — for programs the 1.9.1 fixtures did not cover.
Point(this.x, this.y) shorthand generated func NewPoint(x int, y int) *Point { o := &Point{}; return o } — the arguments were never assigned, so every field stayed zero-valued and the program ran to a wrong result rather than failing. The factory now emits o.x = x for each this. parameter, after the field's declared initial value so an explicit argument wins. The long-hand form (Point(int x, int y) { this.x = x; }) was already correct.var map = ..., or a field named type, became map := ... / o.type, which does not parse — map and type are 2 of Go's 25 reserved words. Such a name is now escaped with a trailing _ (map_, type_) at every site: declarations, reads, parameters, struct fields, methods, and the members written after a ..NewPoint(...) against the declarations it has already seen, so a top-level function emitted first could not resolve the struct. generateASTRoot now emits structs (and their factories) before the top-level function block.New ApolloGenerator.normalizeIdentifier(String) hook, applied by the base generator to the member names written after a . (fields, getters, setters and methods). It is the identity for every language except Go, which uses it to escape reserved words, so a declaration and its uses always agree. Type identifiers keep going through normalizeTypeFunction, so Math.max is untouched.
4 new tests, each asserting the generated source and running it back through the Go parser. Full suite: 1659 passing (was 1655).
ApolloVM's Go parser remains order-dependent: hand-written Go that calls NewPoint(...) before declaring type Point struct still fails to resolve, though Go itself is order-independent. The generator no longer produces that shape.
🤖 Generated with Claude Code
Line coverage of lib/ went from 83.4% to 84.7%. The number is the least interesting part: writing the tests surfaced seven real defects, all fixed her
Line coverage of lib/ went from 83.4% to 84.7%. The number is the least
interesting part: writing the tests surfaced seven real defects, all fixed here.
String.length, String.isEmpty, String.isNotEmpty and the sign of
int/double only worked when called. s.length() worked and s.length
threw — the opposite of how Dart, Kotlin and C# source reads. List and Map
already exposed theirs as getters. They are now getters and methods, so
Java-style s.length() keeps working.new HashMap<>(){{ put("a", 1); }} — exactly what the Java generator emits for
a Dart map literal — handed the '>' character to a cast expecting an
ASTType and threw a raw TypeError. A separate typo made the map literal's
diamond alternative match << instead of <>. Generic type arguments are now
picked out by type rather than by position, in all four list/map literal rules.
A Dart map literal now round-trips through Java.&T{} composite literal, so any Go source containing
a func NewFoo() *Foo { o := &Foo{} ... } factory — the exact shape the Go
generator emits — failed to parse. The zero-valued form now parses as the
struct's no-argument constructor. Field-initializing literals (&Foo{x: 1})
remain unsupported.NewFoo(...) call site resolved to a top-level function that no longer
existed, since the declaration had already been folded into the struct's
constructor. It now resolves to the constructor.o was a plain local, so o.x = x failed with "Can't
find variable: 'o'". It is now bound as the receiver before the body parses,
which the factory-to-constructor conversion already assumed.Point(int x) { this.x = x; } emitted o.x = o.x, silently assigning the
field to itself. A parameter now shadows a same-named field.p := Point(a, 1), which is not Go. Instantiation
now emits the factory call p := NewPoint(a, 1), and every struct gets a
factory (a field-less struct used to get none) so the call always resolves.
This is the only change to the expected output of the go_*.test.xml
fixtures.Dart -> Go -> parse -> run now works end to end.
ApolloGenerator carried ~140 lines of dead dispatch (generateASTNode,
generateASTRoot, generateASTType, generateASTStatement,
generateASTBranch, generateASTExpression, generateASTValue). Every one
was shadowed by both subclasses, and they had already drifted: the base
generateASTRoot never learned to emit extensions, so a future third
generator would have silently dropped them. They are now abstract, or removed
where nothing dispatches through the base.dart:math, and every String, int, double,
List and Map member, in both getter and method form where both exist.Several grammars parse only a subset of what their own generator emits: the Lua
generator emits a + b for string concatenation and s.m() for method calls,
where Lua wants a .. b and s:m() (Lua classes are already marked unsupported
in the README matrix, so that generator is outside the stated contract); Python
cannot parse the lambda it generates; JS and TS cannot parse the map literal
they generate. Each is listed in
test/unit/apollovm_generator_matrix_test.dart.
Three of the supported languages have a native extension construct, and they now share one: parse in any of them, run, and translate to the others.
Three of the supported languages have a native extension construct, and they now share one: parse in any of them, run, and translate to the others.
extension NumExt on int { int doubled() { return this * 2; } int get twice { … } }
(the name is optional).fun Int.doubled(): Int { … } and val Int.twice: Int get() = …;
members are grouped by receiver into one extension.static class NumExt { public static int Doubled(this int self) { … } }; the
self-parameter and this are translated in both directions. C# has no extension property,
so an extension with a getter cannot be emitted as C#.Extensions apply to core types (int, String, …) as well as user classes, support
overloads, and may call one another (this.doubled() or plain doubled()). A class member
always wins over an extension member. Extensions are module-local: they are not carried across
import. Java, JavaScript, TypeScript, Python, Go and Lua have no equivalent construct, so
asking for one throws UnsupportedSyntaxError instead of emitting a shim that would mean
something else.
Supporting changes:
int get x { … } / => …) in class bodies too; the
ASTClassGetterDeclaration node existed but no grammar reached it.ASTExtension node and ASTRoot.extensions registry, consulted as a fallback when a
receiver's own class lookup misses.'${a.doubled()}') were never linked into the
AST parentNode chain, so they could not resolve anything reached through it.ASTGetterDeclaration now serializes its name, return type and
modifiers instead of appearing as an anonymous node.The 1.7.0 repository features left "room for a remote/web backend"; this release adds it, so a web IDE (or any Dart host) can drive a real project ove
The 1.7.0 repository features left "room for a remote/web backend"; this release adds it, so a web IDE (or any Dart host) can drive a real project over the wire.
RemoteRepositoryAdapter (web-safe, in
package:apollovm/apollovm_repository.dart): a RepositoryAdapter that talks
to a repository server over HTTP, implementing the full interface (filesystem,
search, git). Connect with
RemoteRepositoryAdapter.connect('http://host:port'); it reports
RepoCapabilities.isRemote. Backed by package:http, so it runs in the
browser.RepositoryRpc (web-safe): a transport-agnostic JSON dispatcher that
maps {op, ...args} requests to a RepositoryService. A shared Op constant
set is the single source of truth for the wire contract, so server and client
can't drift.fromJson on every repository value type (RepoFile, RepoEntry,
RepoStat, RepoEdit, TextMatch, RepoCapabilities, and the git types),
completing the JSON round-trip alongside the existing toJson.tool/repository_server.dart: a lightweight HTTP server exposing a
local checkout (via LocalRepositoryAdapter) over POST /rpc, with reflected,
permissive CORS so a browser app on another origin can reach it. Flags:
--workspace, --allow-write, --allow-git-write, --port, --address.
The server remains the authority on permissions regardless of what a client
requests.New standalone libraries `package:apollovm/apollovm_repository.dart` (web-safe) and `apollovm_repository_io.dart` (adds the on-disk adapter). The repo
package:apollovm/apollovm_repository.dart
(web-safe) and apollovm_repository_io.dart (adds the on-disk adapter). The
repository features are not MCP-exclusive — a web IDE, a desktop editor, an
agent or a test can use them directly via RepositoryService, a typed
façade returning typed results (no MCP/JSON). It bundles the filesystem/search/
git operations of a pluggable RepositoryAdapter with language-aware code
navigation (outline/definition/references/hover/diagnostics/
workspaceSymbols/searchSymbols) powered by ApolloVM's parsers via an
in-process LspService.RepositoryAdapter implementations: LocalRepositoryAdapter
(dart:io + git), InMemoryRepositoryAdapter (web-safe), plus room for a
remote/web backend — enabling file edits and git commands from the browser. A
PermissionGuard decorator enforces a RepoConfig uniformly across backends.apollovm.fs.*, apollovm.search.*, apollovm.code.* and
apollovm.git.* tools are a thin JSON layer over RepositoryService, letting
an agent read, search, navigate, edit and version-control real files instead of
shelling out to POSIX (cat, ls, find, grep, sed, git). Enabled by
serving with --workspace <dir> (or by passing a RepositoryAdapter to
ApolloMcpServer/serveStdio/HttpSseTransport); with no workspace the server
stays inline-source-only exactly as before.--allow-write / --allow-git-write). Paths are confined to the
workspace root (../absolute rejected), git is invoked with an argument list
(never a shell) pinned to the root, and fs.edit accepts an atLine safety
anchor (made mandatory by --require-line-match).RepositoryAdapter,
and the apollovm mcp list/schema/info CLI advertise them only with
--workspace. mcp call invokes them via --json-args + --workspace.A member with no { } body is now fully covered by its documentSymbol range. A ;-terminated constructor (const Foo(this.x);, a redirecting Foo.zero() :
A member with no { } body is now fully covered by its documentSymbol range. A ;-terminated constructor (const Foo(this.x);, a redirecting Foo.zero() : this(0);) or an abstract method previously stopped its range at the name, excluding the parameters. The range now extends to the terminating ;, covering the whole signature — parameters and any initializer list — for class and enum constructors alike. Bodied and expression-bodied members are unchanged.
🤖 Generated with Claude Code
{ ... } body is now fully covered by its documentSymbol
range. A ;-terminated constructor (const Foo(this.x);, a redirecting
Foo.zero() : this(0);) or an abstract method previously stopped its range at
the name, so selecting it excluded the parameters. The range now extends to
the terminating ;, covering the whole signature — parameters and any
initializer list. Applies to class and enum constructors alike; bodied and
expression-bodied members are unchanged.Members with an expression body are now fully covered by their documentSymbol range (so "select symbol" / Outline click selects the whole member), for
Members with an expression body are now fully covered by their documentSymbol range (so "select symbol" / Outline click selects the whole member), for class and enum members.
int square(int n) => n * n; (Dart/C#) previously stopped at the name; it now extends to the terminating ;.fun sum(a, b) = a + b (Kotlin, brace-less) previously swallowed the next member; it is now bounded to its own line, and the following member is recognized again.()/[]/{} inside the expression (e.g. a map-literal body => {1: 2}) are handled without corrupting brace tracking.🤖 Generated with Claude Code
documentSymbol range. A => expr; member (Dart/C#) previously stopped at
its name, and a brace-less = expr member (Kotlin) even swallowed the next
member because the scanner never recovered. The token indexer now consumes the
expression: the => form extends to its terminating ;, and the brace-less
= form is bounded to the end of its line (so the following member is still
recognized). Balanced ()/[]/{} inside the expression (e.g. a map literal
body => {1: 2}) are handled without corrupting brace tracking. Works for
both class and enum members.Fixes documentSymbol for members declared after an enum's constant list. Everything after the ; that ends the constant list (fields, constructors, met
Fixes documentSymbol for members declared after an enum's constant list. Everything after the ; that ends the constant list (fields, constructors, methods) was being swallowed as bogus enum constants (named int, const, final, …), so enum methods had no body range and enum constructors weren't recognized at all.
The token indexer now tracks the constant-list terminator per enum: after that ;, identifiers in the enum body are parsed like class members — real kinds and full-body ranges. Pure-constant enums are unaffected; class constructors were already handled correctly.
🤖 Generated with Claude Code
; that ends an enum's constant list (fields,
constructors, methods) was being swallowed as bogus enum constants (named
int, const, final, …), so documentSymbol gave enum methods no body
range and did not recognize enum constructors at all. The token indexer now
tracks the constant-list terminator per enum: after it, identifiers in the
enum body are parsed like class members — real kinds and full-body ranges.
Pure-constant enums (enum E { a, b, c }) are unaffected; class constructors
were already handled correctly.`documentSymbol` ranges now span a member's whole body, not just its signature. The token indexer tracks function/method/constructor bodies (skipping
documentSymbol ranges now span a member's whole body, not just its signature. The token indexer tracks function/method/constructor bodies (skipping the parameter list first, so Dart named-parameter { ... } isn't mistaken for the body) and extends the range to the body's closing }. Bodyless members and the selectionRange (the name) are unchanged.this. / super. now proposes the enclosing type's members with their real kinds, instead of every identifier plus keywords.this. case), by drawing on the token-index declarations; local variables and parameters are still surfaced from the raw token stream.🤖 Generated with Claude Code
documentSymbol ranges now span a member's whole body, not just its
signature. Previously only class/enum declarations had their range
extended to the closing }; a function/method/constructor stopped at the end
of its name, so an editor "select symbol" or outline action only highlighted
the signature. The token indexer now tracks member bodies too — skipping the
parameter list first, so Dart named-parameter braces ({ ... }) are not
mistaken for the body — and extends fullEnd to the body's closing }.
Bodyless members (abstract/;-terminated) are left unchanged. The narrower
selectionRange (the name) is untouched.this. / super. proposes the enclosing type's members.
A member-access position is now recognized and answered with just that type's
fields and methods (with their real kinds), instead of the full grab-bag of
every identifier plus keywords.this. case leaves the source unparseable, which had emptied the AST
symbol table and degraded every proposal to a plain identifier. Completion now
also draws on the token-index declarations (which survive a failed parse), so
methods and fields keep their proper kinds mid-edit. Local variables and
parameters continue to be surfaced from the raw token stream.Two Language Server improvements.
Two Language Server improvements.
textDocument/completion now harvests identifiers from the raw token stream in addition to AST symbols + keywords. Because that scan survives a failed parse, completion works while you're mid-edit (where there are no AST symbols) and surfaces local variables and parameters the symbol table omits. Items are de-duplicated and ranked: local-scope symbols → symbols → harvested identifiers → keywords; the partial token under the cursor is skipped.
;ApolloVM's PEG parser reports a generic end of input expected at offset 0 for most structural mistakes. The LSP layer already recovered the real position for bracket imbalances, and now also for a missing statement terminator in ;-required languages (Dart, Java, C#): a balanced-but-unterminated statement is pinned to the end of the offending value with an expected ';' hint, instead of defaulting to the top of the file. Conservative — skips continuation shapes/keywords and annotations, and does not apply to Kotlin/JavaScript/Lua/Python.
Additive and backward-compatible. All 222 LSP + MCP tests pass.
Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v1.5.0/CHANGELOG.md
🤖 Generated with Claude Code
textDocument/completion only offered AST symbols
(top-level/members) plus keywords — so mid-edit, when the parse fails (the
common case), it fell back to keywords only. It now also harvests identifiers
from the raw token stream, which survives a failed parse and includes local
variables and parameters the symbol table omits. Results are de-duplicated and
ranked: local-scope symbols, then other symbols, then harvested identifiers,
then keywords. The partial token under the cursor is skipped.;. ApolloVM's PEG parser reports
a generic "end of input expected" at offset 0 for most structural mistakes;
the LSP layer already recovered the real position for bracket imbalances, and
now also for a missing statement terminator in ;-required languages (Dart,
Java, C#). A balanced-but-unterminated statement is pinned to the end of the
offending value (with an expected ';' hint) instead of defaulting to the top
of the file. The heuristic is conservative — it skips continuation shapes
(operators, ., ?, :, ,, open brackets, continuation keywords like
return, and annotations) and does not apply to languages where ; is
optional/absent (Kotlin, JavaScript, Lua, Python).Docs-only patch. The live ApolloVM Web Demo moved to the site root — https://apollovm.github.io/apollovm_web_example/ — and the old /www/ path now 404
Docs-only patch. The live ApolloVM Web Demo moved to the site root — https://apollovm.github.io/apollovm_web_example/ — and the old /www/ path now 404s. Updates the README link (bumped to 1.4.2 so the corrected link reaches the pub.dev package page).
🤖 Generated with Claude Code
https://apollovm.github.io/apollovm_web_example/), not the old
/www/ path.Makes ApolloVM's MCP server and all its tools (apollovm.* + apollovm.lsp.*) run in a browser.
Makes ApolloVM's MCP server and all its tools (apollovm.* + apollovm.lsp.*) run in a browser.
package:apollovm/apollovm_mcp.dart is now fully web-safe — no dart:io, no dart:isolate. The MCP server and every tool compile and run under dart2js / DDC. Construct ApolloMcpServer on any StreamChannel<String> (e.g. a web MessageChannel) and drive the tools in-process. (In 1.4.0 the apollovm.lsp.* tools were documented as web-safe, but apollovm_mcp.dart still transitively imported dart:io/dart:isolate, so a web build failed to compile.)dart:io-only pieces moved to a new package:apollovm/apollovm_mcp_io.dart (which re-exports apollovm_mcp.dart): serveStdio, HttpSseTransport, and the CommandMcp CLI group. Migration: if you imported those from apollovm_mcp.dart, switch that import to apollovm_mcp_io.dart (one line).wasm_runtime.dart): a killable-isolate executor on native, an in-process cooperative-timeout executor on the web.test/mcp/web_compat_test.dart runs under dart test --platform chrome, guarding the web-safe surface.Verified: dart2js compiles the full MCP + LSP surface; web-compat tests pass in Chrome; all MCP tests pass on the VM.
Full changelog: see CHANGELOG.md.
🤖 Generated with Claude Code
package:apollovm/apollovm_mcp.dart is now fully web-safe — it imports no
dart:io and no dart:isolate, so the MCP server and every apollovm.* /
apollovm.lsp.* tool compile and run in a browser (dart2js / DDC). Construct
ApolloMcpServer on any StreamChannel<String> (e.g. a web MessageChannel)
and drive all tools in-process. (In 1.4.0 the apollovm.lsp.* tools were
documented as web-safe, but apollovm_mcp.dart still transitively imported
dart:io/dart:isolate, so a web build failed to compile.)dart:io-only pieces moved to a new package:apollovm/apollovm_mcp_io.dart
(which re-exports apollovm_mcp.dart): serveStdio, HttpSseTransport and
the CommandMcp CLI group. Native embedders and the apollovm CLI import
this. Migration: if you imported serveStdio / HttpSseTransport /
CommandMcp from apollovm_mcp.dart, switch that import to
apollovm_mcp_io.dart (a one-line change).wasm_runtime.dart): a killable-isolate executor on native, and an in-process
executor with a cooperative timeout on the web (no dart:isolate). Tools in
McpLimits.isolateTools therefore still run, degrading to a soft timeout on
the web.test/mcp/web_compat_test.dart runs the tools, the
in-process LspClient and the server under dart test --platform chrome,
guarding the web-safe surface against future dart:io/dart:isolate leaks.ApolloVM 1.4.0 brings its Language Server features to two new audiences — web/agent embedders and MCP AI agents — with no socket or transport wiring r
ApolloVM 1.4.0 brings its Language Server features to two new audiences — web/agent embedders and MCP AI agents — with no socket or transport wiring required.
LspService — in-process LSP API (no socket). Embed ApolloVM's language features as plain typed Dart calls: analyze, hover, definition, documentSymbols, completion, references, rename, workspaceSymbols, and a diagnostics stream. No transport, no initialize/initialized handshake; dart:io-free, so it runs unchanged in the browser (compiled to JS).apollovm.lsp.*). The MCP server now lets an AI agent inspect a codebase the way an editor does — diagnostics, outline, hover, definition, references, completion and workspace-wide symbol search — with precise LSP line/character ranges.apollovm.lsp.* tools, so an AI agent can inspect code the way an editor does. Results carry precise LSP line/character ranges.
apollovm.lsp.diagnostics — errors/warnings with ranges.apollovm.lsp.symbols — document outline (nested symbols + ranges).apollovm.lsp.hover — signature, type and documentation at a position.apollovm.lsp.definition — declaration location at a position.apollovm.lsp.references — all references at a position.apollovm.lsp.completion — completion proposals at a position.apollovm.lsp.workspaceSymbols — symbol search across multiple in-memory files (codebase-wide lookup).LspService; no socket, no dart:io), runs in-process or inside an isolate like the other bounded tools, and honors the existing maxSourceChars limit. The parser is selected from the language argument, so a mismatched URI cannot change it.package:apollovm/apollovm_mcp.dart: LspRuntime, buildLspTools, computeLspTool, isLspTool, lspToolNames. The CLI apollovm mcp call gained --line, --character and --query flags.example/apollovm_example_mcp_lsp.dart.LspService in package:apollovm/apollovm_lsp.dart: a document-oriented facade that embeds an in-process LspServer and exposes the language features as plain typed Dart calls — no transport, no socket and no initialize/initialized handshake to run by hand. Being dart:io-free it runs unchanged in a browser (compiled to JS) or an AI agent.
analyze(uri, text) returns the buffer's diagnostics directly; open/change/close manage documents (versions tracked automatically); every query resolves against the current buffer.hover, definition, documentSymbols, completion, references, documentHighlight, prepareRename, rename, workspaceSymbols, plus a diagnostics stream and a ready (InitializeResult) future.LspService.wrap(client) layers the same convenience over an existing LspClient (e.g. one connected to a remote server).example/apollovm_example_lsp_api.dart.Full changelog: https://github.com/ApolloVM/apollovm_dart/compare/v1.3.0...v1.4.0
One column per quarter.