Skip to content

Migrate ComputeStatistics to use visitor pattern #43

Description

@darianmiller

Once Delphi.Forms.Visitor (#41) ships, migrate ComputeStatistics in
Delphi.Forms.Statistics to use the visitor for traversal instead of its
ad-hoc recursive walker.

Statistics computation is a natural fit for the visitor: VisitObject
increments component counts and tracks depth, VisitProperty counts
properties and accumulates name frequencies, VisitValue tallies value
kind distribution.

Scope

  • Implement a TStatisticsVisitor that accumulates all statistics
    fields in VisitObject, VisitProperty, and VisitValue
  • Replace ad-hoc recursion in ComputeStatistics with
    WalkForm(Form, Visitor)
  • ComputeStatistics public API unchanged
  • Both single-form and batch overloads still work

Acceptance criteria

  • All existing statistics tests pass with identical output
  • No ad-hoc recursion remains in Delphi.Forms.Statistics
  • Public API unchanged (backward compatible)

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions