bool AnalysisResult::checkClassPresent(ConstructPtr cs, const std::string &name) const { if (name == "self" || name == "parent") return true; std::string lowerName = toLower(name); if (ClassScopePtr currentCls = cs->getClassScope()) { if (lowerName == currentCls->getName() || currentCls->derivesFrom(shared_from_this(), lowerName, true, false)) { return true; } } if (FileScopePtr currentFile = cs->getFileScope()) { StatementList &stmts = *currentFile->getStmt(); for (int i = stmts.getCount(); i--; ) { StatementPtr s = stmts[i]; if (s && s->is(Statement::KindOfClassStatement)) { ClassScopePtr scope = static_pointer_cast<ClassStatement>(s)->getClassScope(); if (lowerName == scope->getName()) { return true; } if (scope->derivesFrom(shared_from_this(), lowerName, true, false)) { return true; } } } } return false; }
ClassScopePtr AnalysisResult::findExactClass(ConstructPtr cs, const std::string &name) const { ClassScopePtr cls = findClass(name); if (!cls || !cls->isRedeclaring()) return cls; if (ClassScopePtr currentCls = cs->getClassScope()) { if (cls->isNamed(currentCls->getScopeName())) { return currentCls; } } return ClassScopePtr(); }