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