Conversation
…ce TryCollectInfo work Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/9e120fbc-6ec4-46c7-9cc8-46e269e91f1b Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate moving work from TryCollectInfo to FE construction
FlatExpression: track lambda node indices during construction to avoid TryCollectInfo traversal
Apr 29, 2026
Owner
|
@copilot what about other things, blocks, try catch, goto/labels |
… and TryCatchNodes during construction Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/fbbd4fe6-1e27-488e-b48b-b5ff5dbc8626 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Contributor
Author
Done in commit 60a4f93. Added three more pre-collected index lists to
All four are populated in both the direct factory-API path and |
Copilot
AI
changed the title
FlatExpression: track lambda node indices during construction to avoid TryCollectInfo traversal
FlatExpression: track lambda, block-with-vars, goto/label, and try-catch node indices during construction
Apr 29, 2026
dadhi
approved these changes
Apr 30, 2026
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.
TryCollectInfotraverses the entire expression tree to discover nested lambdas, block-scoped variables, goto/label pairs, and try regions. ForFlatExpression(FE), all of this work can be done during construction — the same wayClosureConstantsis already pre-collected — eliminating the O(tree_size) scan.Changes
ExprTree.LambdaNodes— tracks indices of every lambda node; the root isRootIndex, all others are nested lambdasExprTree.BlocksWithVariables— tracks indices of block nodes that carry explicit variable declarations (children.Count == 2), coveringTryCollectInfo'sPushBlockWithVars/PopBlocktrackingExprTree.GotoNodes— tracks indices ofExpressionType.Gotonodes (goto/return/break/continue family), covering the goto-count side ofTargetToGotosAndLabelsExprTree.LabelNodes— tracks indices ofExpressionType.Labelexpression nodes, covering the label-count side ofTargetToGotosAndLabelsExprTree.TryCatchNodes— tracks indices ofExpressionType.Trynodes (try/catch, try/finally, try/fault), covering theHasComplexExpression = truemarkingAll five lists are populated in both the direct factory-API path and
Builder.AddExpression(theFromExpressionpath), so the same metadata is available regardless of how theExprTreewas built.Usage
Callers can now enumerate all of these node categories in O(node_count) without a full tree walk. This is the groundwork for eliminating the separate
TryCollectInfophase for FE-built expressions; subsequent work can leverage these lists to pre-compute non-passed parameters, block-local variables, and label linkage at construction time.