Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(core): Dart AST tier with health and perf markers (#689)
Raghav Chamadiya60cbd86003b4
diff --git a/README.md b/README.mdindex 7df524ca8..67dc46d52 100644--- a/README.md+++ b/README.md@@ -347,6 +347,7 @@ Install from the Marketplace (search **Repowise**) or Open VSX, then run<img src="https://img.shields.io/badge/Swift-F05138?style=flat-square&logo=swift&logoColor=white" alt="Swift" /><img src="https://img.shields.io/badge/Scala-DC322F?style=flat-square&logo=scala&logoColor=white" alt="Scala" /><img src="https://img.shields.io/badge/PHP-777BB4?style=flat-square&logo=php&logoColor=white" alt="PHP" />+ <img src="https://img.shields.io/badge/Dart-0175C2?style=flat-square&logo=dart&logoColor=white" alt="Dart" /> <strong>· Partial </strong><img src="https://img.shields.io/badge/Luau-00A2FF?style=flat-square&logo=lua&logoColor=white" alt="Luau" /></p>@@ -354,10 +355,10 @@ Install from the Marketplace (search **Repowise**) or Open VSX, then run| Tier | Languages | What works ||------|-----------|------------|| **Full** | Python · TypeScript · JavaScript · Java · Kotlin · Go · Rust · C++ · C# | AST parsing, import resolution, named bindings, call resolution, heritage extraction, docstrings; multi-project workspace resolvers; framework-aware edges; per-language dynamic-hint extractors; **code-health markers** |-| **Good** | C · Ruby · Swift · Scala · PHP | AST parsing, import resolution, named bindings, call resolution, heritage (mixins / derive / extensions / traits), docstrings; dedicated workspace-aware resolvers; Rails / Laravel / TYPO3 framework edges; dynamic-hint extractors |+| **Good** | C · Ruby · Swift · Scala · PHP · Dart | AST parsing, import resolution, named bindings, call resolution, heritage (mixins / derive / extensions / traits), docstrings; dedicated workspace-aware resolvers; Rails / Laravel / TYPO3 / Flutter framework edges; dynamic-hint extractors; Dart adds code-health + perf markers || **SQL / dbt** | `.sql` via sqlglot (postgres, mysql, tsql, clickhouse, ...) | Tables / views / functions / procedures as symbols with wiki pages; dbt projects get real `ref()` / `source()` lineage edges: model-level DAG, hotspots, co-change, ownership || **Config / data** | OpenAPI · Protobuf · GraphQL · Dockerfile · Makefile · YAML · JSON · TOML · Terraform · Markdown · Shell | Included in the file tree; special handlers extract endpoints / targets where applicable |-| **Git-blame only** | Objective-C · Elixir · Erlang · Dart · Zig · Julia · Clojure · Haskell · OCaml · F# · … | Tracked in git history (blame, hotspots, co-change); no AST parsing yet |+| **Git-blame only** | Objective-C · Elixir · Erlang · Zig · Julia · Clojure · Haskell · OCaml · F# · … | Tracked in git history (blame, hotspots, co-change); no AST parsing yet |Adding a language needs **one `.scm` query file and one config entry**, with nochanges to the parser core. Full per-language matrix, code-health checklist, anddiff --git a/docs/LANGUAGE_SUPPORT.md b/docs/LANGUAGE_SUPPORT.mdindex 7b506007c..616fad176 100644--- a/docs/LANGUAGE_SUPPORT.md+++ b/docs/LANGUAGE_SUPPORT.md@@ -107,6 +107,7 @@ fixture under `tests/fixtures/lang_samples/<lang>/` + a walker test):| Rust | Y | Y | Y | Y || C++ | Y | Y | Y | Y || C# | Y | Y | Y | Y |+| Dart | Y | Y | n/a | Y (`assert` statements only; `expect()` calls have no call-node type to key on) |### Good@@ -122,6 +123,7 @@ resolvers for each language.| **Swift** | `.swift` | `main.swift` `App.swift` | `import Foundation` with SPM `Package.swift` `targets:` -> directory mapping; intra-module type references link same-target files (Swift has no intra-module imports by design); `@main` / `@UIApplicationMain` / `@NSApplicationMain` flag entry points; `@_exported import` marks re-exports || **Scala** | `.scala` | `Main.scala` `App.scala` | `import pkg.Foo`, brace imports `{A, B => C}` (expanded per selected name, hidden imports skipped), wildcards (`pkg._` / Scala 3 `pkg.*`), and package imports, resolved through the shared JVM workspace index (chained package clauses, Scala ↔ Java cross-language, same-package implicit identifiers) with SBT `build.sbt` / Mill `build.sc` multi-project parsing as fallback; `scala.` and JDK namespaces filtered || **PHP** | `.php` | `index.php` `public/index.php` | `use Foo\Bar\Baz` with composer.json `autoload.psr-4` longest-prefix resolution |+| **Dart** | `.dart` | `main.dart` | `import` / `export` (re-export) / `part` / `part of` URIs; `package:` URIs via every `pubspec.yaml` `name:` (monorepos included); `dart:` SDK URIs filtered; `as` prefixes and `show` combinators become named bindings; heritage covers `extends` / `with` (mixin) / `implements` / mixin `on` constraints; Flutter route tables (`MaterialApp(routes:)`, `GoRoute` / `MaterialPageRoute` builders) and `runApp()` emit framework edges; the regex tier below stays as the no-grammar fallback |### Config / Data@@ -172,7 +174,6 @@ honest file-to-file dependencies, no symbol-level claims.| Language | Extensions | Import Forms Resolved ||----------|-----------|----------------------|| **Elixir** | `.ex` `.exs` | `alias` / `import` / `use` / `require` (incl. `Foo.{Bar, Baz}` brace groups) -> `defmodule` index + Mix `lib/` path convention (umbrella `apps/*/lib` included); Elixir/OTP stdlib filtered after local-miss |-| **Dart** | `.dart` | `import` / `export` (re-export) / `part` / `part of` URIs; `package:` URIs via every `pubspec.yaml` `name:` (monorepos included); `dart:` SDK URIs filtered; foreign packages -> `external:pub:<name>` || **Clojure** | `.clj` `.cljc` `.cljs` | `(:require …)` / `(:use …)` vectors and bare specs (string/comment-safe) -> `(ns …)` index + classpath convention (dashes ↔ underscores); `clojure.*`/`cljs.*` filtered || **Haskell** | `.hs` `.lhs` | `import [safe] [qualified] ["pkg"] Foo.Bar` -> `module` declaration index + trailing-PascalCase path inverse (handles any hs-source-dirs without parsing `.cabal`); base-ish namespaces filtered after local-miss || **Erlang** | `.erl` `.hrl` | `-include` / `-include_lib` / `-behaviour` + module-qualified calls (`mod:fun(`) -> `-module()` index; qualified calls are strict local-hit-or-drop (never mint externals) |@@ -278,7 +279,9 @@ Extension/filename -> LanguageTag (via LanguageRegistry)Go: go.mod module path strippingRust: crate::/self::/super::, mod.rs probingC/C++: compile_commands.json include directories- Lightweight tier (Elixir/Dart/Clojure/Haskell/Erlang/F#/dbt SQL):+ Dart: package:/dart:/relative URIs via the pubspec name map ++ library-name index (dotted part-of)+ Lightweight tier (Elixir/Clojure/Haskell/Erlang/F#/dbt SQL):regex-extracted imports vs a declared-module-name index(dbt: ref()/source() vs a per-project model-name index)Other: stem-map fallback (filename matching)@@ -565,6 +568,7 @@ findings.| Go | Y | Y | resource_construction, lock | `defer_in_loop`, `regex_compile_in_loop` | --- (goroutines) || C# | Y | Y | resource_construction, lock, serial_await | --- (.NET caches regexes) | `blocking_sync_in_async` (`.Result` / `.Wait()` / `.GetResult()`) || Rust | Y | --- (`String` is amortized) | resource_construction, serial_await | `regex_compile_in_loop` (`Regex::new`) | `blocking_sync_in_async` (`block_on` / `std::thread::sleep` / sync `std::fs` in `async fn`) |+| Dart | Y | Y | resource_construction, serial_await | --- | --- || Kotlin / C++ | --- | --- | --- | --- | --- |The Rust dialect classifies `sqlx` executor verbs (db), `reqwest::get` /@@ -696,7 +700,7 @@ edits. The current coverage:| Language | Target Tier | Status ||----------|------------|--------|-| Dart | Good | Lightweight tier shipped; AST upgrade planned (`tree-sitter-dart` available) |+| Dart | Good | Shipped: tree-sitter AST (symbols, calls, bindings, heritage), health control-flow + class facts, perf dialect (io/await/concat/resource in loop), Flutter route + `runApp` framework edges; next: riverpod/get_it dynamic hints, dataflow dialect || Elixir | Good | Lightweight tier shipped; AST upgrade planned (`tree-sitter-elixir` available) || F# | Good | Lightweight tier shipped; AST upgrade planned (`tree-sitter-f-sharp` available) || SQL / dbt | -- | DDL symbols, dbt lineage, app-to-database contracts (workspace `data` extractor), and precision-gated health markers all shipped; next: column-level blast radius |diff --git a/packages/core/src/repowise/core/analysis/dead_code/constants.py b/packages/core/src/repowise/core/analysis/dead_code/constants.pyindex 2dfbd6070..fe5c768af 100644--- a/packages/core/src/repowise/core/analysis/dead_code/constants.py+++ b/packages/core/src/repowise/core/analysis/dead_code/constants.py@@ -746,6 +746,29 @@ _NEVER_FLAG_PATTERNS: tuple[str, ...] = ("*ServiceGrpc.java","*OuterClass.java", # protoc generated outer class"*$WrapperImpl.java",+ # ---- Dart / Flutter conventions ---------------------------------------+ # build_runner codegen outputs — linked from their source file via+ # ``part`` directives, regenerated by tooling, never hand-imported.+ "*.g.dart",+ "*.freezed.dart", # freezed data classes+ "*.gr.dart", # auto_route generated router+ "*.config.dart", # injectable DI config+ "*.mocks.dart", # mockito codegen+ "*.gen.dart", # flutter_gen assets+ # package:test / integration_test runners execute these directly; no+ # static importer exists. ``example/`` is pub.dev's showcase convention.+ "*_test.dart",+ "*/integration_test/*",+ "*/test_driver/*",+ "*/example/*.dart",+ # pub executables / repo tooling / benchmark harnesses are run directly+ # (``dart run``), never imported (shelf live review).+ "bin/*.dart",+ "*/bin/*.dart",+ "*/tool/*.dart",+ "*/benchmark/*.dart",+ # build_runner wires lib/builder.dart in via build.yaml, not imports.+ "*/lib/builder.dart",)# Decorator patterns that indicate framework usage (route handlers, fixtures, etc.)diff --git a/packages/core/src/repowise/core/analysis/health/complexity/ast_utils.py b/packages/core/src/repowise/core/analysis/health/complexity/ast_utils.pyindex 7ea09accb..fdf232d59 100644--- a/packages/core/src/repowise/core/analysis/health/complexity/ast_utils.py+++ b/packages/core/src/repowise/core/analysis/health/complexity/ast_utils.py@@ -107,8 +107,31 @@ def _is_test_suite_callback(node: Node, lmap: LanguageNodeMap) -> bool:return any(part in _TEST_SUITE_CALLBACK_CALLEES for part in callee_text.split("."))+def _dart_signature_sibling(body: Node) -> Node | None:+ """Resolve a Dart ``function_body`` back to its signature node.++ Dart's grammar splits a function into a signature node and a SIBLING+ ``function_body`` (class members additionally wrap the signature in a+ ``method_signature``); the name and parameter list live on the signature.+ Returns ``None`` when the preceding sibling is not a signature shape, so+ non-Dart callers are unaffected (no other mapped grammar collects+ ``function_body`` nodes).+ """+ sib = body.prev_named_sibling+ if sib is None or not sib.type.endswith("_signature"):+ return None+ if sib.type == "method_signature":+ inner = next((c for c in sib.children if c.is_named), None)+ return inner or sib+ return sib++def _find_function_entry_name(node: Node, lmap: LanguageNodeMap) -> str:if node.type not in lmap.lambda_kinds:+ if node.type == "function_body":+ sig = _dart_signature_sibling(node)+ if sig is not None:+ return _find_name(sig)return _find_name(node)assigned = _find_assigned_lambda_name(node)if assigned:@@ -154,6 +177,13 @@ def _count_parameters(fn_node: Node) -> int:if child.type in ("parameters", "parameter_list", "formal_parameters"):params = childbreak+ if params is None and fn_node.type == "function_body":+ # Dart: the parameter list lives on the preceding signature sibling.+ sig = _dart_signature_sibling(fn_node)+ if sig is not None:+ params = next(+ (c for c in sig.children if c.type == "formal_parameter_list"), None+ )if params is None:return 0count = 0diff --git a/packages/core/src/repowise/core/analysis/health/complexity/languages.py b/packages/core/src/repowise/core/analysis/health/complexity/languages.pyindex b323bc79e..071aa7ddc 100644--- a/packages/core/src/repowise/core/analysis/health/complexity/languages.py+++ b/packages/core/src/repowise/core/analysis/health/complexity/languages.py@@ -441,6 +441,50 @@ _KOTLIN = LanguageNodeMap(assert_call_kinds=frozenset({"call_expression"}),)+_DART = LanguageNodeMap(+ # Dart splits a function into a ``function_signature`` node whose body is+ # a SIBLING ``function_body`` node (members wrap the signature in+ # ``method_signature``). Keying ``function_kinds`` on the body measures+ # complexity/NLOC exactly right with the shared walker; the entry name+ # and parameter count come from the preceding signature sibling (see the+ # ``function_body`` handling in ``ast_utils`` / ``perf_walk``).+ function_kinds=frozenset({"function_body"}),+ lambda_kinds=frozenset({"function_expression"}),+ # ``if_element`` is the collection-literal ``if`` (``[if (x) y]``);+ # ``conditional_expression`` is the ternary.+ branch_kinds=frozenset({"if_statement", "conditional_expression", "if_element"}),+ loop_kinds=frozenset(+ {"for_statement", "while_statement", "do_statement", "for_element"}+ ),+ try_kinds=frozenset({"try_statement"}),+ # A bare ``on FormatException {}`` arm without ``catch`` has no+ # catch_clause node (the block hangs off try_statement directly), so it+ # is undercounted — the safe direction.+ catch_kinds=frozenset({"catch_clause"}),+ switch_kinds=frozenset({"switch_statement", "switch_expression"}),+ case_kinds=frozenset(+ {"switch_statement_case", "switch_statement_default", "switch_expression_case"}+ ),+ # The grammar exposes dedicated operator nodes inside+ # logical_and_expression / logical_or_expression — one node per operator+ # occurrence, so no binary-node text sniffing is needed.+ boolean_operator_kinds=frozenset({"logical_and_operator", "logical_or_operator"}),+ # Method/size/CCN class facts only. Dart has no wrapper node for+ # ``this.member`` (receiver and ``.member`` selector are flat siblings)+ # and idiomatic Dart omits ``this.`` anyway, so member access stays+ # unmapped and LCOM4 sits at its "no signal" safety valve rather than+ # mis-firing on every class.+ class_kinds=frozenset({"class_definition", "mixin_declaration"}),+ self_identifiers=frozenset({"this"}),+ # ``assert(...)`` is a real statement in Dart. package:test ``expect()``+ # calls have no call-expression node type to key on (calls are selector+ # chains), so assertion-call runs are not counted — under-signal, safe.+ assert_kinds=frozenset({"assert_statement"}),+ # Calls are ``selector`` nodes carrying an ``argument_part``; the Dart+ # perf dialect's callee extraction filters out the non-call selectors.+ call_kinds=frozenset({"selector"}),+)+_CPP = LanguageNodeMap(function_kinds=frozenset({"function_definition"}),lambda_kinds=frozenset({"lambda_expression"}),@@ -504,6 +548,7 @@ LANGUAGE_MAPS: dict[str, LanguageNodeMap] = {"kotlin": _KOTLIN,"cpp": _CPP,"csharp": _CSHARP,+ "dart": _DART,}diff --git a/packages/core/src/repowise/core/analysis/health/complexity/perf_walk.py b/packages/core/src/repowise/core/analysis/health/complexity/perf_walk.pyindex 3789f7fec..3b9830a25 100644--- a/packages/core/src/repowise/core/analysis/health/complexity/perf_walk.py+++ b/packages/core/src/repowise/core/analysis/health/complexity/perf_walk.py@@ -89,6 +89,14 @@ _LOCK_BODY_KINDS = frozenset({"block", "statement_block", "compound_statement"})def _perf_func_name(node: Node) -> str | None:+ if node.type == "function_body":+ # Dart: the name lives on the preceding signature sibling.+ from .ast_utils import _dart_signature_sibling, _find_name++ sig = _dart_signature_sibling(node)+ if sig is not None:+ name = _find_name(sig)+ return name if name and name != "<anonymous>" else Nonenm = node.child_by_field_name("name")if nm is not None and nm.text:return nm.text.decode("utf-8", "replace")diff --git a/packages/core/src/repowise/core/analysis/health/perf/dialects/__init__.py b/packages/core/src/repowise/core/analysis/health/perf/dialects/__init__.pyindex 837d5cee8..8983ee79e 100644--- a/packages/core/src/repowise/core/analysis/health/perf/dialects/__init__.py+++ b/packages/core/src/repowise/core/analysis/health/perf/dialects/__init__.py@@ -15,6 +15,7 @@ No edits to the walker. A language absent here ⇒ the perf pass is silent for ifrom __future__ import annotationsfrom . import csharp as _csharp+from . import dart as _dartfrom . import go as _gofrom . import java as _javafrom . import python as _python@@ -35,6 +36,7 @@ _REGISTER: tuple[tuple[str, BasePerfDialect], ...] = (("go", _go.DIALECT),("csharp", _csharp.DIALECT),("rust", _rust.DIALECT),+ ("dart", _dart.DIALECT),)for _tag, _dialect in _REGISTER:diff --git a/packages/core/src/repowise/core/analysis/health/perf/dialects/dart.py b/packages/core/src/repowise/core/analysis/health/perf/dialects/dart.pynew file mode 100644index 000000000..4ecb21639--- /dev/null+++ b/packages/core/src/repowise/core/analysis/health/perf/dialects/dart.py@@ -0,0 +1,279 @@+"""Dart perf dialect.++Dart has no call-expression node: a call is a ``selector`` node carrying an+``argument_part``, chained flat after the receiver (``client.get(u)`` parses+as ``identifier selector(.get) selector((u))``). ``call_kinds`` therefore+routes every ``selector`` here, and the callee extraction returns ``None``+for selectors without an ``argument_part`` so plain member accesses produce+no signal.++Markers (precision-first, matching the walker's shared shapes):++- ``io_in_loop`` / ``serial_await_in_loop`` — http/dio verbs, ``File``+ ``readAs*``/``writeAs*``, sqflite ``raw*`` (+ ``query``/``execute`` gated+ on a db import), ``Process.run``. Dart is async-heavy, so the awaited+ serial round-trip is the highest-value marker.+- ``string_concat_in_loop`` — Dart strings are immutable; ``s += ...`` in a+ loop is a real O(n^2) accumulation (StringBuffer is the fix). A target+ declared fresh inside the loop body is excluded (shelf FP, live-reviewed).+- ``resource_construction_in_loop`` — ``HttpClient()`` / ``Dio()`` /+ ``http.Client()`` built per-iteration.+"""++from __future__ import annotations++from typing import TYPE_CHECKING++from .base import BasePerfDialect++if TYPE_CHECKING:+ from tree_sitter import Node++_HTTP_VERBS: frozenset[str] = frozenset(+ {"get", "post", "put", "delete", "patch", "head", "read", "readBytes"}+)+# package:dio adds its own verbs on top of the shared HTTP set.+_DIO_EXTRA: frozenset[str] = frozenset({"request", "download", "fetch"})+# dart:io File round-trips — method names unique enough to fire without a+# receiver type (nothing but a file handle has readAsString).+_FILE_METHODS: frozenset[str] = frozenset(+ {+ "readAsString",+ "readAsStringSync",+ "readAsBytes",+ "readAsBytesSync",+ "readAsLines",+ "readAsLinesSync",+ "writeAsString",+ "writeAsStringSync",+ "writeAsBytes",+ "writeAsBytesSync",+ "openRead",+ "openWrite",+ }+)+# sqflite raw statements — unambiguous db round-trips.+_DB_RAW_METHODS: frozenset[str] = frozenset({"rawQuery", "rawInsert", "rawUpdate", "rawDelete"})+# Generic executor verbs — only db when the file imports a db package.+_DB_AMBIGUOUS_METHODS: frozenset[str] = frozenset({"query", "execute"})+_SUBPROC_METHODS: frozenset[str] = frozenset({"run", "runSync", "start"})+# Per-iteration heavy-client constructions.+_RESOURCE_CTORS: frozenset[str] = frozenset({"HttpClient", "Dio"})++_LITERAL_KINDS: frozenset[str] = frozenset(+ {+ "decimal_integer_literal",+ "decimal_floating_point_literal",+ "string_literal",+ "true",+ "false",+ }+)+++class DartPerfDialect(BasePerfDialect):+ language = "dart"+ markers = frozenset(+ {+ "io_in_loop",+ "serial_await_in_loop",+ "string_concat_in_loop",+ "resource_construction_in_loop",+ }+ )+ string_literal_kinds = frozenset({"string_literal"})+ aug_assign_kinds = frozenset({"assignment_expression"})++ # -- callee extraction over selector chains -------------------------------++ @staticmethod+ def _chain(call_node: Node) -> tuple[list[Node], int]:+ """Named siblings of the selector chain + this node's index in it."""+ parent = call_node.parent+ if parent is None:+ return [], -1+ sibs = [c for c in parent.children if c.is_named]+ for i, sib in enumerate(sibs):+ if sib == call_node:+ return sibs, i+ return [], -1++ @staticmethod+ def _selector_member(node: Node) -> str | None:+ """``.name`` selector -> 'name', else None."""+ if node.type != "selector":+ return None+ for child in node.children:+ if child.type in (+ "unconditional_assignable_selector",+ "conditional_assignable_selector",+ ):+ for sub in child.children:+ if sub.type == "identifier" and sub.text:+ return sub.text.decode("utf-8", "replace")+ return None++ @staticmethod+ def _is_call_selector(node: Node) -> bool:+ return node.type == "selector" and any(c.type == "argument_part" for c in node.children)++ def callee_method_name(self, call_node: Node) -> str | None:+ if not self._is_call_selector(call_node):+ return None+ sibs, idx = self._chain(call_node)+ if idx <= 0:+ return None+ prev = sibs[idx - 1]+ member = self._selector_member(prev)+ if member is not None:+ return member+ if prev.type == "identifier" and prev.text:+ # Bare call: ``foo(args)`` / constructor ``HttpClient()``.+ return prev.text.decode("utf-8", "replace")+ return None++ def callee_root_name(self, call_node: Node) -> str | None:+ if not self._is_call_selector(call_node):+ return None+ sibs, idx = self._chain(call_node)+ if idx <= 0:+ return None+ head = sibs[0]+ if head.type == "identifier" and head.text:+ return head.text.decode("utf-8", "replace")+ if head.type == "this":+ return "this"+ return None++ def callee_is_attribute(self, call_node: Node) -> bool:+ sibs, idx = self._chain(call_node)+ if idx <= 0:+ return False+ return self._selector_member(sibs[idx - 1]) is not None++ # -- sink classification ---------------------------------------------------++ def sink_kind(+ self,+ root: str,+ method: str,+ *,+ awaited: bool,+ is_attribute: bool,+ io_names: dict[str, str],+ has_db_import: bool,+ ) -> str | None:+ if not method:+ return None+ if method in _FILE_METHODS:+ return "filesystem"+ if method in _DB_RAW_METHODS:+ return "db"+ if root == "Process" and method in _SUBPROC_METHODS:+ return "subprocess"+ if is_attribute and method in (_HTTP_VERBS | _DIO_EXTRA):+ root_kind = io_names.get(root)+ if root_kind == "network" or root in ("http", "dio"):+ return "network"+ if is_attribute and has_db_import and method in _DB_AMBIGUOUS_METHODS:+ return "db"+ return None++ # -- loop predicates -------------------------------------------------------++ def is_constant_loop(self, node: Node) -> bool:+ """``for (var i = 0; i < 3; i++)`` and ``for (x in [1, 2])`` are not+ data-dependent — mirror the Python range-literal skip."""+ if node.type != "for_statement":+ return False+ parts = next((c for c in node.children if c.type == "for_loop_parts"), None)+ if parts is None:+ return False+ value = parts.child_by_field_name("value")+ if value is not None:+ return value.type in ("list_literal", "set_or_map_literal") and all(+ (not c.is_named) or c.type in _LITERAL_KINDS for c in value.children+ )+ rel = next((c for c in parts.children if c.type == "relational_expression"), None)+ if rel is not None:+ return any(c.type == "decimal_integer_literal" for c in rel.children)+ return False++ def loop_iterable_name(self, node: Node) -> str | None:+ if node.type != "for_statement":+ return None+ parts = next((c for c in node.children if c.type == "for_loop_parts"), None)+ if parts is None:+ return None+ return self._dotted_path(parts.child_by_field_name("value"))++ # -- extra markers ---------------------------------------------------------++ def loop_call_marker(+ self, root: str, method: str, node: Node, list_names: frozenset[str]+ ) -> str | None:+ if method in _RESOURCE_CTORS and not self.callee_is_attribute(node):+ return "resource_construction_in_loop"+ if root == "http" and method == "Client":+ return "resource_construction_in_loop"+ return None++ def is_string_concat(self, node: Node) -> bool:+ """Base check plus a reset gate: ``var name = ...; name += '/'``+ inside one iteration is not a cross-iteration accumulator (mirrors+ the Python dialect's ``_resets_name``)."""+ if not super().is_string_concat(node):+ return False+ target = next((c for c in node.children if c.is_named), None)+ if target is None or target.text is None:+ return True+ name = target.text.decode("utf-8", "replace")+ loop = node.parent+ for _ in range(32):+ if loop is None:+ return True+ if loop.type in ("for_statement", "while_statement", "do_statement"):+ break+ loop = loop.parent+ body = loop.child_by_field_name("body")+ if body is None:+ return True+ stack = list(body.children)+ while stack:+ cur = stack.pop()+ if cur.type == "local_variable_declaration":+ decl_id = next(+ (+ d+ for c in cur.children+ if c.type == "initialized_variable_definition"+ for d in c.children+ if d.type == "identifier"+ ),+ None,+ )+ if (+ decl_id is not None+ and decl_id.text is not None+ and decl_id.text.decode("utf-8", "replace") == name+ ):+ return False # declared fresh every iteration+ stack.extend(cur.children)+ return True++ def _rhs_is_stringish(self, node: Node) -> bool:+ """Dart's ``assignment_expression`` exposes no ``right`` field — the+ RHS is the last named child (possibly an ``additive_expression``+ concatenation)."""+ named = [c for c in node.children if c.is_named]+ if not named:+ return False+ right = named[-1]+ if right.type in self.string_literal_kinds:+ return True+ if right.type == "additive_expression":+ return any(c.type in self.string_literal_kinds for c in right.children)+ return False+++DIALECT = DartPerfDialect()diff --git a/packages/core/src/repowise/core/ingestion/external_systems/io_kind.py b/packages/core/src/repowise/core/ingestion/external_systems/io_kind.pyindex 7990b7228..e7d13212c 100644--- a/packages/core/src/repowise/core/ingestion/external_systems/io_kind.py+++ b/packages/core/src/repowise/core/ingestion/external_systems/io_kind.py@@ -64,6 +64,9 @@ _DB_NAMES: frozenset[str] = frozenset({# is already listed under the Go section above."diesel", "sea-orm", "sea_orm", "tokio-postgres", "tokio_postgres","rusqlite", "deadpool-postgres", "deadpool_postgres", "scylla", "bb8",+ # Dart / Flutter (pub package names; ``package:sqflite/...`` resolves via+ # the interior segment).+ "sqflite", "postgres", "mysql1", "mongo_dart", "drift",})_NETWORK_NAMES: frozenset[str] = frozenset({@@ -82,6 +85,9 @@ _NETWORK_NAMES: frozenset[str] = frozenset({"system.net.http", "grpc.net.client", "restsharp", "flurl",# Rust (HTTP / gRPC client crates as imported)."reqwest", "hyper", "isahc", "surf", "ureq", "awc", "tonic",+ # Dart / Flutter (``package:http`` doubles as Node's stdlib ``http`` —+ # both are network boundaries).+ "http", "dio", "chopper",})_FILESYSTEM_NAMES: frozenset[str] = frozenset({@@ -95,6 +101,9 @@ _FILESYSTEM_NAMES: frozenset[str] = frozenset({"io/ioutil",# .NET"system.io",+ # Dart (``dart:io`` hosts File/Directory; Process is method-gated in the+ # perf dialect rather than classified wholesale as subprocess).+ "dart:io",})_SUBPROCESS_NAMES: frozenset[str] = frozenset({diff --git a/packages/core/src/repowise/core/ingestion/extractors/bindings/__init__.py b/packages/core/src/repowise/core/ingestion/extractors/bindings/__init__.pyindex 738b9debc..6847eeb0e 100644--- a/packages/core/src/repowise/core/ingestion/extractors/bindings/__init__.py+++ b/packages/core/src/repowise/core/ingestion/extractors/bindings/__init__.py@@ -23,6 +23,7 @@ from tree_sitter import Nodefrom ...models import NamedBindingfrom .cpp import extract_cpp_bindingsfrom .csharp import extract_csharp_bindings+from .dart import extract_dart_bindingsfrom .go import extract_go_bindingsfrom .java import extract_java_bindingsfrom .kotlin import extract_kotlin_bindings@@ -47,6 +48,7 @@ _DISPATCH: dict[str, Callable[[Node, str], tuple[list[str], list[NamedBinding]]]"kotlin": extract_kotlin_bindings,"ruby": extract_ruby_bindings,"csharp": extract_csharp_bindings,+ "dart": extract_dart_bindings,"swift": extract_swift_bindings,"scala": extract_scala_bindings,"php": extract_php_bindings,@@ -66,6 +68,7 @@ def extract_import_bindings(__all__ = ["extract_cpp_bindings","extract_csharp_bindings",+ "extract_dart_bindings","extract_go_bindings","extract_import_bindings","extract_java_bindings",diff --git a/packages/core/src/repowise/core/ingestion/extractors/bindings/dart.py b/packages/core/src/repowise/core/ingestion/extractors/bindings/dart.pynew file mode 100644index 000000000..1bea580fb--- /dev/null+++ b/packages/core/src/repowise/core/ingestion/extractors/bindings/dart.py@@ -0,0 +1,67 @@+"""Dart import binding extraction.++Handles the three shapes that bind names into the importing library:++- ``import 'x.dart' as prefix;`` — a module-alias binding; calls resolve+ through ``prefix.foo()``.+- ``import 'x.dart' show A, B;`` — one named binding per shown name.+- ``import 'x.dart' hide A;`` — narrows the namespace but binds nothing+ nameable, so it contributes no named bindings.++A Dart import without a ``show`` combinator brings the target's WHOLE+namespace into scope (there is no per-name import form), so+``imported_names`` is the wildcard ``["*"]`` in every non-``show`` shape —+otherwise the unused-export pass reads every plainly-imported symbol as+dead. ``export`` re-exports and ``part``/``part of`` (same-library splits)+are wildcards for the same reason.+"""++from __future__ import annotations++from tree_sitter import Node++from ...models import NamedBinding+from ..helpers import node_text+++def extract_dart_bindings(stmt_node: Node, src: str) -> tuple[list[str], list[NamedBinding]]:+ if stmt_node.type in ("part_directive", "part_of_directive"):+ return ["*"], []+ if stmt_node.type not in ("import_specification", "library_export"):+ return [], []++ shown: list[str] = []+ bindings: list[NamedBinding] = []+ children = stmt_node.children+ for i, child in enumerate(children):+ if child.type == "identifier" and i > 0 and children[i - 1].type == "as":+ prefix = node_text(child, src)+ if prefix:+ bindings.append(+ NamedBinding(+ local_name=prefix,+ exported_name=None,+ source_file=None,+ is_module_alias=True,+ )+ )+ elif child.type == "combinator":+ kids = child.children+ if not kids or kids[0].type != "show":+ continue # ``hide`` still exposes the rest of the namespace+ for sub in kids:+ if sub.type == "identifier":+ name = node_text(sub, src)+ if name:+ shown.append(name)+ bindings.append(+ NamedBinding(+ local_name=name,+ exported_name=name,+ source_file=None,+ )+ )+ # ``show`` narrows the namespace to the listed names; every other shape+ # (plain, ``as`` prefix, ``hide``) is a whole-namespace import.+ names = shown if shown else ["*"]+ return names, bindingsdiff --git a/packages/core/src/repowise/core/ingestion/extractors/heritage/__init__.py b/packages/core/src/repowise/core/ingestion/extractors/heritage/__init__.pyindex cff6d7250..5d94a6e26 100644--- a/packages/core/src/repowise/core/ingestion/extractors/heritage/__init__.py+++ b/packages/core/src/repowise/core/ingestion/extractors/heritage/__init__.py@@ -23,6 +23,7 @@ from ...models import HeritageRelationfrom ..helpers import node_textfrom .cpp import _extract_cpp_heritagefrom .csharp import _extract_csharp_heritage+from .dart import _extract_dart_heritagefrom .go import _extract_go_heritagefrom .java import _extract_java_heritagefrom .kotlin import _extract_kotlin_heritage@@ -53,6 +54,7 @@ HERITAGE_EXTRACTORS: dict[str, Callable[..., None]] = {"kotlin": _extract_kotlin_heritage,"ruby": _extract_ruby_heritage,"csharp": _extract_csharp_heritage,+ "dart": _extract_dart_heritage,"swift": _extract_swift_heritage,"scala": _extract_scala_heritage,"php": _extract_php_heritage,diff --git a/packages/core/src/repowise/core/ingestion/extractors/heritage/dart.py b/packages/core/src/repowise/core/ingestion/extractors/heritage/dart.pynew file mode 100644index 000000000..9881988ee--- /dev/null+++ b/packages/core/src/repowise/core/ingestion/extractors/heritage/dart.py@@ -0,0 +1,52 @@+"""Dart heritage extraction.++A single ``class_definition`` header can carry all three clause kinds:+``class Foo extends Bar with M1, M2 implements IFoo`` — the grammar nests+the ``with`` mixins inside the ``superclass`` node. ``mixin M on Base``+constrains the mixin to subtypes of ``Base``; that is recorded as+``extends`` (the closest semantic: members of ``Base`` are in scope).+"""++from __future__ import annotations++from tree_sitter import Node++from ...models import HeritageRelation+from ..helpers import node_text+++def _append(out: list[HeritageRelation], name: str, parent: str, kind: str, line: int) -> None:+ if parent and parent != name:+ out.append(+ HeritageRelation(+ child_name=name,+ parent_name=parent,+ kind=kind, # type: ignore[arg-type]+ line=line,+ )+ )+++def _extract_dart_heritage(+ def_node: Node, name: str, line: int, src: str, out: list[HeritageRelation]+) -> None:+ if def_node.type == "class_definition":+ for child in def_node.children:+ if child.type == "superclass":+ for sub in child.children:+ if sub.type == "type_identifier":+ _append(out, name, node_text(sub, src).strip(), "extends", line)+ elif sub.type == "mixins":+ for mixin in sub.children:+ if mixin.type == "type_identifier":+ _append(out, name, node_text(mixin, src).strip(), "mixin", line)+ elif child.type == "interfaces":+ for sub in child.children:+ if sub.type == "type_identifier":+ _append(out, name, node_text(sub, src).strip(), "implements", line)+ elif def_node.type == "mixin_declaration":+ # ``mixin M on Base`` — the ``on`` constraint types are direct+ # type_identifier children of the declaration.+ for child in def_node.children:+ if child.type == "type_identifier":+ _append(out, name, node_text(child, src).strip(), "extends", line)diff --git a/packages/core/src/repowise/core/ingestion/extractors/visibility.py b/packages/core/src/repowise/core/ingestion/extractors/visibility.pyindex d2e62822e..eec9197a4 100644--- a/packages/core/src/repowise/core/ingestion/extractors/visibility.py+++ b/packages/core/src/repowise/core/ingestion/extractors/visibility.py@@ -100,6 +100,11 @@ def swift_visibility(_name: str, modifier_texts: list[str]) -> str:return "internal" # Swift default is internal+def dart_visibility(name: str, _mods: list[str]) -> str:+ """Dart visibility is name-based: a leading underscore is library-private."""+ return "private" if name.startswith("_") else "public"++def scala_visibility(_name: str, modifier_texts: list[str]) -> str:"""Scala visibility — public/private/protected, default public."""combined = " ".join(modifier_texts).lower()diff --git a/packages/core/src/repowise/core/ingestion/framework_edges/__init__.py b/packages/core/src/repowise/core/ingestion/framework_edges/__init__.pyindex 0e3dd200f..d96ff3d2d 100644--- a/packages/core/src/repowise/core/ingestion/framework_edges/__init__.py+++ b/packages/core/src/repowise/core/ingestion/framework_edges/__init__.py@@ -24,6 +24,7 @@ from . import (express,fastapi,flask,+ flutter,go,gtest,hono,@@ -63,6 +64,7 @@ _HANDLERS: list[FrameworkHandler] = [*quarkus.HANDLERS,*micronaut.HANDLERS,*android_manifest.HANDLERS,+ *flutter.HANDLERS,*express.HANDLERS,*next_app.HANDLERS,*hono.HANDLERS,diff --git a/packages/core/src/repowise/core/ingestion/framework_edges/flutter.py b/packages/core/src/repowise/core/ingestion/framework_edges/flutter.pynew file mode 100644index 000000000..fd43e9bcf--- /dev/null+++ b/packages/core/src/repowise/core/ingestion/framework_edges/flutter.py@@ -0,0 +1,120 @@+"""Flutter navigation edges.++Flutter wires screens together through route tables and builder callbacks+rather than direct imports of a call site — a widget referenced only from+``MaterialApp(routes: {...})`` or a ``GoRoute(builder: ...)`` has no+in-source caller, so the dead-code pass would flag every page. Two shapes+cover the minimal viable set (DI/codegen frameworks like riverpod/get_it+are deliberately out of scope here — they need dynamic hints, not regex):++- Route tables and builders: ``'/cart': (context) => CartPage()`` and+ ``GoRoute(builder: (context, state) => DetailsPage(...))`` /+ ``MaterialPageRoute(builder: (context) => EditPage())`` — edge from the+ route-owning file to the page widget's defining file.+- ``runApp(MyApp())`` — edge to the root widget's file, which is also+ stamped ``is_entry_point``.+"""++from __future__ import annotations++import re+from typing import TYPE_CHECKING, Any++from ..resolvers import ResolverContext+from .base import (+ DetectionContext,+ FrameworkHandler,+ _add_edge_if_new,+ _build_class_to_file,+ read_text,+)++if TYPE_CHECKING:+ import networkx as nx++# '/route': (context) => CartPage( — MaterialApp/CupertinoApp routes maps.+_ROUTE_ENTRY_RE = re.compile(+ r"""['"]/[\w/:\-]*['"]\s*:\s*\([^)]*\)\s*=>\s*(?:const\s+)?([A-Z]\w*)\s*\("""+)+# GoRoute / MaterialPageRoute / CupertinoPageRoute / showDialog builders —+# arrow form (=> EditPage(...)) and single-return block form+# ({ ... return EditPage(...); }, no nested braces before the return).+_BUILDER_ARROW_RE = re.compile(+ r"""(?:page)?[bB]uilder\s*:\s*\([^)]*\)\s*=>\s*(?:const\s+)?([A-Z]\w*)\s*\("""+)+_BUILDER_BLOCK_RE = re.compile(+ r"""(?:page)?[bB]uilder\s*:\s*\([^)]*\)\s*\{[^{}]*?return\s+(?:const\s+)?([A-Z]\w*)\s*\(""",+ re.S,+)+# runApp(...) — the root widget may be wrapped (MultiProvider(child: MainApp()));+# collect every constructor-looking name in the argument window and let the+# local class map decide which are this repo's widgets.+_RUNAPP_RE = re.compile(r"""runApp\s*\(""")+_CTOR_NAME_RE = re.compile(r"""([A-Z]\w*)\s*\(""")+_RUNAPP_WINDOW = 400+++def _uses_flutter(parsed_files: dict[str, Any]) -> bool:+ for parsed in parsed_files.values():+ if parsed.file_info.language != "dart":+ continue+ for imp in parsed.imports:+ if imp.module_path.startswith(("package:flutter/", "package:go_router/")):+ return True+ return False+++def _add_flutter_edges(+ graph: nx.DiGraph,+ parsed_files: dict[str, Any],+ ctx: ResolverContext,+ path_set: set[str],+) -> int:+ count = 0+ class_to_file = _build_class_to_file(parsed_files, ("dart",))++ for path, parsed in parsed_files.items():+ if parsed.file_info.language != "dart":+ continue+ text = read_text(parsed)+ if not text:+ continue++ entry_widgets: set[str] = set()+ for m in _RUNAPP_RE.finditer(text):+ window = text[m.end() : m.end() + _RUNAPP_WINDOW]+ entry_widgets |= set(_CTOR_NAME_RE.findall(window))+ routed_widgets = {m.group(1) for m in _ROUTE_ENTRY_RE.finditer(text)}+ routed_widgets |= {m.group(1) for m in _BUILDER_ARROW_RE.finditer(text)}+ routed_widgets |= {m.group(1) for m in _BUILDER_BLOCK_RE.finditer(text)}+ routed_widgets |= entry_widgets++ for widget in routed_widgets:+ target = class_to_file.get(widget)+ if target is None or target not in path_set:+ continue+ if _add_edge_if_new(graph, path, target):+ count += 1+ if widget in entry_widgets:+ node = graph.nodes.get(target)+ if node is not None:+ node["is_entry_point"] = True++ return count+++class _FlutterHandler:+ def detect(self, dctx: DetectionContext) -> bool:+ return _uses_flutter(dctx.parsed_files)++ def add_edges(+ self,+ graph: nx.DiGraph,+ parsed_files: dict[str, Any],+ ctx: ResolverContext,+ path_set: set[str],+ ) -> int:+ return _add_flutter_edges(graph, parsed_files, ctx, path_set)+++HANDLERS: list[FrameworkHandler] = [_FlutterHandler()]diff --git a/packages/core/src/repowise/core/ingestion/graph_warmups.py b/packages/core/src/repowise/core/ingestion/graph_warmups.pyindex 5bcf1442e..6421c4483 100644--- a/packages/core/src/repowise/core/ingestion/graph_warmups.py+++ b/packages/core/src/repowise/core/ingestion/graph_warmups.py@@ -330,6 +330,51 @@ def _warmup_typescript(ctx: ResolverContext) -> None:node["is_entry_point"] = True+_FLUTTER_SHELL_DIRS = ("android/", "ios/", "linux/", "macos/", "windows/", "web/")+++def _warmup_dart(ctx: ResolverContext) -> None:+ """Stamp Flutter platform-shell scaffolding as ``is_never_flag``.++ The ``android/`` / ``ios/`` / ``linux/`` / ``macos/`` / ``windows/`` /+ ``web/`` directories next to a ``pubspec.yaml`` are runner shells the+ ``flutter`` tool wires in at build time — no source import reaches+ them, so every MainActivity.kt / my_application.cc / win32_window.cpp+ reads as unreachable otherwise. A pure-Dart package has no shell+ directories, so the prefix test is a no-op there.+ """+ graph = getattr(ctx, "graph", None)+ if graph is None:+ return+ bases = [+ p[: -len("pubspec.yaml")]+ for p in getattr(ctx, "sorted_paths", ())+ if p.endswith("pubspec.yaml")+ ]+ if not bases:+ return+ prefixes = tuple(base + shell for base in bases for shell in _FLUTTER_SHELL_DIRS)+ parsed = getattr(ctx, "parsed_files", None) or {}+ for node_name in list(graph.nodes()):+ s = str(node_name)+ if s.startswith(prefixes):+ nd = graph.nodes.get(node_name)+ if nd is not None:+ nd["is_never_flag"] = True+ continue+ # Flutter flavor entrypoints (``flutter run -t lib/main_staging.dart``)+ # are prefix-shaped, which the traverser's exact/suffix entry-pattern+ # forms can't express — stamp them here instead.+ basename = s.rsplit("/", 1)[-1]+ if basename.startswith("main_") and basename.endswith(".dart"):+ nd = graph.nodes.get(node_name)+ if nd is not None:+ nd["is_entry_point"] = True+ pf = parsed.get(node_name)+ if pf is not None and getattr(pf, "file_info", None) is not None:+ pf.file_info.is_entry_point = True++# Map language tag → (phase-event name, warmup function). The phase# name shows up in the CLI progress bar and in ``state.json`` timings.#@@ -347,6 +392,7 @@ _WARMUPS: dict[str, tuple[str, Warmup]] = {"cpp": ("graph.cpp_index", _warmup_cpp),"c": ("graph.cpp_index", _warmup_cpp),"swift": ("graph.swift_entry", _warmup_swift),+ "dart": ("graph.dart_shells", _warmup_dart),}diff --git a/packages/core/src/repowise/core/ingestion/language_configs.py b/packages/core/src/repowise/core/ingestion/language_configs.pyindex c708c964a..05758f224 100644--- a/packages/core/src/repowise/core/ingestion/language_configs.py+++ b/packages/core/src/repowise/core/ingestion/language_configs.py@@ -14,6 +14,7 @@ from dataclasses import dataclass, fieldfrom .extractors.visibility import (csharp_visibility,+ dart_visibility,go_visibility,java_visibility,kotlin_visibility,@@ -277,6 +278,35 @@ LANGUAGE_CONFIGS: dict[str, LanguageConfig] = {parent_extraction="nesting",parent_class_types=frozenset({"class_declaration", "protocol_declaration"}),),+ "dart": LanguageConfig(+ symbol_node_types={+ "class_definition": "class",+ "mixin_declaration": "class",+ "enum_declaration": "enum",+ "extension_declaration": "class",+ "function_signature": "function",+ "getter_signature": "function",+ "setter_signature": "function",+ "type_alias": "type_alias",+ },+ import_node_types=[+ "import_specification",+ "library_export",+ "part_directive",+ "part_of_directive",+ ],+ export_node_types=[],+ visibility_fn=dart_visibility,+ parent_extraction="nesting",+ parent_class_types=frozenset(+ {+ "class_definition",+ "mixin_declaration",+ "extension_declaration",+ "enum_declaration",+ }+ ),+ ),"scala": LanguageConfig(symbol_node_types={"class_definition": "class",diff --git a/packages/core/src/repowise/core/ingestion/languages/specs/__init__.py b/packages/core/src/repowise/core/ingestion/languages/specs/__init__.pyindex 575b43b39..33a1e83db 100644--- a/packages/core/src/repowise/core/ingestion/languages/specs/__init__.py+++ b/packages/core/src/repowise/core/ingestion/languages/specs/__init__.py@@ -82,6 +82,7 @@ ALL_SPECS: tuple[LanguageSpec, ...] = (_PHP,_SWIFT,_SCALA,+ _DART,# -----------------------------------------------------------------# Config / data / markup languages (passthrough — no AST)# -----------------------------------------------------------------@@ -113,7 +114,6 @@ ALL_SPECS: tuple[LanguageSpec, ...] = (_ERLANG,_LUAU,_R,- _DART,_ZIG,_JULIA,_CLOJURE,diff --git a/packages/core/src/repowise/core/ingestion/languages/specs/dart.py b/packages/core/src/repowise/core/ingestion/languages/specs/dart.pyindex 33bd6abac..d7d289575 100644--- a/packages/core/src/repowise/core/ingestion/languages/specs/dart.py+++ b/packages/core/src/repowise/core/ingestion/languages/specs/dart.py@@ -5,12 +5,42 @@ from ..spec import LanguageSpecSPEC = LanguageSpec(tag="dart",display_name="Dart",+ import_support="full",# package:test convention: test/foo_test.dart.test_stem_suffixes=("_test",),+ # Flutter flavor entrypoints (main_development.dart / main_staging.dart,+ # run via ``flutter run -t``) are prefix-shaped, which the traverser's+ # pattern forms can't express — they are stamped in ``_warmup_dart``.entry_point_patterns=("main.dart",),manifest_files=("pubspec.yaml",),extensions=frozenset({".dart"}),- is_passthrough=True,- # Lightweight regex resolver: package:/relative URIs, part/part of, export.- import_support="partial",+ grammar_package="tree_sitter_dart",+ scm_file="dart.scm",+ heritage_node_types=frozenset({"class_definition", "mixin_declaration"}),+ builtin_calls=frozenset(+ {+ "print",+ "identical",+ "assert",+ "toString",+ "map",+ "where",+ "forEach",+ "add",+ "addAll",+ "contains",+ "setState",+ }+ ),+ builtin_parents=frozenset(+ {+ "Object",+ "Enum",+ "Comparable",+ "Iterable",+ "Exception",+ "Error",+ }+ ),+ color_hex="#0175C2",)diff --git a/packages/core/src/repowise/core/ingestion/models.py b/packages/core/src/repowise/core/ingestion/models.pyindex 7e148bcbb..72493c372 100644--- a/packages/core/src/repowise/core/ingestion/models.py+++ b/packages/core/src/repowise/core/ingestion/models.py@@ -34,6 +34,7 @@ LanguageTag = Literal["kotlin","scala","luau",+ "dart",# Passthrough code languages (no AST parser yet — empty ParsedFile,# files enter the graph via the generic resolver). Before these tags# existed the traverser silently skipped such files as unknown, so e.g.@@ -41,7 +42,6 @@ LanguageTag = Literal["elixir","erlang","clojure",- "dart","haskell","ocaml","fsharp",diff --git a/packages/core/src/repowise/core/ingestion/parser.py b/packages/core/src/repowise/core/ingestion/parser.pyindex 6342519b9..77b82dea4 100644--- a/packages/core/src/repowise/core/ingestion/parser.py+++ b/packages/core/src/repowise/core/ingestion/parser.py@@ -405,6 +405,36 @@ class ASTParser:):kind = refine_kotlin_class_kind(def_node)+ # Dart: a function is a ``function_signature`` whose BODY is a+ # sibling ``function_body`` node (members wrap the signature in+ # ``method_signature``). Two consequences the generic path can't+ # see: local functions nested inside another function's body have+ # no callable *ancestor* (the enclosing signature is a sibling),+ # so filter them here; and the symbol's line range must extend to+ # the trailing body sibling or call-site attribution stops at the+ # signature line.+ end_line = def_node.end_point[0] + 1+ if file_info.language == "dart" and node_type in (+ "function_signature",+ "getter_signature",+ "setter_signature",+ ):+ ancestor = def_node.parent+ is_local = False+ while ancestor is not None:+ if ancestor.type in ("function_body", "function_expression"):+ is_local = True+ break+ ancestor = ancestor.parent+ if is_local:+ continue+ anchor = def_node+ if def_node.parent is not None and def_node.parent.type == "method_signature":+ anchor = def_node.parent+ body_sibling = anchor.next_named_sibling+ if body_sibling is not None and body_sibling.type == "function_body":+ end_line = body_sibling.end_point[0] + 1+# Refine module-level assignments: SCREAMING_CASE names are# constants by convention; the rest are module variables# (singletons like ``app = FastAPI()``, registries, caches).@@ -450,6 +480,20 @@ class ASTParser:# Parent class detectionparent_name = self._find_parent(def_node, config, receiver_nodes, src)+ # Dart mixin_declaration exposes no ``name`` field, so+ # ``_find_parent``'s field lookup misses mixin members.+ if parent_name is None and file_info.language == "dart":+ ancestor = def_node.parent+ while ancestor is not None:+ if ancestor.type == "mixin_declaration":+ ident = next((c for c in ancestor.children if c.type == "identifier"), None)+ if ident is not None:+ parent_name = _node_text(ident, src)+ break+ if ancestor.type in config.parent_class_types:+ break+ ancestor = ancestor.parent+# C/C++ qualified definitions: ``void Foo::method() { … }``# carries the class as the scope of a ``qualified_identifier``# parent of the name node. Without this resolution, every@@ -486,7 +530,7 @@ class ASTParser:kind=kind, # type: ignore[arg-type]signature=signature,start_line=start_line,- end_line=def_node.end_point[0] + 1,+ end_line=end_line,docstring=docstring,decorators=[m for m in modifier_texts if m.startswith("@")] + rust_attrs,visibility=visibility, # type: ignore[arg-type]@@ -600,6 +644,31 @@ class ASTParser:)continue+ # Dart: URIs are relative unless schemed (``package:``/``dart:``),+ # ``export`` directives are barrel re-exports, and the legacy+ # dotted ``part of library.name;`` form resolves through the+ # library-name index (the ``library:`` prefix is the resolver's+ # contract, shared with the lightweight regex tier).+ if file_info.language == "dart":+ module_path = module_text+ if module_nodes[0].type == "dotted_identifier_list":+ module_path = f"library:{module_text}"+ imported_names, bindings = extract_import_bindings(+ stmt_node, src, file_info.language+ )+ imports.append(+ Import(+ raw_statement=raw,+ module_path=module_path,+ imported_names=imported_names,+ is_relative=not module_path.startswith(("package:", "dart:", "library:")),+ resolved_file=None,+ bindings=bindings,+ is_reexport=stmt_node.type == "library_export",+ )+ )+ continue+# CommonJS assignment / Object.assign shapes: the query captures# the outer statement once; walk it for every require() it# contains (a hub like Object.assign(module.exports,diff --git a/packages/core/src/repowise/core/ingestion/queries/dart.scm b/packages/core/src/repowise/core/ingestion/queries/dart.scmnew file mode 100644index 000000000..ca1c05fd1--- /dev/null+++ b/packages/core/src/repowise/core/ingestion/queries/dart.scm@@ -0,0 +1,134 @@+; =============================================================================+; repowise — Dart symbol, import, and call queries+; tree-sitter-dart (UserNobody14 grammar, PyPI tree-sitter-dart >= 0.1)+;+; Grammar quirk this file works around: a Dart function is a+; ``function_signature`` node whose body is a SIBLING ``function_body`` node+; (methods additionally wrap the signature in ``method_signature``). The+; signature node is captured as @symbol.def; the parser's Dart branch extends+; the symbol's end_line to the trailing body sibling.+; =============================================================================++; ---------------------------------------------------------------------------+; Symbols+; ---------------------------------------------------------------------------++(class_definition+ name: (identifier) @symbol.name+) @symbol.def++; mixin_declaration exposes no ``name`` field — the identifier child is the name.+(mixin_declaration+ (identifier) @symbol.name+) @symbol.def++(enum_declaration+ name: (identifier) @symbol.name+) @symbol.def++(extension_declaration+ name: (identifier) @symbol.name+) @symbol.def++; Top-level functions and methods (methods arrive wrapped in method_signature;+; both shapes share the function_signature node).+(function_signature+ name: (identifier) @symbol.name+ (formal_parameter_list) @symbol.params+) @symbol.def++(getter_signature+ (identifier) @symbol.name+) @symbol.def++(setter_signature+ (identifier) @symbol.name+) @symbol.def++; typedef Callback = void Function(int);+(type_alias+ (type_identifier) @symbol.name+) @symbol.def++; ---------------------------------------------------------------------------+; Imports — import / export / part / part of directives+; ---------------------------------------------------------------------------++; import 'package:http/http.dart' as http; / import 'src/util.dart' show a;+(import_specification+ (configurable_uri) @import.module+) @import.statement++; export 'src/api.dart'; — a barrel re-export (parser Dart branch sets+; is_reexport).+(library_export+ (configurable_uri) @import.module+) @import.statement++; part 'foo.g.dart';+(part_directive+ (uri) @import.module+) @import.statement++; part of 'lib.dart';+(part_of_directive+ (uri) @import.module+) @import.statement++; part of dotted.library.name; — resolved through the library-name index+; (parser Dart branch prefixes ``library:``).+(part_of_directive+ (dotted_identifier_list) @import.module+) @import.statement++; ---------------------------------------------------------------------------+; Calls — Dart calls are selector chains: ``foo(x)`` is an identifier followed+; by a sibling (selector (argument_part)); ``obj.method(x)`` inserts a+; ``.method`` selector between them. Only the first link of a chain is+; captured (chained calls are best-effort, like Kotlin/Swift).+; ---------------------------------------------------------------------------++; Bare call / constructor call: foo(args) / HttpClient()+(_+ (identifier) @call.target+ .+ (selector+ (argument_part+ (arguments) @call.arguments+ )+ ) @call.site+)++; Method call: obj.method(args)+(_+ (identifier) @call.receiver+ .+ (selector+ (unconditional_assignable_selector+ (identifier) @call.target+ )+ )+ .+ (selector+ (argument_part+ (arguments) @call.arguments+ )+ ) @call.site+)++; Method call on this: this.method(args)+(_+ (this) @call.receiver+ .+ (selector+ (unconditional_assignable_selector+ (identifier) @call.target+ )+ )+ .+ (selector+ (argument_part+ (arguments) @call.arguments+ )+ ) @call.site+)diff --git a/pyproject.toml b/pyproject.tomlindex 42f470d86..9f1ede557 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -42,6 +42,7 @@ dependencies = ["tree-sitter-rust>=0.23,<1","tree-sitter-java>=0.23,<1","tree-sitter-cpp>=0.23,<1",+ "tree-sitter-dart>=0.1,<1","tree-sitter-kotlin>=1,<2","tree-sitter-ruby>=0.23,<1","tree-sitter-c-sharp>=0.23,<1",diff --git a/tests/fixtures/lang_samples/dart/assertions.dart b/tests/fixtures/lang_samples/dart/assertions.dartnew file mode 100644index 000000000..c083d3186--- /dev/null+++ b/tests/fixtures/lang_samples/dart/assertions.dart@@ -0,0 +1,17 @@+// Assertion-block fixtures — Dart's bare ``assert(...)`` statement.+// package:test ``expect(...)`` calls have no call-expression node type to+// key on, so only assert statements count (documented under-signal).++void testManyAsserts(int x) {+ assert(x > 0);+ assert(x < 100);+ assert(x != 13);+ assert(x != 42);+ assert(x % 2 == 0);+}++void testFewAsserts(int x) {+ assert(x > 0);+ var y = x + 1;+ assert(y > 1);+}diff --git a/tests/fixtures/lang_samples/dart/classes.dart b/tests/fixtures/lang_samples/dart/classes.dartnew file mode 100644index 000000000..a10cf4c27--- /dev/null+++ b/tests/fixtures/lang_samples/dart/classes.dart@@ -0,0 +1,48 @@+// Class-metric fixtures. Dart has no wrapper node for ``this.member``+// access (receiver and selector are flat siblings), so LCOM4 sits at its+// "no signal" safety valve (1) by design — the class facts under test here+// are method_count / total size / per-method complexity.++class Cohesive {+ int total = 0;+ int count = 0;++ void add(int v) {+ total += v;+ count += 1;+ }++ double mean() {+ return total / count;+ }++ void reset() {+ total = 0;+ count = 0;+ }+}++class Wide {+ int a = 0;+ int b = 0;++ void one() {+ a = 1;+ }++ void two() {+ b = 2;+ }++ void three() {+ a = 3;+ }++ void four() {+ b = 4;+ }++ int loner() {+ return 42;+ }+}diff --git a/tests/fixtures/lang_samples/dart/nested.dart b/tests/fixtures/lang_samples/dart/nested.dartnew file mode 100644index 000000000..936e7dc28--- /dev/null+++ b/tests/fixtures/lang_samples/dart/nested.dart@@ -0,0 +1,28 @@+// Fixtures for nesting / cyclomatic-complexity walker tests.++int deeplyNested(int x) {+ if (x > 0) {+ for (var i = 0; i < x; i++) {+ while (i > 0) {+ if (i == 5) {+ return i;+ }+ }+ }+ }+ return x;+}++int shallow(int x) {+ return x + 1;+}++int manyBranches(int x) {+ if (x == 1) return 1;+ if (x == 2 && x > 0) return 2;+ if (x == 3 || x < 0) return 3;+ if (x == 4) return 4;+ if (x == 5) return 5;+ if (x == 6) return 6;+ return x;+}diff --git a/tests/fixtures/lang_samples/dart/perf_io_in_loop.dart b/tests/fixtures/lang_samples/dart/perf_io_in_loop.dartnew file mode 100644index 000000000..fa0d9e349--- /dev/null+++ b/tests/fixtures/lang_samples/dart/perf_io_in_loop.dart@@ -0,0 +1,44 @@+// Perf-dialect fixtures: expected hits are asserted in+// tests/unit/health/test_perf_dialects.py (Dart section).++import 'dart:io';++import 'package:http/http.dart' as http;++Future<void> serialFetch(List<Uri> urls) async {+ for (final u in urls) {+ final r = await http.get(u); // io_in_loop network + serial_await_in_loop+ }+}++Future<void> readFiles(List<File> files) async {+ for (final f in files) {+ final t = await f.readAsString(); // io_in_loop filesystem + serial_await+ }+}++Future<void> queryRows(dynamic db, List<int> ids) async {+ for (final id in ids) {+ final rows = await db.rawQuery('SELECT * FROM t WHERE id = ?'); // db+ }+}++String concat(List<String> parts) {+ var s = '';+ for (final p in parts) {+ s += 'chunk'; // string_concat_in_loop+ }+ return s;+}++void makeClients(List<int> xs) {+ for (final x in xs) {+ final c = HttpClient(); // resource_construction_in_loop+ }+}++void constantBound() {+ for (var i = 0; i < 3; i++) {+ http.get(Uri.parse('u')); // constant loop -> no hit+ }+}diff --git a/tests/unit/health/test_complexity_walker.py b/tests/unit/health/test_complexity_walker.pyindex 3dafaa2ce..42df56c83 100644--- a/tests/unit/health/test_complexity_walker.py+++ b/tests/unit/health/test_complexity_walker.py@@ -382,3 +382,41 @@ def test_csharp_assertion_blocks():assert many.assertion_blocks[0][2] == 16few = _find(results, "TestFewAsserts")assert few is not None and few.assertion_blocks == []+++def test_dart_nesting_and_ccn():+ results = _walk("dart/nested.dart", "dart")+ deep = _find(results, "deeplyNested")+ assert deep is not None+ assert deep.max_nesting >= 4, f"expected >=4 nesting, got {deep.max_nesting}"+ many = _find(results, "manyBranches")+ assert many is not None+ # 6 ifs + 2 boolean operators over the base path.+ assert many.ccn >= 9, f"expected CCN >= 9, got {many.ccn}"+ shallow = _find(results, "shallow")+ assert shallow is not None and shallow.max_nesting == 0+ assert shallow.param_count == 1+++def test_dart_class_facts():+ # Dart has no wrapper node for ``this.member`` access, so LCOM4 sits at+ # its "no signal" safety valve (1) for every class — the class facts+ # under test are method grouping and size.+ classes = _walk_classes("dart/classes.dart", "dart")+ cohesive = classes.get("Cohesive")+ wide = classes.get("Wide")+ assert cohesive is not None and wide is not None+ assert cohesive.method_count == 3+ assert wide.method_count == 5+ assert cohesive.lcom4 == 1+ assert wide.lcom4 == 1+++def test_dart_assertion_blocks():+ results = _walk("dart/assertions.dart", "dart")+ many = _find(results, "testManyAsserts")+ assert many is not None+ assert many.assertion_blocks, "expected a run of assert statements"+ assert many.assertion_blocks[0][2] == 5+ few = _find(results, "testFewAsserts")+ assert few is not None and few.assertion_blocks == []diff --git a/tests/unit/health/test_perf_dialects.py b/tests/unit/health/test_perf_dialects.pyindex 3de4d9baa..bde5d6710 100644--- a/tests/unit/health/test_perf_dialects.py+++ b/tests/unit/health/test_perf_dialects.py@@ -510,3 +510,93 @@ def test_ts_array_spread_in_reduce_vs_push():push = "function f(xs){ return xs.reduce((acc, x) => { acc.push(x); return acc; }, []); }"assert ("array_spread_in_reduce", "") in _hits("typescript", spread)assert not any(k == "array_spread_in_reduce" for k, _ in _hits("typescript", push))+++# ---------------------------------------------------------------------------+# Dart+# ---------------------------------------------------------------------------+++def test_dart_fixture_counts():+ fc = _walk("dart/perf_io_in_loop.dart", "dart")+ counts = _kinds(fc.perf_hits)+ assert counts["io_in_loop"] == 3+ assert {h.detail for h in fc.perf_hits if h.kind == "io_in_loop"} == {+ "db",+ "filesystem",+ "network",+ }+ assert counts["serial_await_in_loop"] == 3+ assert counts["string_concat_in_loop"] == 1+ assert counts["resource_construction_in_loop"] == 1+++_DART_CASES = [+ (+ "import 'package:http/http.dart' as http;\n"+ "Future<void> f(List<Uri> urls) async {\n"+ " for (final u in urls) { final r = await http.get(u); }\n"+ "}\n",+ [("io_in_loop", "network"), ("serial_await_in_loop", "network")],+ "an awaited http verb in a for-in loop is a serial network round-trip",+ ),+ (+ "Future<void> f(List<dynamic> files) async {\n"+ " for (final x in files) { final t = await x.readAsString(); }\n"+ "}\n",+ [("io_in_loop", "filesystem"), ("serial_await_in_loop", "filesystem")],+ "readAsString is a File round-trip regardless of receiver name",+ ),+ (+ "String f(List<String> parts) {\n"+ " var s = '';\n"+ " for (final p in parts) { s += 'x'; }\n"+ " return s;\n"+ "}\n",+ [("string_concat_in_loop", "")],+ "immutable-string += accumulation in a loop is O(n^2)",+ ),+ (+ "void f(List<int> xs) {\n"+ " for (final x in xs) { final d = Dio(); }\n"+ "}\n",+ [("resource_construction_in_loop", "")],+ "a Dio client constructed per-iteration",+ ),+ (+ "import 'package:http/http.dart' as http;\n"+ "void f() {\n"+ " for (var i = 0; i < 3; i++) { http.get(Uri.parse('u')); }\n"+ "}\n",+ [],+ "a constant-bound loop is not data-dependent N+1",+ ),+ (+ "void f(List<String> parts) {\n"+ " var s = '';\n"+ " for (final p in parts) { s = ''; s += p; }\n"+ "}\n",+ [],+ "opaque-variable += is not provably string concat (precision-first)",+ ),+]++[email protected]("src,expected,note", _DART_CASES, ids=[c[2] for c in _DART_CASES])+def test_dart_cases(src, expected, note):+ assert _hits("dart", src) == sorted(expected), note+++def test_dart_string_concat_reset_per_iteration_not_flagged():+ # ``name`` is declared fresh inside the loop body, so ``name += '/'``+ # is not a cross-iteration accumulator (shelf directory_listing FP).+ src = (+ "void f(List<String> xs) {\n"+ " for (final x in xs) {\n"+ " var name = x;\n"+ " name += '/';\n"+ " use(name);\n"+ " }\n"+ "}\n"+ )+ assert not any(k == "string_concat_in_loop" for k, _ in _hits("dart", src))diff --git a/tests/unit/ingestion/test_dart_extractors.py b/tests/unit/ingestion/test_dart_extractors.pynew file mode 100644index 000000000..25f3b5677--- /dev/null+++ b/tests/unit/ingestion/test_dart_extractors.py@@ -0,0 +1,215 @@+"""Dart AST extraction tests — symbols, imports, bindings, heritage.++Mirrors the Swift/Kotlin extractor test conventions: inline byte-string+sources through a module-scoped ``ASTParser``. Includes the regex-vs-AST+import parity test (the lightweight tier stays registered as the fallback+when the grammar wheel is missing).+"""++from __future__ import annotations++from datetime import datetime++import pytest++from repowise.core.ingestion.lightweight_imports.dart import extract_dart_imports+from repowise.core.ingestion.models import FileInfo+from repowise.core.ingestion.parser import ASTParser+++def _file(path: str = "lib/foo.dart") -> FileInfo:+ return FileInfo(+ path=path,+ abs_path=f"/tmp/{path}",+ language="dart",+ size_bytes=100,+ git_hash="",+ last_modified=datetime.now(),+ is_test=False,+ is_config=False,+ is_api_contract=False,+ is_entry_point=False,+ )++[email protected](scope="module")+def parser() -> ASTParser:+ return ASTParser()+++class TestDartSymbols:+ def test_declaration_kinds(self, parser: ASTParser) -> None:+ src = b"""\+class Widgety {}+mixin Cache {}+enum Color { red, green }+extension StrX on String {}+typedef Cb = void Function(int);+void topFn(int a) {}+int get topGetter => 1;+"""+ result = parser.parse_file(_file(), src)+ kinds = {(s.name, s.kind) for s in result.symbols}+ assert ("Widgety", "class") in kinds+ assert ("Cache", "class") in kinds+ assert ("Color", "enum") in kinds+ assert ("StrX", "class") in kinds+ assert ("Cb", "type_alias") in kinds+ assert ("topFn", "function") in kinds+ assert ("topGetter", "function") in kinds++ def test_methods_get_parents(self, parser: ASTParser) -> None:+ src = b"""\+class Repo {+ void save() {}+ int get count => 0;+ set count(int v) {}+}+mixin Cache {+ void evict() {}+}+"""+ result = parser.parse_file(_file(), src)+ parents = {(s.name, s.parent_name) for s in result.symbols if s.kind == "method"}+ assert ("save", "Repo") in parents+ assert ("count", "Repo") in parents+ assert ("evict", "Cache") in parents++ def test_symbol_range_covers_sibling_body(self, parser: ASTParser) -> None:+ # The grammar splits a function into signature + SIBLING body; the+ # symbol range must include the body or call attribution breaks.+ src = b"""\+void multiLine(int x) {+ if (x > 0) {+ helper(x);+ }+}+"""+ result = parser.parse_file(_file(), src)+ fn = next(s for s in result.symbols if s.name == "multiLine")+ assert fn.end_line >= 5+ call = next(c for c in result.calls if c.target_name == "helper")+ assert call.caller_symbol_id is not None+ assert call.caller_symbol_id.endswith("::multiLine")++ def test_local_functions_are_not_hoisted(self, parser: ASTParser) -> None:+ src = b"""\+void outer() {+ void inner() {}+ inner();+}+"""+ result = parser.parse_file(_file(), src)+ names = {s.name for s in result.symbols}+ assert "outer" in names+ assert "inner" not in names++ def test_underscore_visibility(self, parser: ASTParser) -> None:+ src = b"""\+class _Private {}+class Public {}+void _hidden() {}+"""+ result = parser.parse_file(_file(), src)+ vis = {s.name: s.visibility for s in result.symbols}+ assert vis["_Private"] == "private"+ assert vis["Public"] == "public"+ assert vis["_hidden"] == "private"+++class TestDartImports:+ def test_uri_shapes(self, parser: ASTParser) -> None:+ src = b"""\+import 'package:http/http.dart' as http;+import 'dart:io';+import 'src/util.dart';+export 'src/api.dart';+part 'foo.g.dart';+"""+ result = parser.parse_file(_file(), src)+ by_path = {i.module_path: i for i in result.imports}+ assert by_path["package:http/http.dart"].is_relative is False+ assert by_path["dart:io"].is_relative is False+ assert by_path["src/util.dart"].is_relative is True+ assert by_path["src/api.dart"].is_reexport is True+ assert by_path["foo.g.dart"].is_relative is True++ def test_part_of_forms(self, parser: ASTParser) -> None:+ src = b"""\+part of 'lib.dart';+"""+ result = parser.parse_file(_file(), src)+ assert result.imports[0].module_path == "lib.dart"+ assert result.imports[0].is_relative is True++ dotted = parser.parse_file(_file(), b"part of my.lib;\n")+ assert dotted.imports[0].module_path == "library:my.lib"+ assert dotted.imports[0].is_relative is False++ def test_show_and_as_bindings(self, parser: ASTParser) -> None:+ src = b"""\+import 'package:http/http.dart' as http;+import 'utils.dart' show helper, Other;+import 'noise.dart' hide Loud;+"""+ result = parser.parse_file(_file(), src)+ by_path = {i.module_path: i for i in result.imports}+ aliased = by_path["package:http/http.dart"]+ assert [(b.local_name, b.is_module_alias) for b in aliased.bindings] == [("http", True)]+ # A non-``show`` import brings the whole namespace into scope.+ assert aliased.imported_names == ["*"]+ shown = by_path["utils.dart"]+ assert shown.imported_names == ["helper", "Other"]+ assert {(b.local_name, b.exported_name) for b in shown.bindings} == {+ ("helper", "helper"),+ ("Other", "Other"),+ }+ hidden = by_path["noise.dart"]+ assert hidden.bindings == []+ assert hidden.imported_names == ["*"]++ def test_ast_matches_lightweight_regex_tier(self, parser: ASTParser) -> None:+ # The regex tier stays registered as the no-grammar fallback; both+ # paths must emit the same (module_path, is_relative, is_reexport)+ # edges on the same source.+ src = b"""\+import 'package:flutter/material.dart';+import 'dart:async';+import 'src/model.dart' as model;+export 'src/public.dart' show Api;+part 'gen.g.dart';+part of 'owner.dart';+"""+ ast_imports = parser.parse_file(_file(), src).imports+ regex_imports = extract_dart_imports(src.decode())+ key = lambda i: (i.module_path, i.is_relative, i.is_reexport) # noqa: E731+ assert sorted(map(key, ast_imports)) == sorted(map(key, regex_imports))+++class TestDartHeritage:+ def test_extends_with_implements(self, parser: ASTParser) -> None:+ src = b"""\+class Foo extends Base with M1, M2 implements IFace {}+"""+ result = parser.parse_file(_file(), src)+ rels = {(r.child_name, r.kind, r.parent_name) for r in result.heritage}+ assert ("Foo", "extends", "Base") in rels+ assert ("Foo", "mixin", "M1") in rels+ assert ("Foo", "mixin", "M2") in rels+ assert ("Foo", "implements", "IFace") in rels++ def test_mixin_on_constraint(self, parser: ASTParser) -> None:+ src = b"""\+mixin Cache on Base {}+"""+ result = parser.parse_file(_file(), src)+ rels = {(r.child_name, r.kind, r.parent_name) for r in result.heritage}+ assert ("Cache", "extends", "Base") in rels++ def test_with_only_class(self, parser: ASTParser) -> None:+ src = b"""\+class Foo with M1 {}+"""+ result = parser.parse_file(_file(), src)+ rels = {(r.child_name, r.kind, r.parent_name) for r in result.heritage}+ assert ("Foo", "mixin", "M1") in relsdiff --git a/tests/unit/ingestion/test_language_capabilities.py b/tests/unit/ingestion/test_language_capabilities.pyindex 01e5e3906..22f18ba64 100644--- a/tests/unit/ingestion/test_language_capabilities.py+++ b/tests/unit/ingestion/test_language_capabilities.py@@ -132,6 +132,9 @@ _FULL = {"c","cpp","csharp",+ # dart promoted with the tree-sitter grammar (the regex tier stays as+ # the no-grammar fallback).+ "dart","go","java","javascript",@@ -149,7 +152,6 @@ _PARTIAL = {"scala",# Lightweight regex-tier resolvers (module-name index + import regexes)."elixir",- "dart","clojure","haskell","erlang",