Skip to content

Commit

Permalink
Fix: map docs (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Dec 26, 2022
1 parent 36e8265 commit 37d2c66
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/bcd/ast/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,11 @@ func (m *Map) Docs(inferredName string) ([]Typedef, string, error) {
if err != nil {
return nil, "", err
}
typedef.Args = append(typedef.Args, TypedefArg{Key: keyDocs[0].Name, Value: keyVarName})

if len(keyDocs) == 0 {
typedef.Args = append(typedef.Args, TypedefArg{Value: keyVarName})
} else {
typedef.Args = append(typedef.Args, TypedefArg{Key: keyDocs[0].Name, Value: keyVarName})
}
valDocs, valVarName, err := m.ValueType.Docs(fmt.Sprintf("%s_value", name))
if err != nil {
return nil, "", err
Expand Down

0 comments on commit 37d2c66

Please sign in to comment.