def _AddCompileTargets(target, roots, add_if_no_ancestor, result):
  if target.visited:
    return

  target.visited = True
  target.in_roots = target in roots

  for back_dep_target in target.back_deps:
    _AddCompileTargets(back_dep_target, roots, False, result)
    target.added_to_compile_targets |= back_dep_target.added_to_compile_targets
    target.in_roots |= back_dep_target.in_roots
    target.is_or_has_linked_ancestor |= (
      back_dep_target.is_or_has_linked_ancestor)

  # Always add 'executable' targets. Even though they may be built by other
  # targets that depend upon them it makes detection of what is going to be
  # built easier.
  # And always add static_libraries that have no dependencies on them from
  # linkables. This is necessary as the other dependencies on them may be
  # static libraries themselves, which are not compile time dependencies.
  if target.in_roots and \
        (target.is_executable or
         (not target.added_to_compile_targets and
          (add_if_no_ancestor or target.requires_build)) or
         (target.is_static_library and add_if_no_ancestor and
          not target.is_or_has_linked_ancestor)):
    print '\t\tadding to compile targets', target.name, 'executable', \
           target.is_executable, 'added_to_compile_targets', \
           target.added_to_compile_targets, 'add_if_no_ancestor', \
           add_if_no_ancestor, 'requires_build', target.requires_build, \
           'is_static_library', target.is_static_library, \
           'is_or_has_linked_ancestor', target.is_or_has_linked_ancestor
    result.add(target)
    target.added_to_compile_targets = True
Create a filter that performs all the given filters.
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/generator/analyzer.py/_AddCompileTargets--crossover with--dataset/ETHPy150Open ODM2/ODMToolsPython/odmtools/lib/oldOlv/Filter.py/Chain.__init__