Commit b43f2792 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed type checking for type definitions inside an @implementation

parent 10f94d67
...@@ -135,18 +135,24 @@ void CheckUndefinedSymbols::buildTypeMap(Class *klass) ...@@ -135,18 +135,24 @@ void CheckUndefinedSymbols::buildTypeMap(Class *klass)
addType(klass->name()); addType(klass->name());
for (unsigned i = 0; i < klass->memberCount(); ++i) { for (unsigned i = 0; i < klass->memberCount(); ++i) {
Symbol *member = klass->memberAt(i); buildMemberTypeMap(klass->memberAt(i));
}
if (Class *klass = member->asClass()) { }
buildTypeMap(klass);
} else if (Enum *e = member->asEnum()) { void CheckUndefinedSymbols::buildMemberTypeMap(Symbol *member)
addType(e->name()); {
} else if (ForwardClassDeclaration *fwd = member->asForwardClassDeclaration()) { if (member == 0)
addType(fwd->name()); return;
} else if (Declaration *decl = member->asDeclaration()) {
if (decl->isTypedef()) if (Class *klass = member->asClass()) {
addType(decl->name()); buildTypeMap(klass);
} } else if (Enum *e = member->asEnum()) {
addType(e->name());
} else if (ForwardClassDeclaration *fwd = member->asForwardClassDeclaration()) {
addType(fwd->name());
} else if (Declaration *decl = member->asDeclaration()) {
if (decl->isTypedef())
addType(decl->name());
} }
} }
...@@ -176,10 +182,16 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa ...@@ -176,10 +182,16 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa
addType(fKlass->name()); addType(fKlass->name());
} else if (ObjCClass *klass = member->asObjCClass()) { } else if (ObjCClass *klass = member->asObjCClass()) {
addType(klass->name()); addType(klass->name());
for (unsigned i = 0; i < klass->memberCount(); ++i)
buildMemberTypeMap(klass->memberAt(i));
} else if (ObjCForwardProtocolDeclaration *fProto = member->asObjCForwardProtocolDeclaration()) { } else if (ObjCForwardProtocolDeclaration *fProto = member->asObjCForwardProtocolDeclaration()) {
addType(fProto->name()); addType(fProto->name());
} else if (ObjCProtocol *proto = member->asObjCProtocol()) { } else if (ObjCProtocol *proto = member->asObjCProtocol()) {
addType(proto->name()); addType(proto->name());
for (unsigned i = 0; i < proto->memberCount(); ++i)
buildMemberTypeMap(proto->memberAt(i));
} }
} }
} }
......
...@@ -57,6 +57,7 @@ protected: ...@@ -57,6 +57,7 @@ protected:
void addType(Name *name); void addType(Name *name);
void buildTypeMap(Class *klass); void buildTypeMap(Class *klass);
void buildMemberTypeMap(Symbol *member);
void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed); void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed);
FunctionDeclaratorAST *currentFunctionDeclarator() const; FunctionDeclaratorAST *currentFunctionDeclarator() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment