(node ast.Node, filtered ast.Node, comment *ast.CommentGroupNode)
| 220 | } |
| 221 | |
| 222 | func (e *Encoder) setLineCommentToParentMapNode(node ast.Node, filtered ast.Node, comment *ast.CommentGroupNode) error { |
| 223 | parent := ast.Parent(node, filtered) |
| 224 | if parent == nil { |
| 225 | return ErrUnsupportedLinePositionType(node) |
| 226 | } |
| 227 | switch p := parent.(type) { |
| 228 | case *ast.MappingValueNode: |
| 229 | if err := p.Key.SetComment(comment); err != nil { |
| 230 | return err |
| 231 | } |
| 232 | case *ast.MappingNode: |
| 233 | if err := p.SetComment(comment); err != nil { |
| 234 | return err |
| 235 | } |
| 236 | default: |
| 237 | return ErrUnsupportedLinePositionType(parent) |
| 238 | } |
| 239 | return nil |
| 240 | } |
| 241 | |
| 242 | func (e *Encoder) setFootComment(node ast.Node, filtered ast.Node, comment *ast.CommentGroupNode) error { |
| 243 | parent := ast.Parent(node, filtered) |
no test coverage detected