mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Fix for 192636, ClassCastException in name resolution.
This commit is contained in:
parent
ad7f173337
commit
2870b81e2c
2 changed files with 47 additions and 2 deletions
|
@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
@ -262,7 +263,14 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
if( size > 0 ){
|
if( size > 0 ){
|
||||||
for( int i = 0; i < size; i++ ){
|
for( int i = 0; i < size; i++ ){
|
||||||
IASTParameterDeclaration p = params[i];
|
IASTParameterDeclaration p = params[i];
|
||||||
result[i] = (IParameter) p.getDeclarator().getName().resolveBinding();
|
final IASTName name = p.getDeclarator().getName();
|
||||||
|
final IBinding binding= name.resolveBinding();
|
||||||
|
if (binding instanceof IParameter) {
|
||||||
|
result[i]= (IParameter) binding;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +66,42 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter {
|
||||||
|
public CPPParameterProblem( IASTNode node, int id, char[] arg ) {
|
||||||
|
super( node, id, arg );
|
||||||
|
}
|
||||||
|
public IType getType() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean isStatic() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean isExtern() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean isAuto() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean isRegister() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean hasDefaultValue() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isMutable() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public String[] getQualifiedName() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
|
throw new DOMException( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IType type = null;
|
private IType type = null;
|
||||||
private IASTName [] declarations = null;
|
private IASTName [] declarations = null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue