hphp/compiler/analysis/file_scope.cpp
/*
 * Insert the class, and its parents (recursively) into m_providedDefs,
 * returning true if the class was already known to exist.
 * If def is true, this is the actual definition for the class,
 * so set the hasBase flags.
 */
Insert the class, and its parents (recursively) into m_providedDefs,
returning true if the class was already known to exist.
If def is true, this is the actual definition for the class,
so set the hasBase flags.
Insert the class and its parents ( recursively ) into m_providedDefs returning true if the class was already known to exist . If def is true this is the actual definition for the class so set the hasBase flags .
bool FileScope::insertClassUtil(AnalysisResultPtr ar,
                                ClassScopeRawPtr cls, bool def) {
  if (!m_providedDefs.insert(cls).second) return true;
  const vector<string> &bases = cls->getBases();
  bool topBasesKnown = def && bases.size() > 31;
  for (unsigned i = 0; i < bases.size(); i++) {
    const string &s = bases[i];
    ClassScopeRawPtr c = ar->findClass(s);
    if (c) {
      if (c->isRedeclaring()) {
        ClassScopeRawPtr cr = resolveClass(c);
        if (!cr) {
          if (i >= 31) topBasesKnown = false;
          m_redecBases.insert(c->getName());
          continue;
        }
        c = cr;
      } else if (!c->isVolatile()) {
        if (def && i < 31) cls->setKnownBase(i);
        continue;
      }
      if (insertClassUtil(ar, c, false)) {
        if (def && i < 31) cls->setKnownBase(i);
      } else {
        if (i >= 31) topBasesKnown = false;
      }
    }
  }
  if (topBasesKnown) cls->setKnownBase(31);
  return false;
}
bool FileScope :: insertClassUtil ( AnalysisResultPtr ar , ClassScopeRawPtr cls , bool def ) { if ( ! m_providedDefs . insert ( cls ) . second ) return true ; const vector < string > & bases = cls -> getBases ( ) ; bool topBasesKnown = def && bases . size ( ) > 31 ; for ( unsigned i = 0 ; i < bases . size ( ) ; i ++ ) { const string & s = bases [ i ] ; ClassScopeRawPtr c = ar -> findClass ( s ) ; if ( c ) { if ( c -> isRedeclaring ( ) ) { ClassScopeRawPtr cr = resolveClass ( c ) ; if ( ! cr ) { if ( i >= 31 ) topBasesKnown = false ; m_redecBases . insert ( c -> getName ( ) ) ; continue ; } c = cr ; } else if ( ! c -> isVolatile ( ) ) { if ( def && i < 31 ) cls -> setKnownBase ( i ) ; continue ; } if ( insertClassUtil ( ar , c , false ) ) { if ( def && i < 31 ) cls -> setKnownBase ( i ) ; } else { if ( i >= 31 ) topBasesKnown = false ; } } } if ( topBasesKnown ) cls -> setKnownBase ( 31 ) ; return false ; }
Insert the class, and its parents (recursively) into m_providedDefs,
 returning true if the class was already known to exist.
Insert the class and its parents ( recursively ) into m_providedDefs returning true if the class was already known to exist .