本文整理汇总了C++中StatementList::replace方法的典型用法代码示例。如果您正苦于以下问题:C++ StatementList::replace方法的具体用法?C++ StatementList::replace怎么用?C++ StatementList::replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementList
的用法示例。
在下文中一共展示了StatementList::replace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_procedure_definition
void RemoveUnsupportedStatements::do_procedure_definition(ProcedureDefinition* p)
{
procDef = p ;
assert(procDef != NULL) ;
OutputInformation("Remove Unsupported statements begins") ;
CForStatement* innermost = InnermostLoop(procDef) ;
if (innermost == NULL)
{
OutputInformation("Remove Unsupported statements ends") ;
return ;
}
StatementList* parentList =
dynamic_cast<StatementList*>(innermost->get_parent()) ;
CForStatement* outerLoops =
dynamic_cast<CForStatement*>(innermost->get_parent()) ;
CForStatement* outermostLoop = innermost ;
while (parentList == NULL && outerLoops != NULL)
{
parentList = dynamic_cast<StatementList*>(outerLoops->get_parent()) ;
outermostLoop = outerLoops ;
outerLoops = dynamic_cast<CForStatement*>(outerLoops->get_parent()) ;
}
assert(parentList != NULL) ;
assert(outermostLoop != NULL) ;
int position = DeterminePosition(parentList, outermostLoop) ;
assert(position >= 0) ;
for (int i = 0 ; i < position ; ++i)
{
StatementList* blankList = create_statement_list(theEnv) ;
Statement* toReplace = parentList->get_statement(i) ;
parentList->replace(toReplace, blankList) ;
// Will this delete kill me?
//delete toReplace ;
}
for (int i = position + 1 ; i < parentList->get_statement_count() ; ++i)
{
StatementList* blankList = create_statement_list(theEnv) ;
Statement* toReplace = parentList->get_statement(i) ;
parentList->replace(toReplace, blankList) ;
// Will this delete kill me?... yep! or not...
//delete toReplace ;
}
OutputInformation("Remove Unsupported statments ends") ;
}