JS: Remove parenthesized expressions from AST by asgerf · Pull Request #21427 · github/codeql

@github-actions bot added the JS label

Mar 9, 2026

@asgerf

@asgerf

@asgerf

@asgerf

@asgerf

@asgerf

@asgerf

@asgerf

The LanguageVersionTests require all relations with multiple columns
to have dependency stats between each pair of columns. The
has_parentheses relation was missing these dependency entries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a parenthesized expression is the callee/object of an optional
chain step (e.g. `(null)?.()`), the postVisitChainable method was
writing CFG successor edges FROM the ParenthesizedExpression node.
Since ParenthesizedExpression nodes are now bypassed and have no DB
entry, this caused VALUE_NOT_IN_TYPE errors in the successor relation.

Fix by unwrapping ParenthesizedExpression before writing the successor
edge, so the edge is written from the inner expression instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- WhitespaceContradictsPrecedence: suppress false positives where
  parenthesized inner expressions explicitly clarify precedence
- ExprHasNoEffect: continue flagging parenthesized anonymous function
  expressions as useless (they are valid code, not syntax errors)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>