本文整理汇总了C++中BlockScopeRawPtr::getContainingClass方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockScopeRawPtr::getContainingClass方法的具体用法?C++ BlockScopeRawPtr::getContainingClass怎么用?C++ BlockScopeRawPtr::getContainingClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockScopeRawPtr
的用法示例。
在下文中一共展示了BlockScopeRawPtr::getContainingClass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCPPDecl
string Type::getCPPDecl(AnalysisResultConstPtr ar,
BlockScopeRawPtr scope,
CodeGenerator *cg /* = 0 */) {
switch (m_kindOf) {
case KindOfBoolean: return "bool";
case KindOfInt32: return "int";
case KindOfInt64: return "int64";
case KindOfDouble: return "double";
case KindOfString: return "String";
case KindOfArray: return "Array";
case KindOfObject:{
ClassScopePtr cls(getClass(ar, scope));
if (!cls) return "Object";
if (cg && cg->isFileOrClassHeader() && scope) {
if (scope->getContainingClass()) {
scope->getContainingClass()->addUsedClassHeader(cls);
} else if (scope->getContainingFile()) {
scope->getContainingFile()->addUsedClassHeader(cls);
}
}
return Option::SmartPtrPrefix + cls->getId();
}
case KindOfNumeric: return "Numeric";
case KindOfPrimitive: return "Primitive";
case KindOfPlusOperand: return "PlusOperand";
case KindOfSequence: return "Sequence";
default:
return "Variant";
}
}
示例2: outputCPPDecl
void Type::outputCPPDecl(CodeGenerator &cg, AnalysisResultConstPtr ar,
BlockScopeRawPtr scope) {
cg_printf(getCPPDecl(cg, ar, scope).c_str());
if (isSpecificObject() && cg.isFileOrClassHeader() && scope) {
if (scope->getContainingClass()) {
scope->getContainingClass()->addUsedClassHeader(m_name);
} else if (scope->getContainingFile()) {
scope->getContainingFile()->addUsedClassHeader(m_name);
}
}
}
示例3: resolveClass
ClassScopePtr StaticClassName::resolveClass() {
m_present = false;
m_unknown = true;
if (m_class) return ClassScopePtr();
BlockScopeRawPtr scope = originalScope(this);
if (m_self) {
if (ClassScopePtr self = scope->getContainingClass()) {
m_className = self->getName();
m_origClassName = self->getOriginalName();
m_present = true;
m_unknown = false;
return self;
}
} else if (m_parent) {
if (ClassScopePtr self = scope->getContainingClass()) {
if (!self->getOriginalParent().empty()) {
m_className = Util::toLower(self->getOriginalParent());
m_origClassName = self->getOriginalParent();
m_present = true;
}
} else {
m_parent = false;
}
}
ClassScopePtr cls = scope->getContainingProgram()->findClass(m_className);
if (cls) {
m_unknown = false;
if (cls->isVolatile()) {
ClassScopeRawPtr c = scope->getContainingFile()->resolveClass(cls);
if (!c) {
c = scope->getContainingClass();
if (c && c->getName() != m_className) c.reset();
}
m_present = c.get() != 0;
if (cls->isRedeclaring()) {
cls = c;
if (!m_present) m_redeclared = true;
}
} else {
m_present = true;
}
}
return cls;
}
示例4: resolveClassWithChecks
ClassScopePtr StaticClassName::resolveClassWithChecks() {
ClassScopePtr cls = resolveClass();
if (!m_class && !cls) {
Construct *self = dynamic_cast<Construct*>(this);
BlockScopeRawPtr scope = self->getScope();
if (isRedeclared()) {
scope->getVariables()->setAttribute(VariableTable::NeedGlobalPointer);
} else if (scope->isFirstPass()) {
ClassScopeRawPtr cscope = scope->getContainingClass();
if (!cscope ||
!cscope->isTrait() ||
(!isSelf() && !isParent())) {
Compiler::Error(Compiler::UnknownClass, self->shared_from_this());
}
}
}
return cls;
}
示例5: checkPresent
bool StaticClassName::checkPresent() {
if (m_self || m_parent || m_static) return true;
BlockScopeRawPtr scope = originalScope(this);
FileScopeRawPtr currentFile = scope->getContainingFile();
if (currentFile) {
AnalysisResultPtr ar = currentFile->getContainingProgram();
ClassScopeRawPtr cls = ar->findClass(m_className);
if (!cls) return false;
if (!cls->isVolatile()) return true;
if (currentFile->resolveClass(cls)) return true;
if (currentFile->checkClass(m_className)) return true;
}
if (ClassScopePtr self = scope->getContainingClass()) {
if (m_className == self->getName() ||
self->derivesFrom(scope->getContainingProgram(), m_className,
true, false)) {
return true;
}
}
return false;
}
示例6: getOriginalClass
ClassScopeRawPtr Expression::getOriginalClass() {
BlockScopeRawPtr scope = getOriginalScope();
return scope ? scope->getContainingClass() : ClassScopeRawPtr();
}