FBGraphEdgeFilterBlock FBFilterBlockWithObjectToManyIvarsRelation()

in FBRetainCycleDetector/Filtering/FBStandardGraphEdgeFilters.mm [22:36]


FBGraphEdgeFilterBlock FBFilterBlockWithObjectToManyIvarsRelation(Class aCls,
                                                                  NSSet<NSString *> *ivarNames) {
  return ^(FBObjectiveCGraphElement *fromObject,
           NSString *byIvar,
           Class toObjectOfClass){
    if (aCls &&
        [[fromObject objectClass] isSubclassOfClass:aCls]) {
      // If graph element holds metadata about an ivar, it will be held in the name path, as early as possible
      if ([ivarNames containsObject:byIvar]) {
        return FBGraphEdgeInvalid;
      }
    }
    return FBGraphEdgeValid;
  };
}