C++: Rename ClassOrNamespace -> LookupScope

Change-Id: Ide74482b133dd1fec40a725d9aa81bd749385f37
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-04-20 17:42:34 +03:00
committed by Orgad Shaneh
parent 9e1e11db60
commit cb350bfeb2
29 changed files with 461 additions and 464 deletions

View File

@@ -65,12 +65,12 @@ class MkVisitor: protected SymbolVisitor
{
const LookupContext &context;
Overview oo;
QList<ClassOrNamespace *> interfaces;
QList<ClassOrNamespace *> nodes;
QList<LookupScope *> interfaces;
QList<LookupScope *> nodes;
bool isMiscNode(ClassOrNamespace *b) const
bool isMiscNode(LookupScope *b) const
{
foreach (ClassOrNamespace *u, b->usings()) {
foreach (LookupScope *u, b->usings()) {
if (oo(u->symbols().first()->name()) == QLatin1String("AST"))
return true;
}
@@ -78,7 +78,7 @@ class MkVisitor: protected SymbolVisitor
return false;
}
QString getAcceptFunctionName(ClassOrNamespace *b, QString *retType) const
QString getAcceptFunctionName(LookupScope *b, QString *retType) const
{
Q_ASSERT(b != 0);
@@ -131,7 +131,7 @@ public:
<< " Semantic(TranslationUnit *unit): ASTVisitor(unit) { translationUnit(unit->ast()->asTranslationUnit()); }" << std::endl
<< std::endl;
foreach (ClassOrNamespace *b, interfaces) {
foreach (LookupScope *b, interfaces) {
Q_ASSERT(! b->symbols().isEmpty());
Class *klass = 0;
@@ -162,10 +162,10 @@ public:
std::cout << " using ASTVisitor::translationUnit;" << std::endl
<< std::endl;
QHash<ClassOrNamespace *, QList<ClassOrNamespace *> > implements;
foreach (ClassOrNamespace *b, nodes) {
ClassOrNamespace *iface = 0;
foreach (ClassOrNamespace *u, b->usings()) {
QHash<LookupScope *, QList<LookupScope *> > implements;
foreach (LookupScope *b, nodes) {
LookupScope *iface = 0;
foreach (LookupScope *u, b->usings()) {
if (interfaces.contains(u)) {
iface = u;
break;
@@ -175,8 +175,8 @@ public:
implements[iface].append(b);
}
foreach (ClassOrNamespace *iface, interfaces) {
foreach (ClassOrNamespace *b, implements.value(iface)) {
foreach (LookupScope *iface, interfaces) {
foreach (LookupScope *b, implements.value(iface)) {
if (! isMiscNode(b))
continue;
@@ -195,9 +195,9 @@ public:
std::cout << std::endl;
foreach (ClassOrNamespace *iface, interfaces) {
foreach (LookupScope *iface, interfaces) {
std::cout << " // " << qPrintable(oo(iface->symbols().first()->name())) << std::endl;
foreach (ClassOrNamespace *b, implements.value(iface)) {
foreach (LookupScope *b, implements.value(iface)) {
Class *klass = 0;
foreach (Symbol *s, b->symbols())
if ((klass = s->asClass()) != 0)
@@ -212,7 +212,7 @@ public:
}
std::cout << "private:" << std::endl;
foreach (ClassOrNamespace *b, interfaces) {
foreach (LookupScope *b, interfaces) {
Q_ASSERT(! b->symbols().isEmpty());
Class *klass = 0;
@@ -245,7 +245,7 @@ public:
// implementation
foreach (ClassOrNamespace *b, interfaces) {
foreach (LookupScope *b, interfaces) {
Q_ASSERT(! b->symbols().isEmpty());
Class *klass = 0;
@@ -280,9 +280,9 @@ public:
<< std::endl;
}
foreach (ClassOrNamespace *iface, interfaces) {
foreach (LookupScope *iface, interfaces) {
std::cout << "// " << qPrintable(oo(iface->symbols().first()->name())) << std::endl;
foreach (ClassOrNamespace *b, implements.value(iface)) {
foreach (LookupScope *b, implements.value(iface)) {
Class *klass = 0;
foreach (Symbol *s, b->symbols())
if ((klass = s->asClass()) != 0)
@@ -331,7 +331,7 @@ public:
Control *control = context.thisDocument()->control();
const Name *n = control->identifier(name.toLatin1().constData());
if (ClassOrNamespace *bb = context.lookupType(n, klass)) {
if (LookupScope *bb = context.lookupType(n, klass)) {
QString retTy;
QString funcName = getAcceptFunctionName(bb, &retTy);
Q_ASSERT(! funcName.isEmpty());
@@ -350,7 +350,7 @@ public:
continue;
}
if (ClassOrNamespace *ty = context.lookupType(namedTy->name(), klass)) {
if (LookupScope *ty = context.lookupType(namedTy->name(), klass)) {
QString className = oo(ty->symbols().first()->name());
QString baseClassName = className;
if (baseClassName.endsWith(QLatin1String("AST"))) {
@@ -386,9 +386,9 @@ public:
protected:
using SymbolVisitor::visit;
QList<ClassOrNamespace *> baseClasses(ClassOrNamespace *b) {
QList<ClassOrNamespace *> usings = b->usings();
foreach (ClassOrNamespace *u, usings)
QList<LookupScope *> baseClasses(LookupScope *b) {
QList<LookupScope *> usings = b->usings();
foreach (LookupScope *u, usings)
usings += baseClasses(u);
return usings;
}
@@ -398,14 +398,14 @@ protected:
if (! className.endsWith(QLatin1String("AST")))
return false;
ClassOrNamespace *b = context.lookupType(klass);
LookupScope *b = context.lookupType(klass);
Q_ASSERT(b != 0);
const Identifier *accept0 = context.thisDocument()->control()->identifier("accept0");
if (Symbol *s = klass->find(accept0)) {
if (Function *meth = s->type()->asFunctionType()) {
if (! meth->isPureVirtual()) {
foreach (ClassOrNamespace *u, b->usings()) {
foreach (LookupScope *u, b->usings()) {
if (interfaces.contains(u)) {
// qDebug() << oo(klass->name()) << "implements" << oo(u->symbols().first()->name());
} else {