mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-23 08:13:50 +02:00
PDOM - Fixed some NPE's and PDOMNotImplemented errors to plow through Mozilla (Firefox).
This commit is contained in:
parent
f61c63ba58
commit
f5223537de
8 changed files with 50 additions and 35 deletions
|
@ -2138,25 +2138,27 @@ public class CPPSemantics {
|
|||
|
||||
if( useImplicit ){
|
||||
ICPPFunctionType ftype = (ICPPFunctionType) ((ICPPFunction)fn).getType();
|
||||
IScope scope = fn.getScope();
|
||||
if( scope instanceof ICPPTemplateScope )
|
||||
scope = scope.getParent();
|
||||
ICPPClassType cls = null;
|
||||
if( scope instanceof ICPPClassScope ){
|
||||
cls = ((ICPPClassScope)scope).getClassType();
|
||||
} else {
|
||||
cls = new CPPClassType.CPPClassTypeProblem( scope.getPhysicalNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, fn.getNameCharArray() );
|
||||
}
|
||||
if( cls instanceof ICPPClassTemplate ){
|
||||
cls = (ICPPClassType) CPPTemplates.instantiateWithinClassTemplate( (ICPPClassTemplate) cls );
|
||||
}
|
||||
IType implicitType = cls;
|
||||
if( ftype.isConst() || ftype.isVolatile() ){
|
||||
implicitType = new CPPQualifierType( implicitType, ftype.isConst(), ftype.isVolatile() );
|
||||
}
|
||||
implicitType = new CPPReferenceType( implicitType );
|
||||
|
||||
result[0] = implicitType;
|
||||
if (ftype != null) {
|
||||
IScope scope = fn.getScope();
|
||||
if( scope instanceof ICPPTemplateScope )
|
||||
scope = scope.getParent();
|
||||
ICPPClassType cls = null;
|
||||
if( scope instanceof ICPPClassScope ){
|
||||
cls = ((ICPPClassScope)scope).getClassType();
|
||||
} else {
|
||||
cls = new CPPClassType.CPPClassTypeProblem( scope.getPhysicalNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, fn.getNameCharArray() );
|
||||
}
|
||||
if( cls instanceof ICPPClassTemplate ){
|
||||
cls = (ICPPClassType) CPPTemplates.instantiateWithinClassTemplate( (ICPPClassTemplate) cls );
|
||||
}
|
||||
IType implicitType = cls;
|
||||
if( ftype.isConst() || ftype.isVolatile() ){
|
||||
implicitType = new CPPQualifierType( implicitType, ftype.isConst(), ftype.isVolatile() );
|
||||
}
|
||||
implicitType = new CPPReferenceType( implicitType );
|
||||
|
||||
result[0] = implicitType;
|
||||
}
|
||||
}
|
||||
for( int i = 0; i < params.length; i++ )
|
||||
result = (IType[]) ArrayUtil.append( IType.class, result, params[i].getType() );
|
||||
|
@ -2260,7 +2262,11 @@ public class CPPSemantics {
|
|||
} else
|
||||
varArgs = true;
|
||||
|
||||
if( useImplicitObj && j == 0 && ((ICPPInternalFunction)currFn).isStatic( false ) ) {
|
||||
if( useImplicitObj && j == 0 &&
|
||||
(currFn instanceof ICPPInternalFunction
|
||||
? ((ICPPInternalFunction)currFn).isStatic(false)
|
||||
: currFn.isStatic())
|
||||
) {
|
||||
//13.3.1-4 for static member functions, the implicit object parameter is considered to match any object
|
||||
cost = new Cost( source, target );
|
||||
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
|
||||
|
|
|
@ -234,6 +234,7 @@ abstract class BaseScanner implements IScanner {
|
|||
}
|
||||
|
||||
private static class EvalException extends Exception {
|
||||
private static final long serialVersionUID = 0;
|
||||
public EvalException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
@ -1296,7 +1297,7 @@ abstract class BaseScanner implements IScanner {
|
|||
locIncludePaths = einfo.getLocalIncludePath();
|
||||
pushContext(reader.buffer, reader);
|
||||
|
||||
if (preIncludeFiles.hasNext())
|
||||
while (preIncludeFiles.hasNext())
|
||||
pushForcedInclusion();
|
||||
|
||||
isInitialized = true;
|
||||
|
@ -1383,8 +1384,6 @@ abstract class BaseScanner implements IScanner {
|
|||
bufferData[bufferStackPos] = null;
|
||||
--bufferStackPos;
|
||||
|
||||
if (preIncludeFiles.hasNext())
|
||||
pushForcedInclusion();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1639,7 +1638,7 @@ abstract class BaseScanner implements IScanner {
|
|||
// Return null to signify end of file
|
||||
protected IToken fetchToken() throws EndOfFileException {
|
||||
++count;
|
||||
contextLoop: while (bufferStackPos >= 0) {
|
||||
while (bufferStackPos >= 0) {
|
||||
if (isCancelled == true)
|
||||
throw new ParseError(
|
||||
ParseError.ParseErrorKind.TIMEOUT_OR_CANCELLED);
|
||||
|
@ -2165,7 +2164,7 @@ abstract class BaseScanner implements IScanner {
|
|||
int stringLen = 0;
|
||||
boolean escaped = false;
|
||||
boolean foundClosingQuote = false;
|
||||
loop: while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) {
|
||||
while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) {
|
||||
++stringLen;
|
||||
char c = buffer[bufferPos[bufferStackPos]];
|
||||
if (c == '"') {
|
||||
|
|
|
@ -74,11 +74,13 @@ public class PDOMCPPClassType extends PDOMMemberOwner implements ICPPClassType,
|
|||
}
|
||||
|
||||
public ICPPBase[] getBases() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return new ICPPBase[0];
|
||||
}
|
||||
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return new ICPPConstructor[0];
|
||||
}
|
||||
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
|
|
|
@ -72,7 +72,8 @@ public class PDOMCPPField extends PDOMMember implements ICPPField {
|
|||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
|
|
@ -59,7 +59,8 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
|||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField;
|
||||
|
@ -155,7 +156,7 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
|||
}
|
||||
|
||||
public PDOMBinding adaptBinding(IBinding binding) throws CoreException {
|
||||
if (binding == null)
|
||||
if (binding == null || binding instanceof IProblemBinding)
|
||||
return null;
|
||||
|
||||
PDOMNode parent = getParent(binding);
|
||||
|
|
|
@ -60,7 +60,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
|||
}
|
||||
|
||||
public IParameter[] getParameters() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO - need some real parameters
|
||||
return new IParameter[0];
|
||||
}
|
||||
|
||||
public IScope getFunctionScope() throws DOMException {
|
||||
|
@ -68,11 +69,13 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
|||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isExtern() throws DOMException {
|
||||
|
@ -88,7 +91,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
|||
}
|
||||
|
||||
public boolean takesVarArgs() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
|
|
|
@ -44,7 +44,8 @@ public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable {
|
|||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
|
Loading…
Add table
Reference in a new issue