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