-
Notifications
You must be signed in to change notification settings - Fork 641
Type nodes for JSDoc #1013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Type nodes for JSDoc #1013
Changes from all commits
2ef6da2
35b83e8
2c286cc
11909f4
aaf9260
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,9 +26,9 @@ const ( | |||||||||||
propertyLikeParseCallbackParameter | ||||||||||||
) | ||||||||||||
|
||||||||||||
func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { | ||||||||||||
func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) []*ast.Node { | ||||||||||||
if !hasJSDoc { | ||||||||||||
return | ||||||||||||
return nil | ||||||||||||
} | ||||||||||||
|
||||||||||||
if p.jsdocCache == nil { | ||||||||||||
|
@@ -60,7 +60,9 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { | |||||||||||
p.reparseTags(node, jsdoc) | ||||||||||||
} | ||||||||||||
p.jsdocCache[node] = jsdoc | ||||||||||||
return jsdoc | ||||||||||||
} | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cache branch always returns nil, dropping previously parsed JSDoc tags. You should return the cached
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. jsdocCache is write-only, write-once here by the nature of the parser. The current bode's jsdoc will never be cached. |
||||||||||||
return nil | ||||||||||||
} | ||||||||||||
|
||||||||||||
func (p *Parser) parseJSDocTypeExpression(mayOmitBraces bool) *ast.Node { | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an improvement--now setJSDocParents runs and inAssignmentPattern correctly follows dynamic scope