From 9838c1b3878108fadcf04c02eb7d875e30d34efb Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Tue, 9 Mar 2004 19:07:22 +0000 Subject: [PATCH] bug 52948 - Content Assist -typedef'd types do not appear in the completion list --- .../parser/ChangeLog-parser | 5 +++++ .../ast/complete/CompleteParseASTFactory.java | 7 ++++++- .../internal/core/parser/pst/TypeFilter.java | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog-parser b/core/org.eclipse.cdt.core/parser/ChangeLog-parser index 7e8612ba6fc..09861b1631b 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog-parser +++ b/core/org.eclipse.cdt.core/parser/ChangeLog-parser @@ -1,3 +1,8 @@ +2004-03-09 Andrew Niefer + bug 52948 + modified CompleteParseASTFactory.createTypedef() to set the typeSymbol of the typedef symbol + modified TypeFilter to handle LookupKind.TYPES and LookupKind.TYPEDEFS + 2004-03-09 John Camelon Put back the work to reconcile relative paths w/IResource readers which was lost upon merge. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index 975ab89647d..0a0dd0af3dc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -2480,7 +2480,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IContainerSymbol containerSymbol = scopeToSymbol(scope); ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type); newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef ); - + + ISymbol typeSymbol = cloneSimpleTypeSymbol( "", mapping, new ArrayList() ); + setPointerOperators( typeSymbol, mapping.getPointerOperators(), mapping.getArrayModifiers() ); + + newSymbol.setTypeSymbol( typeSymbol ); + List references = new ArrayList(); if( mapping.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier ) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java index f82cecd8918..cf35a58b50b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java @@ -74,6 +74,15 @@ public class TypeFilter { return false; } } + else if ( typeInfo.isType( TypeInfo.t_type ) && typeInfo.checkBit( TypeInfo.isTypedef ) ){ + if( acceptedKinds.contains( LookupKind.TYPEDEFS ) || + acceptedKinds.contains( LookupKind.TYPES ) ) + { + return true; + } else { + return false; + } + } else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t__Bool, TypeInfo.t_void ) ) { if( ( acceptedKinds.contains( LookupKind.VARIABLES ) && !symbolIsMember && !symbolIsLocal ) || @@ -99,14 +108,19 @@ public class TypeFilter { else if ( kind == LookupKind.STRUCTURES ) { acceptedTypes.add( TypeInfo.t_class ); acceptedTypes.add( TypeInfo.t_struct ); acceptedTypes.add( TypeInfo.t_union ); } - else if ( kind == LookupKind.STRUCTS ) { acceptedTypes.add( TypeInfo.t_struct ); } + else if ( kind == LookupKind.STRUCTS ) { acceptedTypes.add( TypeInfo.t_struct ); } else if ( kind == LookupKind.UNIONS ) { acceptedTypes.add( TypeInfo.t_union ); } else if ( kind == LookupKind.CLASSES ) { acceptedTypes.add( TypeInfo.t_class ); } else if ( kind == LookupKind.CONSTRUCTORS ){ acceptedTypes.add( TypeInfo.t_constructor ); } else if ( kind == LookupKind.NAMESPACES ) { acceptedTypes.add( TypeInfo.t_namespace ); } else if ( kind == LookupKind.ENUMERATIONS ){ acceptedTypes.add( TypeInfo.t_enumeration ); } else if ( kind == LookupKind.ENUMERATORS ) { acceptedTypes.add( TypeInfo.t_enumerator ); } - else if ( kind == LookupKind.TYPEDEFS ) { acceptedTypes.add( TypeInfo.t_type ); } +// else if ( kind == LookupKind.TYPEDEFS ) { acceptedTypes.add( TypeInfo.t_type ); } + else if ( kind == LookupKind.TYPES ) { acceptedTypes.add( TypeInfo.t_class ); + acceptedTypes.add( TypeInfo.t_struct ); + acceptedTypes.add( TypeInfo.t_union ); + acceptedTypes.add( TypeInfo.t_enumeration ); } + }