Skip to content

dart func_start: constructors with very long (>~2000 char) parameter lists still not found (e.g. ThemeData.raw) #1493

Closed

Description

@squid-protocol

Summary

Follow-up from #1479/PR (link once opened). After that fix, flutter/theme_data.dart's
const ThemeData.raw({ ... }) constructor -- whose parameter list spans ~140 lines
(hundreds of required this.xxx, entries) -- is still not found by GitGalaxy, despite the
regex itself matching it correctly in isolation.

Root cause

gitgalaxy/core/detector.py's _slice_by_braces computes a per-match
search_limit = min(next_match_start, start_idx + 2000) (a 2000-character window from the
match's own start). The new dart-specific terminator scan (added by #1479's fix) first finds
the parameter list's real closing ) via _find_balanced_end, which has its own much larger
HANDSHAKE_LOOKAHEAD_LIMIT (50000 chars) -- so for a constructor whose parameter list alone
exceeds ~2000 characters, params_end_idx lands past search_limit, and the terminator scan
(while pos < search_limit) never runs at all, immediately returning "not found" and rejecting
the whole match.

Confirmed repro

language-crucible/data/dart/flutter/theme_data.dart:700: const ThemeData.raw({ -- parameter
list is long enough to exceed the 2000-char search_limit. Also affects the unnamed
factory ThemeData({...}) constructor at line 265 (similarly long parameter list).

Suggested fix shape

Either give the dart-specific branch its own larger search_limit (matching or derived from
HANDSHAKE_LOOKAHEAD_LIMIT rather than the generic per-match 2000-char window meant for
simpler brace-search cases), or compute search_limit for dart from params_end_idx itself
(e.g. params_end_idx + 2000) instead of start_idx + 2000, so the window is anchored to
where the terminator scan actually begins rather than where the whole match started.

Scope note

Low priority / narrow: affects only constructors with pathologically long parameter lists
(large widget-style classes with many named/required parameters), not the common case. Real
extraction gap in production scans of dart code (epic #813 scope), not a measurement artifact.

Activity

  1. added
    bug
    core-engine
    threat: false-negative
    on Aug 13, 2026
  2. added this to the v2.4.8 milestone on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginethreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions