1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

Fix for 174809, anonymous types in content assist.

This commit is contained in:
Markus Schorn 2007-02-22 10:29:39 +00:00
parent a9aa8b8cba
commit 335ae395bd
2 changed files with 17 additions and 9 deletions

View file

@ -27,7 +27,7 @@ public class CompletionTest_AnonymousTypes extends CompletionProposalsBaseTest{
public CompletionTest_AnonymousTypes(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=174809
setExpectFailure(174809);
// setExpectFailure(174809);
}
public static Test suite() {

View file

@ -7,6 +7,7 @@
*
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@ -196,17 +197,24 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
protected void handleBinding(IBinding binding,
CContentAssistInvocationContext cContext,
IASTCompletionContext astContext, List proposals) {
if (binding instanceof ICPPClassType) {
handleClass((ICPPClassType) binding, cContext, proposals);
} else if (binding instanceof IFunction) {
handleFunction((IFunction)binding, cContext, proposals);
} else if (binding instanceof IVariable) {
handleVariable((IVariable) binding, cContext, proposals);
} else if (!cContext.isContextInformationStyle()) {
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
if (!isAnonymousBinding(binding)) {
if (binding instanceof ICPPClassType) {
handleClass((ICPPClassType) binding, cContext, proposals);
} else if (binding instanceof IFunction) {
handleFunction((IFunction)binding, cContext, proposals);
} else if (binding instanceof IVariable) {
handleVariable((IVariable) binding, cContext, proposals);
} else if (!cContext.isContextInformationStyle()) {
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
}
}
}
private boolean isAnonymousBinding(IBinding binding) {
char[] name= binding.getNameCharArray();
return name.length == 0 || name[0] == '{';
}
private void handleClass(ICPPClassType classType, CContentAssistInvocationContext context, List proposals) {
if (context.isContextInformationStyle()) {
try {