本文整理汇总了C++中FunctionScopePtr::setContainsThis方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionScopePtr::setContainsThis方法的具体用法?C++ FunctionScopePtr::setContainsThis怎么用?C++ FunctionScopePtr::setContainsThis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionScopePtr
的用法示例。
在下文中一共展示了FunctionScopePtr::setContainsThis方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeProgram
void SimpleVariable::analyzeProgram(AnalysisResultPtr ar) {
Expression::analyzeProgram(ar);
if (m_name == "argc" || m_name == "argv") {
// special case: they are NOT superglobals when not in global scope
if (ar->getScope() == ar) {
m_superGlobal = BuiltinSymbols::IsSuperGlobal(m_name);
m_superGlobalType = BuiltinSymbols::GetSuperGlobalType(m_name);
}
} else {
m_superGlobal = BuiltinSymbols::IsSuperGlobal(m_name);
m_superGlobalType = BuiltinSymbols::GetSuperGlobalType(m_name);
}
if (m_superGlobal) {
ar->getScope()->getVariables()->
setAttribute(VariableTable::NeedGlobalPointer);
}
if (m_name == "this" && ar->getClassScope()) {
FunctionScopePtr func =
dynamic_pointer_cast<FunctionScope>(ar->getScope());
func->setContainsThis();
m_this = true;
} else if (m_name == "GLOBALS") {
m_globals = true;
}
if (!(m_context & AssignmentLHS)) {
BlockScopePtr scope = ar->getScope();
FunctionScopePtr func = dynamic_pointer_cast<FunctionScope>(scope);
if (func) {
func->getVariables()->addUsed(m_name);
}
}
}
示例2: setContainsThis
void FunctionScope::setContainsThis(bool f /* = true */) {
m_containsThis = f;
BlockScopePtr bs(this->getOuterScope());
while (bs && bs->is(BlockScope::FunctionScope)) {
FunctionScopePtr fs = static_pointer_cast<FunctionScope>(bs);
if (!fs->isClosure()) {
break;
}
fs->setContainsThis(f);
bs = bs->getOuterScope();
}
for (auto it = m_clonedTraitOuterScope.begin(); it != m_clonedTraitOuterScope.end(); it++) {
(*it)->setContainsThis(f);
}
}