00001 #include <typeinfo> 00002 #include "ifstatement.h" 00003 using namespace std; 00004 00005 Ast& IfStatement::operator = (const Ast& ast) { 00006 const IfStatement& ifStatement = dynamic_cast<const IfStatement&>(ast); 00007 00008 Ast::operator=(ast); 00009 this->guardedStatement = ifStatement.guardedStatement ? dynamic_cast<GuardedStatement*>(&(ifStatement.guardedStatement->clone())) : 0; 00010 00011 return *(this); 00012 } 00013 00014 bool IfStatement::operator == (const Ast& ast) const { 00015 bool result = false; 00016 const IfStatement& ifStatement = dynamic_cast<const IfStatement&>(ast); 00017 00018 if (typeid(ast) != typeid(IfStatement)) 00019 return false; 00020 00021 if (this->guardedStatement) 00022 result = (*(this->guardedStatement) == *(ifStatement.guardedStatement)); 00023 00024 return result; 00025 } 00026