Refactor: Consolidate Inspect/Outline analysis into the shared Visitor - #137
Closed
predictiple wants to merge 2 commits into
Closed
Refactor: Consolidate Inspect/Outline analysis into the shared Visitor#137predictiple wants to merge 2 commits into
predictiple wants to merge 2 commits into
Conversation
Fold the duplicated AST descent logic from inspect.go and outline.go into the existing Visitor so the grammar is traversed by a single mechanism. The Visitor now supports two additional format options: - AnalysisOnly: bypasses the copy/merge bookkeeping used by the formatter path so analysis state is collected exactly once on the original node graph. - CollectOutline: enables outline construction via an explicit stack that builds the Let/Query/Column/Function hierarchy. Function nodes are only emitted under column or expression contexts, so FROM, WHERE and GROUP BY clauses do not pollute the outline. Source positions are recorded on CallSite (including per-argument positions) and DefinitionSite. The existing string-based Args field is retained unchanged, preserving backwards compatibility for consumers such as the launcher verifier. Inspect() and Outline() are now thin wrappers that configure a Visitor, run a single traversal, and translate the collected state into their existing exported types; no caller-facing API changes. This removes roughly 410 lines of duplicated traversal code while keeping the full test suite (including the Velociraptor LSP integration tests) green.
Reword comments flagged by the Vale spelling dictionaries: drop possessive forms that the dictionaries do not cover, wrap the `isExpression` identifier in backticks so it is treated as code, and use the American spelling "behavior" in vfilter.go. No functional changes.
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.
Fold the duplicated AST descent logic from inspect.go and outline.go into the existing Visitor so the grammar is traversed by a single mechanism.
The Visitor now supports two additional format options:
Source positions are recorded on CallSite (including per-argument positions) and DefinitionSite. The existing string-based Args field is retained unchanged, preserving backwards compatibility for consumers such as the launcher verifier.
Inspect() and Outline() are now thin wrappers that configure a Visitor, run a single traversal, and translate the collected state into their existing exported types; no caller-facing API changes. This removes roughly 410 lines of duplicated traversal code while keeping the full test suite (including the Velociraptor LSP integration tests) green.