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