mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Fixed an NPE.
Change-Id: I20e5a2c2a452159224cd8af5a3e0c434801b67cc
This commit is contained in:
parent
d77511f4c4
commit
52f4104080
1 changed files with 6 additions and 3 deletions
|
@ -86,9 +86,12 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
public IScope getParent() {
|
||||
// We can't just resolve the function and get its parent scope, since there are cases where that
|
||||
// could loop because resolving functions requires resolving their parameter types.
|
||||
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode();
|
||||
IASTName name = fdtor.getName().getLastName();
|
||||
return CPPVisitor.getContainingNonTemplateScope(name);
|
||||
IASTFunctionDeclarator funcDeclarator = (IASTFunctionDeclarator) getPhysicalNode();
|
||||
IASTName name = funcDeclarator.getName();
|
||||
if (name != null)
|
||||
return CPPVisitor.getContainingNonTemplateScope(name.getLastName());
|
||||
|
||||
return super.getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue