Beispiel #1
0
bool check(const php::Func& f) {
  assert(checkParams(f));
  assert(checkName(f.name));
  for (DEBUG_ONLY auto& block : f.blocks) assert(checkBlock(*block));

  /*
   * Some of these relationships may change as async/await
   * implementation progresses.  Asserting them now so they are
   * revisited here if they aren't true anymore.
   */
  if (f.isClosureBody)          assert(!f.top);
  if (f.isPairGenerator)        assert(f.isGenerator);

  if (f.isClosureBody) {
    assert(f.cls &&
           f.cls->parentName &&
           f.cls->parentName->isame(s_Closure.get()));
  }

  boost::dynamic_bitset<> seenId(f.nextBlockId);
  for (auto& block : f.blocks) {
    assert(checkBlock(*block));

    // All blocks have unique ids in a given function; not necessarily
    // consecutive.
    assert(block->id < f.nextBlockId);
    assert(!seenId.test(block->id));
    seenId.set(block->id);
  }

  assert(checkExnTree(f));

  return true;
}
Beispiel #2
0
bool check(const php::Func& f) {
  assert(checkParams(f));
  assert(checkName(f.name));
  for (DEBUG_ONLY auto& block : f.blocks) assert(checkBlock(f, *block));

  /*
   * Some of these relationships may change as async/await
   * implementation progresses.  Asserting them now so they are
   * revisited here if they aren't true anymore.
   */
  if (f.isClosureBody)          assert(!f.top);
  if (f.isPairGenerator)        assert(f.isGenerator);

  if (f.isClosureBody) {
    assert(f.cls &&
           f.cls->parentName &&
           f.cls->parentName->isame(s_Closure.get()));
  }

  assert(checkExnTree(f));
  return true;
}