func _AttachAnnotation(node ast.Node, annotations ...*ast.Annotation) { anns := Annotations(node) anns = append(anns, annotations...) node.SetExtra(ExtraAnnotation, anns) }
// Annotations . func _RemoveAnnotation(node ast.Node, annotation *ast.Annotation) { anns := Annotations(node) var newanns []*ast.Annotation for _, ann := range anns { if ann == annotation { continue } newanns = append(newanns, ann) } node.SetExtra(ExtraAnnotation, anns) }
func _AttachComment(node ast.Node, comment *ast.Comment) bool { nodeStart, nodeEnd := Pos(node) commentStart, commentEnd := Pos(comment) if nodeStart.Lines == commentEnd.Lines || nodeStart.Lines == commentEnd.Lines+1 || nodeEnd.Lines == commentStart.Lines { node.SetExtra(ExtraComment, comment) return true } return false }
func _setNodePos(node ast.Node, start lexer.Position, end lexer.Position) { node.SetExtra(ExtraStartPos, start) node.SetExtra(ExtraEndPos, end) }