You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TreeNode (introduced in PR #147 at Sources/SyntaxParser/TreeNode.swift) is declared as final class but behaves as a value type:
Built up during a single traversal, then read-only
Encoded to JSON immediately after construction
Equatable conformance compares fields, not identity
The only genuine need for a reference type in this pipeline is the mutable current pointer inside TokenVisitor, which is already a separate internal type.
Proposed Work
Convert TreeNode to a struct. Key considerations:
The parent: Int? back-reference is by ID (not object identity), so no reference cycle concerns
Codable and Equatable synthesization works the same for structs
TokenVisitor builds nodes by mutating a current node — this will need to capture the struct by value and reassign, rather than mutating through a reference
Activity