[exp] Remove always-run key re-indexing on every node#7646
Closed
TomasVotruba wants to merge 3 commits intomainfrom
Closed
[exp] Remove always-run key re-indexing on every node#7646TomasVotruba wants to merge 3 commits intomainfrom
TomasVotruba wants to merge 3 commits intomainfrom
Conversation
samsonasik
reviewed
Nov 20, 2025
|
|
||
| // reindex stmt_key already covered on StmtKeyNodeVisitor on next processNodes() | ||
| // so set flag $reIndexStmtKey to false to avoid double loop | ||
| NodeAttributeReIndexer::reIndexNodeAttributes($node, false); |
Member
There was a problem hiding this comment.
This should be kept, as reset index on other keyed values, the flag false is to not reindex stmt_key
samsonasik
reviewed
Nov 20, 2025
| } | ||
|
|
||
| if ($node instanceof If_) { | ||
| $node->elseifs = array_values($node->elseifs); |
Member
There was a problem hiding this comment.
If we are going to remove these, the BetterStandardPrintet need to be updated instead.
Member
There was a problem hiding this comment.
This only called on after refactor, so should be fine to be kept
samsonasik
reviewed
Nov 20, 2025
|
|
||
| // re-index stmt key under current node | ||
| foreach ($node->stmts as $key => $childStmt) { | ||
| $childStmt->setAttribute(AttributeKey::STMT_KEY, $key); |
Member
There was a problem hiding this comment.
This is the part related with stmt_key set value. should be only remove this part only per related PRs.
Member
|
I will create separate PR to only remove Other |
Member
|
@TomasVotruba I created new PR for it for less bc break as possible :) |
This was referenced Nov 20, 2025
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.
I'm working on removing STMT_KEY attribute in rules, where direct array key should be used instead.
The attribute can change any time and it doesn't make sense to use it, if the array key is there :)
At the moment the stmts key are re-indexed on every
enterNode()instead of just in the rules where code changed. That's a bit performance cost. Instead we should re-index array explicitly in the rule only when code is changed. This also promotes best practices to keep array stmts reliably indexed as list (0, 1, 2...).Let's see how many rules will this break and fix it propperly :)