Use const names.

This commit is contained in:
Roberto Raggi
2009-12-01 12:46:15 +01:00
parent f2e77fb8fd
commit 7c7ce13ac0
46 changed files with 577 additions and 642 deletions

View File

@@ -48,7 +48,7 @@ const Overview *NamePrettyPrinter::overview() const
return _overview;
}
QString NamePrettyPrinter::operator()(Name *name)
QString NamePrettyPrinter::operator()(const Name *name)
{
QString previousName = switchName();
accept(name);
@@ -62,7 +62,7 @@ QString NamePrettyPrinter::switchName(const QString &name)
return previousName;
}
void NamePrettyPrinter::visit(NameId *name)
void NamePrettyPrinter::visit(const NameId *name)
{
const Identifier *id = name->identifier();
if (id)
@@ -71,7 +71,7 @@ void NamePrettyPrinter::visit(NameId *name)
_name = QLatin1String("anonymous");
}
void NamePrettyPrinter::visit(TemplateNameId *name)
void NamePrettyPrinter::visit(const TemplateNameId *name)
{
const Identifier *id = name->identifier();
if (id)
@@ -93,14 +93,14 @@ void NamePrettyPrinter::visit(TemplateNameId *name)
_name += QLatin1Char('>');
}
void NamePrettyPrinter::visit(DestructorNameId *name)
void NamePrettyPrinter::visit(const DestructorNameId *name)
{
const Identifier *id = name->identifier();
_name += QLatin1Char('~');
_name += QString::fromLatin1(id->chars(), id->size());
}
void NamePrettyPrinter::visit(OperatorNameId *name)
void NamePrettyPrinter::visit(const OperatorNameId *name)
{
_name += QLatin1String("operator ");
switch (name->kind()) { // ### i should probably do this in OperatorNameId
@@ -236,13 +236,13 @@ void NamePrettyPrinter::visit(OperatorNameId *name)
} // switch
}
void NamePrettyPrinter::visit(ConversionNameId *name)
void NamePrettyPrinter::visit(const ConversionNameId *name)
{
_name += QLatin1String("operator ");
_name += overview()->prettyType(name->type());
}
void NamePrettyPrinter::visit(QualifiedNameId *name)
void NamePrettyPrinter::visit(const QualifiedNameId *name)
{
if (name->isGlobal())
_name += QLatin1String("::");
@@ -254,10 +254,10 @@ void NamePrettyPrinter::visit(QualifiedNameId *name)
}
}
void NamePrettyPrinter::visit(SelectorNameId *name)
void NamePrettyPrinter::visit(const SelectorNameId *name)
{
for (unsigned i = 0; i < name->nameCount(); ++i) {
Name *n = name->nameAt(i);
const Name *n = name->nameAt(i);
if (!n)
continue;