github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/ast/filter.go (about) 1 // Copyright 2018 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package ast 5 6 func (desc *Description) Filter(predicate func(Node) bool) *Description { 7 desc1 := &Description{} 8 for _, n := range desc.Nodes { 9 if predicate(n) { 10 desc1.Nodes = append(desc1.Nodes, n.Clone()) 11 } 12 } 13 return desc1 14 }