feat(parsers): add Dart / Flutter language support#19
Merged
tob-scott-a merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
Uses tree-sitter-language-pack's dart grammar (transitive dep, no new
installs). Extracts:
- Top-level functions (paired from function_signature + function_body
sibling nodes; Dart's grammar keeps them as separate AST siblings
rather than nesting them, which required a custom signature-pairing
walker).
- Classes, including abstract classes.
- Methods inside class bodies (method_signature + function_body pairs).
- Abstract methods (declaration -> function_signature, no body).
- Parameters and return types.
- Imports — `package:` and `dart:` URIs captured as dependencies.
Calls in Dart aren't a single AST node — they're an identifier followed
by a selector carrying an argument_part. Added _collect_dart_calls to
walk bodies, detect argument-bearing selectors, and reconstruct the
callee name from the preceding identifier/selector chain (handles both
plain calls `b()` and method calls `obj.method()`).
Entrypoint detector:
- `@pragma('vm:entry-point')` — Dart's explicit native-callable marker.
Used for FFI callbacks, platform-channel handlers, and deferred
loading targets; these are attacker-reachable from the host platform.
Flutter lifecycle methods (`build`, `initState`, `dispose`) are NOT
flagged by default because they run in-process and aren't directly
attacker-reachable. Users who want them tagged can add them via the
override file.
Known gaps (documented in the parser docstring): `throw` statements
aren't yet added to exception_types — parallel to Swift/Kotlin, the
throw AST node overlaps with other control-transfer forms.
12 new tests: Dart parser, Dart entrypoint detection. README
supported-languages and framework-coverage tables updated.
Roadmap left before v0.2.0: Option A (Go/Ruby/C++ entrypoint
detectors) and Option B (branches + docstring in JSON export).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses tree-sitter-language-pack's dart grammar (transitive dep, no new installs). Extracts:
package:anddart:URIs captured as dependencies.Calls in Dart aren't a single AST node — they're an identifier followed by a selector carrying an argument_part. Added _collect_dart_calls to walk bodies, detect argument-bearing selectors, and reconstruct the callee name from the preceding identifier/selector chain (handles both plain calls
b()and method callsobj.method()).Entrypoint detector:
@pragma('vm:entry-point')— Dart's explicit native-callable marker. Used for FFI callbacks, platform-channel handlers, and deferred loading targets; these are attacker-reachable from the host platform.Flutter lifecycle methods (
build,initState,dispose) are NOT flagged by default because they run in-process and aren't directly attacker-reachable. Users who want them tagged can add them via the override file.Known gaps (documented in the parser docstring):
throwstatements aren't yet added to exception_types — parallel to Swift/Kotlin, the throw AST node overlaps with other control-transfer forms.12 new tests: Dart parser, Dart entrypoint detection. README supported-languages and framework-coverage tables updated.
Roadmap left before v0.2.0: Option A (Go/Ruby/C++ entrypoint detectors) and Option B (branches + docstring in JSON export).