(leading bool, grp *ast.CommentGroup)
| 149 | } |
| 150 | |
| 151 | func syntheticComments(leading bool, grp *ast.CommentGroup) []bindings.SyntheticComment { |
| 152 | cmts := []bindings.SyntheticComment{} |
| 153 | if grp == nil { |
| 154 | return cmts |
| 155 | } |
| 156 | for _, c := range grp.List { |
| 157 | normalizedText := normalizeCommentText(c.Text) |
| 158 | cmts = append(cmts, bindings.SyntheticComment{ |
| 159 | Leading: leading, |
| 160 | SingleLine: !strings.Contains(normalizedText, "\n"), |
| 161 | Text: normalizedText, |
| 162 | TrailingNewLine: true, |
| 163 | }) |
| 164 | } |
| 165 | return cmts |
| 166 | } |
| 167 | |
| 168 | func normalizeCommentText(text string) string { |
| 169 | // TODO: Is there a better way to get just the text of the comment? |
no test coverage detected
searching dependent graphs…