1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix a few NPE's.

This commit is contained in:
John Camelon 2004-08-13 18:58:56 +00:00
parent 5e29d237f6
commit c827e9e543
3 changed files with 22 additions and 3 deletions

View file

@ -1355,7 +1355,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
* that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64) * that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
*/ */
protected ITypeInfo usualArithmeticConversions( IASTScope scope, ITypeInfo lhs, ITypeInfo rhs) throws ASTSemanticException{ protected ITypeInfo usualArithmeticConversions( IASTScope scope, ITypeInfo lhs, ITypeInfo rhs) throws ASTSemanticException{
if( lhs == null ) return null;
if( rhs == null ) return null;
// if you have a variable of type basic type, then we need to go to the basic type first // if you have a variable of type basic type, then we need to go to the basic type first
while( (lhs.getType() == ITypeInfo.t_type) && (lhs.getTypeSymbol() != null)){ while( (lhs.getType() == ITypeInfo.t_type) && (lhs.getTypeSymbol() != null)){
lhs = lhs.getTypeSymbol().getTypeInfo(); lhs = lhs.getTypeSymbol().getTypeInfo();

View file

@ -82,7 +82,7 @@ public class Scanner2 implements IScanner, IScannerData {
private ISourceElementRequestor requestor; private ISourceElementRequestor requestor;
private ParserLanguage language; private ParserLanguage language;
protected IParserLogService log; private IParserLogService log;
private IScannerExtension scannerExtension; private IScannerExtension scannerExtension;
private CharArrayObjectMap definitions = new CharArrayObjectMap(512); private CharArrayObjectMap definitions = new CharArrayObjectMap(512);
@ -207,13 +207,30 @@ public class Scanner2 implements IScanner, IScannerData {
pushContext(buffer); pushContext(buffer);
bufferData[bufferStackPos] = data; bufferData[bufferStackPos] = data;
if( data instanceof InclusionData ) if( data instanceof InclusionData )
{
requestor.enterInclusion( ((InclusionData)data).inclusion ); requestor.enterInclusion( ((InclusionData)data).inclusion );
if( log.isTracing() )
{
StringBuffer b = new StringBuffer( "Entering inclusion "); //$NON-NLS-1$
b.append( ((InclusionData)data).reader.filename );
log.traceLog( b.toString() );
}
}
} }
private void popContext() { private void popContext() {
bufferStack[bufferStackPos] = null; bufferStack[bufferStackPos] = null;
if( bufferData[bufferStackPos] instanceof InclusionData ) if( bufferData[bufferStackPos] instanceof InclusionData )
{
if( log.isTracing() )
{
StringBuffer buffer = new StringBuffer( "Exiting inclusion "); //$NON-NLS-1$
buffer.append( ((InclusionData)bufferData[bufferStackPos]).reader.filename );
log.traceLog( buffer.toString() );
}
requestor.exitInclusion( ((InclusionData)bufferData[bufferStackPos]).inclusion ); requestor.exitInclusion( ((InclusionData)bufferData[bufferStackPos]).inclusion );
}
bufferData[bufferStackPos] = null; bufferData[bufferStackPos] = null;
bufferLineNums[bufferStackPos] = 1; bufferLineNums[bufferStackPos] = 1;
--bufferStackPos; --bufferStackPos;

View file

@ -74,6 +74,7 @@ public class TokenFactory {
} }
public static ITokenDuple createTokenDuple( ITokenDuple firstDuple, ITokenDuple secondDuple ){ public static ITokenDuple createTokenDuple( ITokenDuple firstDuple, ITokenDuple secondDuple ){
if( secondDuple == null ) return firstDuple;
List [] f1 = firstDuple.getTemplateIdArgLists(); List [] f1 = firstDuple.getTemplateIdArgLists();
List [] f2 = secondDuple.getTemplateIdArgLists(); List [] f2 = secondDuple.getTemplateIdArgLists();
if( f1 == null && f2 == null ) if( f1 == null && f2 == null )