本文整理汇总了C++中BlockScopeRawPtr::getOuterScope方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockScopeRawPtr::getOuterScope方法的具体用法?C++ BlockScopeRawPtr::getOuterScope怎么用?C++ BlockScopeRawPtr::getOuterScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockScopeRawPtr
的用法示例。
在下文中一共展示了BlockScopeRawPtr::getOuterScope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeProgram
void ScalarExpression::analyzeProgram(AnalysisResultPtr ar) {
if (ar->getPhase() == AnalysisResult::AnalyzeAll) {
auto const id = HPHP::toLower(getIdentifier());
switch (m_type) {
case T_LINE:
m_translated = folly::to<std::string>(line1());
break;
case T_NS_C:
m_translated = m_value;
break;
// case T_TRAIT_C: Note: T_TRAIT_C is translated at parse time
case T_CLASS_C:
case T_METHOD_C: {
if (!m_translated.empty()) break;
BlockScopeRawPtr b = getScope();
while (b && b->is(BlockScope::FunctionScope)) {
b = b->getOuterScope();
}
m_translated.clear();
if (b && b->is(BlockScope::ClassScope)) {
auto clsScope = dynamic_pointer_cast<ClassScope>(b);
if (!clsScope->isTrait()) {
m_translated = clsScope->getOriginalName();
}
}
if (m_type == T_METHOD_C) {
if (FunctionScopePtr func = getFunctionScope()) {
if (b && b->is(BlockScope::ClassScope)) {
m_translated += "::";
}
if (func->isClosure()) {
m_translated += "{closure}";
} else {
m_translated += func->getOriginalName();
}
}
}
break;
}
case T_FUNC_C:
if (FunctionScopePtr func = getFunctionScope()) {
if (func->isClosure()) {
m_translated = "{closure}";
} else {
m_translated = func->getOriginalName();
}
}
break;
default:
break;
}
}
}