Avoid returning an error for null document (#721)

This commit is contained in:
Shuhei Kitagawa 2025-05-07 14:29:47 +02:00 committed by GitHub
parent 0203d69117
commit 427b18e1b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 470 additions and 456 deletions

View file

@ -1892,7 +1892,7 @@ func (d *Decoder) parse(ctx context.Context, bytes []byte) (*ast.File, error) {
if err != nil {
return nil, err
}
if v != nil {
if v != nil || (doc.Body != nil && doc.Body.Type() == ast.NullType) {
normalizedFile.Docs = append(normalizedFile.Docs, doc)
cm := CommentMap{}
maps.Copy(cm, d.toCommentMap)

File diff suppressed because it is too large Load diff