module
Analyzer::Dart::Helper
Overview
Shared helpers for the Dart framework analyzers (Dart Frog, Shelf, Serverpod). Kept framework-agnostic so each analyzer can opt in without duplicating path/string conventions.
Extended Modules
Defined in:
analyzer/analyzers/dart/dart_helper.crInstance Method Summary
-
#extract_string_literal(text : String) : String | Nil
Pull the contents of a leading single/double-quoted string literal from an argument expression, honouring backslash escapes.
-
#strip_comments(text : String) : String
Replace
//line and/* */block comments with spaces, leaving string literals and overall byte offsets intact so downstream regex/offset logic still lines up with the original source. -
#test_path?(path : String, base_path : String | Nil = nil) : Bool
Standard Dart test-file conventions.
- #test_path?(path : String, base_paths : Array(String)) : Bool
Instance Method Detail
Pull the contents of a leading single/double-quoted string literal from an argument expression, honouring backslash escapes. Returns nil when the expression doesn't start with a string literal.
Replace // line and /* */ block comments with spaces, leaving
string literals and overall byte offsets intact so downstream
regex/offset logic still lines up with the original source.
Standard Dart test-file conventions. The Dart tooling discovers
tests under a project-root test/ directory and via the
*_test.dart suffix; neither ever serves real traffic. Dart Frog
in particular mirrors the route tree under test/routes/, so a
naive /routes/ match would surface every mock handler as a live
endpoint. Centralized so every Dart analyzer can opt in via
next if Helper.test_path?(path, base_paths).
/test/,test/— Dart'sdart testdiscovery root and the Dart Frogtest/routes/mirror tree*_test.dart— the canonical Dart unit-test suffix