feat(kernel): R7b Dart walker — dart module, vendored-grammar-C d4d8f3e + wasm byte-copy vendor, dart default-routed (#1386)
R7b batch 4 #4 — the FINAL R7b language (docs/design/dart-kernel-port-checklist.md is the authoritative quirk list). The fourth vendored-grammar-C language, with a twist: production dart resolved its wasm from tree-sitter-wasms, whose dart dependency is an UNPINNED github:UserNobody14/tree-sitter-dart — a routine dependency update would have silently changed dart's grammar. This PR byte-copies the shipping 0.1.13 artifact into src/extraction/wasm/ (VENDORED_WASM_LANGS += dart) and compiles the same-commit (d4d8f3e337d8) parser.c/scanner.c in the kernel — table identity proven by the kernel-grammar-parity row. crates.io tree-sitter-dart is the nielsenko fork (different lineage) — rejected. The center of gravity is THE SIBLING-BODY DOUBLE-WALK, reproduced bug-for-bug: dart attaches every function/method body as a NEXT SIBLING of its signature, and the TS walkers consume each body TWICE — once via resolveBody (attributed to the function/method) and once via the enclosing generic walk (attributed to the file/class). Duplicate local-function nodes with the SAME id under different parents, duplicated calls/instantiates refs, and file/class-attributed fn-ref twins all emit in the exact observed interleave (a dedicated fixture pins the duplicate-id rows; the bloc kind-census spot-check pins the counts). Also preserved (probe-pinned): the extractBareCall selector matrix (the first callTypes=[] language — cascades completely invisible, `?.` encodes like `.`, the `ConfigT.load()` calls+references double emission with no callee-of-call skip, capitalized-chain `Foo.create().run` re-encode, const-object callee names); the constructor hooks (unnamed ctor skipped, named ctors/factories renamed to the CTOR name with the class as returnType, `@override (T) m()` record-misparse rescued by class-name validation); operator methods minting `method "<anonymous>"`; static_final_declaration constants via the visitNode hook while instance fields mint NOTHING; the prefixed-return-type prefix bug (`other.OtherClass f()` → returnType `other`); enum `with` mixins silent vs `implements` working; anonymous extensions named after the ON type; deferred imports invisible; named-argument callbacks NOT fn-ref-captured (the Flutter `onPressed:` idiom — future accuracy PR, TS-side first); `async*`/`sync*` NOT async; value-refs with the LIVE dart sibling-body pull and the `$X`-vs-`${X}` interpolation asymmetry; dartdoc kept in all three comment forms with the annotation-broken chain. Gates: parity sweeps first-run 0-diff on shelf/bloc/flutter — 5,815 clean files byte-parity, deferrals 10/21/1341 ≈ the survey's 10/21/~1340 (both-arm grammar reality: empty object patterns — the sealed-class idiom — and unnamed `library;` dominate; --max-deferral 0.3); full-init dumps byte-identical ×3 (shelf 7,959 / bloc 40,026 / flutter 1,855,319 dump lines); bloc per-kind node census identical across arms (the double-walk duplicate rows survive the store identically); kernel-dart-parity suite (7 fixtures + in-memory CRLF variants + double-walk duplicate-id pin + generated-file skip pin + two defer pins); full suite 2,688 green ×2 with CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += dart (20 langs — R7b COMPLETE). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
bdd687b49f
commit
d1b75a1a27
@@ -0,0 +1,77 @@
|
||||
import 'dart:async';
|
||||
import 'package:foo/bar.dart' as bar show Baz hide Qux;
|
||||
import 'pkg.dart' deferred as lazy;
|
||||
export 'src/out.dart' show Pub;
|
||||
part 'part1.dart';
|
||||
|
||||
/// Doc line one.
|
||||
/// Doc line two.
|
||||
void topFn(int a, String b) {
|
||||
var local = 5;
|
||||
int typed = 6;
|
||||
final con = 7;
|
||||
int uninit;
|
||||
uninit = 8;
|
||||
local = a;
|
||||
helper(a);
|
||||
obj.method(a);
|
||||
Config.setting;
|
||||
Config.load();
|
||||
w?.render();
|
||||
list..add(1)..add(2);
|
||||
final w2 = Widget(1);
|
||||
final w3 = new Widget(2);
|
||||
const e = EdgeInsets.all(8.0);
|
||||
Foo.create().run();
|
||||
lower().chain();
|
||||
print('sum ${a + compute()} $local');
|
||||
}
|
||||
|
||||
// plain comment
|
||||
int get topGetter => 42;
|
||||
set topSetter(int v) {}
|
||||
|
||||
class Widget extends Base with Mix1, Mix2 implements Draw, Paint {
|
||||
static const int kMax = 10;
|
||||
static final shared = Widget(0);
|
||||
final int size;
|
||||
int count = 0;
|
||||
var loose;
|
||||
late String name;
|
||||
Widget(this.size);
|
||||
Widget.named(this.size) { init(); }
|
||||
factory Widget.create() => Widget(1);
|
||||
Widget._() : size = 0;
|
||||
@override
|
||||
void render(Canvas c) { c.draw(); }
|
||||
static Widget make() => Widget(3);
|
||||
int get area => size * size;
|
||||
set area(int v) { count = v; }
|
||||
Future<void> load() async { await fetch(); }
|
||||
operator +(Widget o) => Widget(size + o.size);
|
||||
}
|
||||
|
||||
mixin Mix1 on Base {
|
||||
void mixMethod() { helper(0); }
|
||||
}
|
||||
|
||||
extension WidgetExt on Widget {
|
||||
void extMethod() { render(null); }
|
||||
}
|
||||
|
||||
enum Color { red, green, blue }
|
||||
|
||||
enum Status with Mix1 implements Draw {
|
||||
ok(200),
|
||||
err(500);
|
||||
final int code;
|
||||
const Status(this.code);
|
||||
bool get good => code < 400;
|
||||
static Status parse(int c) => ok;
|
||||
}
|
||||
|
||||
typedef IntFn = int Function(int);
|
||||
typedef void OldStyle(int x);
|
||||
|
||||
abstract class Base {}
|
||||
class Draw {}
|
||||
Reference in New Issue
Block a user