If* Ast::CreateIf(const location& loc, AstNode* test, AstNode* body, AstNode* orelse, AstNode* trailingElse) { If *newIf = new If(this, loc, test, body, orelse); if(trailingElse) { newIf->GetTerminalElif()->SetOrElse(trailingElse); } return newIf; }
If* If::GetTerminalElif() { if (orelse.size() == 1) { If *tail = dynamic_cast<If*>(orelse[0]); if (tail) { return tail->GetTerminalElif(); } } return this; }