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