本文整理汇总了C++中Statement::accept方法的典型用法代码示例。如果您正苦于以下问题:C++ Statement::accept方法的具体用法?C++ Statement::accept怎么用?C++ Statement::accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::accept方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
SemanticAnalysis::visitBlockStatement(BlockStatement *node)
{
StatementList *stmts = node->statements();
for (size_t i = 0; i < stmts->length(); i++) {
Statement *stmt = stmts->at(i);
stmt->accept(this);
}
}
示例2: scope
void
SemanticAnalysis::visitBlockStatement(BlockStatement *node)
{
AutoEnterScope scope(&scope_, node->scope());
for (size_t i = 0; i < node->statements()->length(); i++) {
Statement *stmt = node->statements()->at(i);
stmt->accept(this);
}
}
示例3:
void Why3Translator::visitIndentedUnlessBlock(Statement const& _statement)
{
bool isBlock = !!dynamic_cast<Block const*>(&_statement);
if (isBlock)
newLine();
else
indent();
_statement.accept(*this);
if (isBlock)
newLine();
else
unindent();
}
示例4:
bool
SemanticAnalysis::analyze(ParseTree *tree)
{
for (size_t i = 0; i < tree->statements()->length(); i++) {
Statement *stmt = tree->statements()->at(i);
stmt->accept(this);
if (!cc_.canContinueProcessing())
return false;
}
return cc_.phasePassed();
}
示例5: new
JsonObject *analyze(ParseTree *tree) {
functions_ = new (pool_) JsonList();
methodmaps_ = new (pool_) JsonList();
enums_ = new (pool_) JsonList();
constants_ = new (pool_) JsonList();
typesets_ = new (pool_) JsonList();
typedefs_ = new (pool_) JsonList();
for (size_t i = 0; i < tree->statements()->length(); i++) {
Statement *stmt = tree->statements()->at(i);
stmt->accept(this);
}
JsonObject *obj = new (pool_) JsonObject();
obj->add(cc_.add("functions"), functions_);
obj->add(cc_.add("methodmaps"), methodmaps_);
obj->add(cc_.add("enums"), enums_);
obj->add(cc_.add("constants"), constants_);
obj->add(cc_.add("typesets"), typesets_);
obj->add(cc_.add("typedefs"), typedefs_);
return obj;
}
示例6: testVisitor
void RtlTest::testVisitor()
{
StmtVisitorStub* visitor = new StmtVisitorStub();
/* rtl */
RTL *rtl = new RTL();
rtl->accept(visitor);
CPPUNIT_ASSERT(visitor->a);
delete rtl;
/* jump stmt */
GotoStatement *jump = new GotoStatement;
jump->accept(visitor);
CPPUNIT_ASSERT(visitor->b);
delete jump;
/* branch stmt */
BranchStatement *jcond = new BranchStatement;
jcond->accept(visitor);
CPPUNIT_ASSERT(visitor->c);
delete jcond;
/* nway jump stmt */
CaseStatement *nwayjump = new CaseStatement;
nwayjump->accept(visitor);
CPPUNIT_ASSERT(visitor->d);
delete nwayjump;
/* call stmt */
CallStatement *call = new CallStatement;
call->accept(visitor);
CPPUNIT_ASSERT(visitor->e);
delete call;
/* return stmt */
ReturnStatement *ret = new ReturnStatement;
ret->accept(visitor);
CPPUNIT_ASSERT(visitor->f);
delete ret;
/* "bool" assgn */
BoolAssign *scond = new BoolAssign(0);
scond->accept(visitor);
CPPUNIT_ASSERT(visitor->g);
delete scond;
/* assignment stmt */
Assign *as = new Assign;
as->accept(visitor);
CPPUNIT_ASSERT(visitor->h);
delete as;
/* polymorphic */
Statement* s = new CallStatement;
s->accept(visitor);
CPPUNIT_ASSERT(visitor->e);
delete s;
/* cleanup */
delete visitor;
}