Skip to content

Commit

Permalink
take into account lines with errors when comparing rpn lists
Browse files Browse the repository at this point in the history
  • Loading branch information
thunder422 committed Apr 5, 2013
1 parent 3a23179 commit d810bba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rpnlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ QString RpnList::text(void)
// function to overload the comparison operator
bool RpnList::operator==(const RpnList &other) const
{
if (hasError() && !other.hasError() || !hasError() && other.hasError())
{
return false; // one list has error and the other does not
}
if (hasError())
{
return m_errorToken->column() == other.m_errorToken->column()
&& m_errorToken->length() == other.m_errorToken->length()
&& m_errorMessage == other.m_errorMessage;
}
if (count() != other.count())
{
return false;
Expand Down

0 comments on commit d810bba

Please sign in to comment.