本文整理汇总了C++中TypeNode::getEnclosing方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeNode::getEnclosing方法的具体用法?C++ TypeNode::getEnclosing怎么用?C++ TypeNode::getEnclosing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeNode
的用法示例。
在下文中一共展示了TypeNode::getEnclosing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkTypeNameNode
bool TypeTree::checkTypeNameNode(TypeNode*& initialTypeTreeNode, TypeNode*& finalTypeTreeNode,
ScopeNameListNode* scopeNameListNode, TypeNode* enclosingTypeTreeNode, TemplateArguments* templateArguments)
{
assert(0 == templateArguments || templateArguments->m_classTypeNode->isTemplateClass());
initialTypeTreeNode = 0;
finalTypeTreeNode = 0;
std::vector<ScopeNameNode*> scopeNameNodes;
scopeNameListNode->collectIdentifyNodes(scopeNameNodes);
assert(!scopeNameNodes.empty());
if (0 != templateArguments && !scopeNameListNode->isGlobal())
{
ScopeNameNode* scopeNameNode = scopeNameNodes.front();
if (!scopeNameNode->isTemplateForm())
{
if (scopeNameNode->m_name->m_str == templateArguments->m_className)
{
initialTypeTreeNode = templateArguments->m_classTypeNode;
if (1 == scopeNameNodes.size())
{
//finalTypeTreeNode->isTemplateClass()
finalTypeTreeNode = initialTypeTreeNode;
return true;
}
else
{
//0 == finalTypeTreeNode || finalTypeTreeNode->isUnderTemplateClass()
scopeNameNodes.erase(scopeNameNodes.begin());
TypeNode* tmpTypeNode = 0;
return findNodeByScopeNames(tmpTypeNode, finalTypeTreeNode, scopeNameNodes, initialTypeTreeNode, 0);
}
}
initialTypeTreeNode = templateArguments->findTypeNode(scopeNameNode->m_name->m_str);
if(initialTypeTreeNode)
{
if (1 == scopeNameNodes.size())
{
//finalTypeTreeNode->isTemplateParameter()
finalTypeTreeNode = initialTypeTreeNode;
}
else
{
finalTypeTreeNode = 0;
}
return true;
}
}
}
if (scopeNameListNode->isGlobal())
{
return findNodeByScopeNames(initialTypeTreeNode, finalTypeTreeNode, scopeNameNodes, getRootNamespaceTypeNode(), templateArguments);
}
TypeNode* enclosing = enclosingTypeTreeNode;
while (enclosing)
{
if(findNodeByScopeNames(initialTypeTreeNode, finalTypeTreeNode, scopeNameNodes, enclosing, templateArguments))
{
return true;
}
enclosing = enclosing->getEnclosing();
}
initialTypeTreeNode = 0;
finalTypeTreeNode = 0;
bool result = false;
auto it = m_allNamespaces.begin();
auto end = m_allNamespaces.end();
for (; it != end; ++it)
{
TypeNode* tempInitialTypeTreeNode = 0;
TypeNode* tempFinalTypeTreeNode = 0;
if(findNodeByScopeNames(tempInitialTypeTreeNode, tempFinalTypeTreeNode, scopeNameNodes, *it, templateArguments))
{
if (result)
{
char buf[512];
std::string str;
scopeNameListNode->getString(str);
sprintf_s(buf, "\'%s\' : ambiguous type name could be %s(%d, %d) or %s(%d, %d)",
str.c_str(),
finalTypeTreeNode->m_sourceFile->m_fileName.c_str(),
finalTypeTreeNode->m_identifyNode->m_lineNo,
finalTypeTreeNode->m_identifyNode->m_columnNo,
tempFinalTypeTreeNode->m_sourceFile->m_fileName.c_str(),
tempFinalTypeTreeNode->m_identifyNode->m_lineNo,
tempFinalTypeTreeNode->m_identifyNode->m_columnNo);
ErrorList_AddItem_CurrentFile(scopeNameNodes.back()->m_name->m_lineNo,
scopeNameNodes.back()->m_name->m_columnNo, semantic_error_ambiguous_type_name, buf);
return false;
}
else
{
initialTypeTreeNode = tempInitialTypeTreeNode;
finalTypeTreeNode = tempFinalTypeTreeNode;
result = true;
}
}
}
if (!result)
//.........这里部分代码省略.........