JS: Improve handling of const keyword#8434
Conversation
- `const` declared variables must be treated as block scoped declarations, as `let` declared variables are already - Highlighting of `const` is aligned with `let` Closes: apache#8299
| @Override | ||
| public boolean enterVarNode(VarNode varNode) { | ||
| if (varNode.isLet()) { | ||
| if (varNode.isLet() || varNode.isConst()) { |
There was a problem hiding this comment.
why not use varNode.isBlockScoped() ?
There was a problem hiding this comment.
Because the usage of let or const implies block scope, while the reverse might not be true (in a hypothetical JS extension) in the future. It is true that at this point in time varNode.isLet() || varNode.isConst() and varNode.isBlockScoped() result in identical behavior, but it is not guaranteed to stay that way.
In the concrete case, the analyser explicitly handles the two keywords let and const in let or const declarations nothing more.
|
This fixes the issue for me |
|
@NReib thanks for testing/checking |
|
merging for 26-rc2, checking were not ok yesterday but it's green today :D |
|
@ebarboni yeah, @neilcsmith-net restarted the testrun before I could look into it. Thanks |
|
@matthiasblaesing logs are still at https://github.com/apache/netbeans/actions/runs/14579882647 (attempts top right). They failed on different tests, or I wouldn't have restarted. |
|
@neilcsmith-net I'm aware of that. Just FYI we also had situations where the same test failed multiple times. |
|
Yes, in which case the process would have been different. I checked the failed tests were different, I checked there wasn't anything obvious in your changes that would have triggered the failure, then I restarted again. That's how we've always handled. I'm not sure what your concern is or why it's stopping you looking into anything? |
|
Nothing is wrong, I just reacted to the implication, that I would not be aware of how github handles test restarts. |
constdeclared variables must be treated as block scoped declarations, asletdeclared variables are alreadyconstis aligned withletCloses: #8299