1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

Fix for PR 75728 [ParserSymbolTable] NPE in TypeInfoProvider.newTypeInfo.

Corrected mappings added to to TemplateSymbol._defnParameterMap.
This commit is contained in:
Vladimir Hirsl 2004-10-06 20:30:49 +00:00
parent 1f751745a9
commit d029959807
3 changed files with 34 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2004-10-06 Vladimir Hirsl
Fix for PR 75728 [ParserSymbolTable] NPE in TypeInfoProvider.newTypeInfo
Corrected mappings added to to TemplateSymbol._defnParameterMap
* parser/org/eclipse/cdt/internal/core/parser/ast/TemplateFactory.java
Another NPE fix (caused by the fact that UndefinedTemplateSymbols do not have
any associated extension objects).
* parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
2004-09-30 Vladimir Hirsl
Fix for PR 60307 [Templates] Template parameter qualified types not supported

View file

@ -345,7 +345,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
}
else
{
if( startingScope.getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope )
if( startingScope.getASTExtension() != null &&
startingScope.getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope )
{
if( ((IASTCodeScope) startingScope.getASTExtension().getPrimaryDeclaration()).getContainingFunction() instanceof IASTMethod )
{

View file

@ -278,17 +278,34 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor
int size = templates.size();
for( int i = 0; i < size; i++ ){
ITemplateSymbol template = (ITemplateSymbol) templates.get(i);
ITemplateSymbol origTemplate = (ITemplateSymbol) ((ISymbol)symbols.get(i)).getContainingSymbol();
ISymbol origContainer = (ISymbol) symbols.get(i);
if ( origContainer instanceof IDeferredTemplateInstance )
origContainer = ((IDeferredTemplateInstance) origContainer).getTemplate().getTemplatedSymbol();
ITemplateSymbol origTemplate = (ITemplateSymbol)origContainer.getContainingSymbol();
ObjectMap containerDefnMap = null;
List tList = template.getParameterList();
if( origTemplate.getDefinitionParameterMap().containsKey( origContainer ) ){
containerDefnMap = (ObjectMap) origTemplate.getDefinitionParameterMap().get( origContainer );
}
List oList = origTemplate.getParameterList();
int tListSize = tList.size();
if( oList.size() < tListSize )
throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
ObjectMap defnMap = new ObjectMap(tListSize);
for( int j = 0; j < tListSize; j++ ){
for( int j = 0; j < tListSize; j++ ) {
ISymbol param = (ISymbol) tList.get(j);
ISymbol origParam = (ISymbol) oList.get(j);
if( containerDefnMap != null ) {
ISymbol keyParam, valParam;
for( int k = 0; k < containerDefnMap.size(); ++k ) {
keyParam = (ISymbol) containerDefnMap.keyAt( k );
valParam = (ISymbol) containerDefnMap.getAt( k );
if ( valParam.equals(origParam) ) {
origParam = keyParam;
break;
}
}
}
defnMap.put( param, origParam );
}