mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
fix ArrayIndex && NullPointer exceptions.
- use null function scope for implicit methods, - implicit methods have public visibility
This commit is contained in:
parent
0e1ef5c03c
commit
d5375ee2e1
1 changed files with 17 additions and 0 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
|
||||
|
@ -92,6 +93,22 @@ public class CPPImplicitMethod extends CPPMethod {
|
|||
return scope;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IFunction#getFunctionScope()
|
||||
*/
|
||||
public IScope getFunctionScope() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl == null ) {
|
||||
//12.1-5, 12.8-10 Implicitl constructors and assignment operators are public
|
||||
return ICPPASTVisiblityLabel.v_public;
|
||||
}
|
||||
return super.getVisibility();
|
||||
}
|
||||
|
||||
public IBinding resolveParameter( IASTParameterDeclaration param ){
|
||||
IASTName name = param.getDeclarator().getName();
|
||||
IParameter binding = (IParameter) name.getBinding();
|
||||
|
|
Loading…
Add table
Reference in a new issue