MCPcopy Create free account
hub / github.com/devosoft/avida / VisitIfBlock

Method VisitIfBlock

avida-core/source/script/cDirectInterpretASTVisitor.cc:262–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261
262void cDirectInterpretASTVisitor::VisitIfBlock(cASTIfBlock& node)
263{
264 node.GetCondition()->Accept(*this);
265
266 if (asBool(m_rtype, m_rvalue, node)) {
267 node.GetCode()->Accept(*this);
268 } else {
269 bool exec = false;
270 tListIterator<cASTIfBlock::cElseIf> it = node.ElseIfIterator();
271 cASTIfBlock::cElseIf* ei = NULL;
272 while ((ei = it.Next())) {
273 ei->GetCondition()->Accept(*this);
274 if (asBool(m_rtype, m_rvalue, node)) {
275 exec = true;
276 ei->GetCode()->Accept(*this);
277 break;
278 }
279 }
280
281 if (!exec && node.HasElse()) node.GetElseCode()->Accept(*this);
282 }
283}
284
285
286void cDirectInterpretASTVisitor::VisitWhileBlock(cASTWhileBlock& node)

Callers

nothing calls this directly

Calls 7

AcceptMethod · 0.80
ElseIfIteratorMethod · 0.80
HasElseMethod · 0.80
GetElseCodeMethod · 0.80
GetConditionMethod · 0.45
GetCodeMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected