本文整理汇总了C++中AnalysisResultPtr::findClasses方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::findClasses方法的具体用法?C++ AnalysisResultPtr::findClasses怎么用?C++ AnalysisResultPtr::findClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisResultPtr
的用法示例。
在下文中一共展示了AnalysisResultPtr::findClasses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkDerivation
void ClassScope::checkDerivation(AnalysisResultPtr ar, hphp_string_iset &seen) {
seen.insert(m_name);
hphp_string_iset bases;
for (int i = m_bases.size() - 1; i >= 0; i--) {
const string &base = m_bases[i];
if (seen.find(base) != seen.end() || bases.find(base) != bases.end()) {
Compiler::Error(
Compiler::InvalidDerivation,
m_stmt,
"The class hierarchy contains a circular reference involving " + base);
if (i == 0 && !m_parent.empty()) {
assert(base == m_parent);
m_parent.clear();
}
m_bases.erase(m_bases.begin() + i);
continue;
}
bases.insert(base);
ClassScopePtrVec parents = ar->findClasses(toLower(base));
for (unsigned int j = 0; j < parents.size(); j++) {
parents[j]->checkDerivation(ar, seen);
}
}
seen.erase(m_name);
}
示例2: implementsArrayAccess
int ClassScope::implementsArrayAccess(AnalysisResultPtr ar) {
hphp_const_char_imap<int>::iterator it = m_implemented.find("arrayaccess");
if (it != m_implemented.end()) {
return it->second;
}
int ret = 0;
unsigned s = m_parent.empty() ? 0 : 1;
for (unsigned i = s; i < m_bases.size(); i++) {
if (strcasecmp(m_bases[i].c_str(), "arrayaccess")) {
ret = 1;
break;
}
}
if (s && !ret) {
int yes = 0, no = 0;
const ClassScopePtrVec &classes = ar->findClasses(m_parent);
BOOST_FOREACH(ClassScopePtr cls, classes) {
int a = cls->implementsArrayAccess(ar);
if (a < 0) {
yes = no = 1;
break;
}
if (a > 0) {
yes++;
} else {
no++;
}
}