Merge CPlusPlus::NameId and CPlusPlus::Identifier.

This commit is contained in:
Roberto Raggi
2010-09-02 11:59:01 +02:00
parent 8b2eeb9c5f
commit c12866a467
25 changed files with 69 additions and 131 deletions

View File

@@ -47,6 +47,7 @@
// THE SOFTWARE.
#include "Literals.h"
#include "NameVisitor.h"
#include <cstring>
#include <algorithm>
#include <iostream>
@@ -69,7 +70,7 @@ Literal::Literal(const char *chars, unsigned size)
Literal::~Literal()
{ delete[] _chars; }
bool Literal::isEqualTo(const Literal *other) const
bool Literal::equalTo(const Literal *other) const
{
if (! other)
return false;
@@ -212,3 +213,18 @@ Identifier::Identifier(const char *chars, unsigned size)
Identifier::~Identifier()
{ }
void Identifier::accept0(NameVisitor *visitor) const
{ visitor->visit(this); }
bool Identifier::isEqualTo(const Name *other) const
{
if (this == other)
return true;
else if (other) {
if (const Identifier *nameId = other->asNameId()) {
return equalTo(nameId);
}
}
return false;
}