in autorest/config.go [54:81]
func allCodeBlocks(node *ast.Node) []ast.CodeBlock {
if node == nil {
return nil
}
switch v := (*node).(type) {
case *ast.Container:
out := make([]ast.CodeBlock, 0)
for _, child := range v.Children {
out = append(out, allCodeBlocks(&child)...)
}
return out
case *ast.Document:
out := make([]ast.CodeBlock, 0)
for _, child := range v.Children {
out = append(out, allCodeBlocks(&child)...)
}
return out
case *ast.Paragraph:
out := make([]ast.CodeBlock, 0)
for _, child := range v.Children {
out = append(out, allCodeBlocks(&child)...)
}
return out
case *ast.CodeBlock:
return []ast.CodeBlock{*v}
}
return nil
}