forked from qt-creator/qt-creator
C++: Resolve function-scope typedef inside lambda
Use-case:
struct Foo { int bar; };
void func()
{
typedef Foo F;
[]() {
F f;
f.bar; // bar not highlighted
};
}
Change-Id: Ifaee2d125931d993acad69f03031a675c6180858
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
1faf2bd1ef
commit
f8544bbc42
@@ -154,6 +154,13 @@ QList<LookupItem> TypeResolver::typedefsFromScopeUpToFunctionScope(const Name *n
|
||||
}
|
||||
}
|
||||
enclosingBlockScope = block->enclosingScope();
|
||||
if (enclosingBlockScope) {
|
||||
// For lambda, step beyond the function to its enclosing block
|
||||
if (Function *enclosingFunction = enclosingBlockScope->asFunction()) {
|
||||
if (!enclosingFunction->name())
|
||||
enclosingBlockScope = enclosingBlockScope->enclosingScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user