1
0
Fork 0
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:
Doug Schaefer 2006-01-20 19:28:56 +00:00
parent f61c63ba58
commit f5223537de
8 changed files with 50 additions and 35 deletions

View file

@ -2138,6 +2138,7 @@ public class CPPSemantics {
if( useImplicit ){ if( useImplicit ){
ICPPFunctionType ftype = (ICPPFunctionType) ((ICPPFunction)fn).getType(); ICPPFunctionType ftype = (ICPPFunctionType) ((ICPPFunction)fn).getType();
if (ftype != null) {
IScope scope = fn.getScope(); IScope scope = fn.getScope();
if( scope instanceof ICPPTemplateScope ) if( scope instanceof ICPPTemplateScope )
scope = scope.getParent(); scope = scope.getParent();
@ -2158,6 +2159,7 @@ public class CPPSemantics {
result[0] = implicitType; result[0] = implicitType;
} }
}
for( int i = 0; i < params.length; i++ ) for( int i = 0; i < params.length; i++ )
result = (IType[]) ArrayUtil.append( IType.class, result, params[i].getType() ); result = (IType[]) ArrayUtil.append( IType.class, result, params[i].getType() );
@ -2260,7 +2262,11 @@ public class CPPSemantics {
} else } else
varArgs = true; 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 //13.3.1-4 for static member functions, the implicit object parameter is considered to match any object
cost = new Cost( source, target ); cost = new Cost( source, target );
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost cost.rank = Cost.IDENTITY_RANK; //exact match, no cost

View file

@ -234,6 +234,7 @@ abstract class BaseScanner implements IScanner {
} }
private static class EvalException extends Exception { private static class EvalException extends Exception {
private static final long serialVersionUID = 0;
public EvalException(String msg) { public EvalException(String msg) {
super(msg); super(msg);
} }
@ -1296,7 +1297,7 @@ abstract class BaseScanner implements IScanner {
locIncludePaths = einfo.getLocalIncludePath(); locIncludePaths = einfo.getLocalIncludePath();
pushContext(reader.buffer, reader); pushContext(reader.buffer, reader);
if (preIncludeFiles.hasNext()) while (preIncludeFiles.hasNext())
pushForcedInclusion(); pushForcedInclusion();
isInitialized = true; isInitialized = true;
@ -1383,8 +1384,6 @@ abstract class BaseScanner implements IScanner {
bufferData[bufferStackPos] = null; bufferData[bufferStackPos] = null;
--bufferStackPos; --bufferStackPos;
if (preIncludeFiles.hasNext())
pushForcedInclusion();
return result; return result;
} }
@ -1639,7 +1638,7 @@ abstract class BaseScanner implements IScanner {
// Return null to signify end of file // Return null to signify end of file
protected IToken fetchToken() throws EndOfFileException { protected IToken fetchToken() throws EndOfFileException {
++count; ++count;
contextLoop: while (bufferStackPos >= 0) { while (bufferStackPos >= 0) {
if (isCancelled == true) if (isCancelled == true)
throw new ParseError( throw new ParseError(
ParseError.ParseErrorKind.TIMEOUT_OR_CANCELLED); ParseError.ParseErrorKind.TIMEOUT_OR_CANCELLED);
@ -2165,7 +2164,7 @@ abstract class BaseScanner implements IScanner {
int stringLen = 0; int stringLen = 0;
boolean escaped = false; boolean escaped = false;
boolean foundClosingQuote = false; boolean foundClosingQuote = false;
loop: while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) { while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) {
++stringLen; ++stringLen;
char c = buffer[bufferPos[bufferStackPos]]; char c = buffer[bufferPos[bufferStackPos]];
if (c == '"') { if (c == '"') {

View file

@ -74,11 +74,13 @@ public class PDOMCPPClassType extends PDOMMemberOwner implements ICPPClassType,
} }
public ICPPBase[] getBases() throws DOMException { public ICPPBase[] getBases() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return new ICPPBase[0];
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return new ICPPConstructor[0];
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() throws DOMException {

View file

@ -72,7 +72,8 @@ public class PDOMCPPField extends PDOMMember implements ICPPField {
} }
public IType getType() throws DOMException { public IType getType() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return null;
} }
public boolean isAuto() throws DOMException { public boolean isAuto() throws DOMException {

View file

@ -59,7 +59,8 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
} }
public IFunctionType getType() throws DOMException { public IFunctionType getType() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return null;
} }
public boolean isAuto() throws DOMException { public boolean isAuto() throws DOMException {

View file

@ -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.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; 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.CPPBlockScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField; 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 { public PDOMBinding adaptBinding(IBinding binding) throws CoreException {
if (binding == null) if (binding == null || binding instanceof IProblemBinding)
return null; return null;
PDOMNode parent = getParent(binding); PDOMNode parent = getParent(binding);

View file

@ -60,7 +60,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
} }
public IParameter[] getParameters() throws DOMException { public IParameter[] getParameters() throws DOMException {
throw new PDOMNotImplementedError(); // TODO - need some real parameters
return new IParameter[0];
} }
public IScope getFunctionScope() throws DOMException { public IScope getFunctionScope() throws DOMException {
@ -68,11 +69,13 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
} }
public IFunctionType getType() throws DOMException { public IFunctionType getType() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return null;
} }
public boolean isStatic() throws DOMException { public boolean isStatic() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return false;
} }
public boolean isExtern() throws DOMException { public boolean isExtern() throws DOMException {
@ -88,7 +91,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
} }
public boolean takesVarArgs() throws DOMException { public boolean takesVarArgs() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return false;
} }
public String[] getQualifiedName() throws DOMException { public String[] getQualifiedName() throws DOMException {

View file

@ -44,7 +44,8 @@ public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable {
} }
public IType getType() throws DOMException { public IType getType() throws DOMException {
throw new PDOMNotImplementedError(); // TODO
return null;
} }
public boolean isAuto() throws DOMException { public boolean isAuto() throws DOMException {