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