1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00
This commit is contained in:
John Camelon 2004-05-11 15:53:26 +00:00
parent a92b1a4015
commit 6043c77b35
4 changed files with 25 additions and 6 deletions

View file

@ -59,7 +59,7 @@ public interface IASTCompletionNode {
public static final CompletionKind PREPROCESSOR_DIRECTIVE = new CompletionKind( 13 );
// any place where a type or variable name is expected to be introduced
public static final CompletionKind USER_SPECIFIED_NAME = new CompletionKind( 14 );
public static final CompletionKind NESTED_NAME_REFERENCE = new CompletionKind( 14 );
// any place where function parameters are expected
public static final CompletionKind FUNCTION_REFERENCE = new CompletionKind( 15 );

View file

@ -806,4 +806,10 @@ public class DeclarationWrapper implements IDeclaratorOwner
{
return extensionParameters;
}
/**
* @return
*/
public boolean consumedRawType() {
return( getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED );
}
}

View file

@ -1669,11 +1669,11 @@ public abstract class Parser extends ExpressionParser implements IParser
if (lookAheadForDeclarator(flags))
{
setTypeName(sdw, typeNameBegin, typeNameEnd);
return;
}
setCompletionValues(sdw.getScope(), kind, key );
ITokenDuple d = name(sdw.getScope(), kind, key );
IASTCompletionNode.CompletionKind ourKind = determineDeclSpecCompletionKind(sdw, kind);
setCompletionValues(sdw.getScope(), ourKind, key );
ITokenDuple d = name(sdw.getScope(), ourKind, key );
sdw.setTypeName(d);
sdw.setSimpleType( IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME );
flags.setEncounteredTypename(true);
@ -1728,6 +1728,19 @@ public abstract class Parser extends ExpressionParser implements IParser
return;
}
/**
* @param sdw
* @param kind
* @return
*/
protected CompletionKind determineDeclSpecCompletionKind(DeclarationWrapper sdw, CompletionKind kind) {
if( kind == CompletionKind.ARGUMENT_TYPE ) return kind;
if( sdw.getScope() instanceof IASTCompilationUnit || sdw.getScope() instanceof IASTNamespaceDefinition )
return sdw.consumedRawType() ? CompletionKind.NESTED_NAME_REFERENCE: kind;
return kind;
}
/**
* @param sdw
* @param typeNameBegin
* @param typeNameEnd

View file

@ -885,8 +885,8 @@ public class CompletionEngine implements RelevanceConstants {
kindStr = "NEW_TYPE_REFERENCE"; //$NON-NLS-1$
else if(kind == IASTCompletionNode.CompletionKind.PREPROCESSOR_DIRECTIVE)
kindStr = "PREPROCESSOR_DIRECTIVE"; //$NON-NLS-1$
else if(kind == IASTCompletionNode.CompletionKind.USER_SPECIFIED_NAME)
kindStr = "USER_SPECIFIED_NAME"; //$NON-NLS-1$
else if(kind == IASTCompletionNode.CompletionKind.NESTED_NAME_REFERENCE)
kindStr = "NESTED_NAME_REFERENCE"; //$NON-NLS-1$
else if(kind == IASTCompletionNode.CompletionKind.STRUCT_REFERENCE)
kindStr = "STRUCT_REFERENCE"; //$NON-NLS-1$
else if(kind == IASTCompletionNode.CompletionKind.UNION_REFERENCE)