Skip to content

Remove redundant JSDoc flag checks#2821

Open
jakebailey wants to merge 1 commit intomainfrom
jabaile/remove-jsdoc-flag-checks
Open

Remove redundant JSDoc flag checks#2821
jakebailey wants to merge 1 commit intomainfrom
jabaile/remove-jsdoc-flag-checks

Conversation

@jakebailey
Copy link
Member

These are redundant; JSDoc and EagerJSDoc both check this and return nil.

Copilot AI review requested due to automatic review settings February 18, 2026 03:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes redundant NodeFlagsHasJSDoc guard checks at several call sites by relying on ast.Node.JSDoc / ast.Node.EagerJSDoc to short-circuit and return nil when JSDoc is not present.

Changes:

  • Simplify selection range traversal to always iterate current.JSDoc(sourceFile) without a separate flag check.
  • Simplify checker JSDoc comment validation to always iterate node.EagerJSDoc(nil) without a separate flag check.
  • Simplify AST navigation helpers that visit children + JSDoc to always iterate node.JSDoc(sourceFile) without a separate flag check.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/ls/selectionranges.go Removes redundant HasJSDoc check before iterating JSDoc nodes during selection range computation.
internal/checker/checker.go Removes redundant HasJSDoc check before iterating eager JSDoc nodes during source element checking.
internal/astnav/tokens.go Removes redundant HasJSDoc check in VisitEachChildAndJSDoc.
internal/ast/utilities.go Removes redundant HasJSDoc check in ForEachChildAndJSDoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments