1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 07:25:23 +02:00

Cosmetics.

Change-Id: Ibd8c8ac950c55c02259e9dfacb0649dfca8820dc
This commit is contained in:
Sergey Prigogin 2016-10-28 14:52:56 -07:00
parent d69b51acc8
commit 4fa9706ea8
3 changed files with 12 additions and 43 deletions

View file

@ -528,16 +528,16 @@ public class CPPVisitor extends ASTQueries {
return binding; return binding;
if (binding instanceof ICPPClassType) { if (binding instanceof ICPPClassType) {
final ICPPInternalBinding ib = (ICPPInternalBinding) binding; ICPPInternalBinding internalBinding = (ICPPInternalBinding) binding;
if (templateParametersMatch((ICPPClassType) binding, templateDecl)) { if (templateParametersMatch((ICPPClassType) binding, templateDecl)) {
ib.addDeclaration(elabType); internalBinding.addDeclaration(elabType);
return binding; return binding;
} }
if (CPPSemantics.declaredBefore(ib, name, false)) { if (CPPSemantics.declaredBefore(internalBinding, name, false)) {
return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION); return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION);
} }
markRedeclaration(ib); markRedeclaration(internalBinding);
} }
} }
@ -614,7 +614,7 @@ public class CPPVisitor extends ASTQueries {
return e.getProblem(); return e.getProblem();
} }
// Can't lookup anonymous names // Can't lookup anonymous names.
IBinding binding= null; IBinding binding= null;
ICPPASTTemplateDeclaration templateDecl = CPPTemplates.getTemplateDeclaration(name); ICPPASTTemplateDeclaration templateDecl = CPPTemplates.getTemplateDeclaration(name);
if (name.getLookupKey().length > 0 && scope != null) { if (name.getLookupKey().length > 0 && scope != null) {
@ -622,16 +622,16 @@ public class CPPVisitor extends ASTQueries {
if (binding instanceof ICPPInternalBinding if (binding instanceof ICPPInternalBinding
&& binding instanceof ICPPClassType && name.isActive()) { && binding instanceof ICPPClassType && name.isActive()) {
ICPPInternalBinding ib = (ICPPInternalBinding) binding; ICPPInternalBinding internalBinding = (ICPPInternalBinding) binding;
if (ib.getDefinition() == null if (internalBinding.getDefinition() == null
&& templateParametersMatch((ICPPClassType) binding, templateDecl)) { && templateParametersMatch((ICPPClassType) binding, templateDecl)) {
ASTInternal.addDefinition(ib, compType); ASTInternal.addDefinition(internalBinding, compType);
return binding; return binding;
} }
if (CPPSemantics.declaredBefore(ib, name, false)) { if (CPPSemantics.declaredBefore(internalBinding, name, false)) {
return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDEFINITION); return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDEFINITION);
} }
markRedeclaration(ib); markRedeclaration(internalBinding);
} }
} }
if (templateDecl != null) if (templateDecl != null)

View file

@ -15,8 +15,7 @@ package org.eclipse.cdt.ui.tests.text.contentassist2;
/** /**
* @author hamer * @author hamer
* *
* This abstract class is the base class for all completion proposals test cases * This abstract class is the base class for all completion proposals test cases.
*
*/ */
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -31,7 +30,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.cdt.ui.testplugin.CTestPlugin; import org.eclipse.cdt.ui.testplugin.CTestPlugin;
public abstract class CompletionProposalsBaseTest extends AbstractContentAssistTest { public abstract class CompletionProposalsBaseTest extends AbstractContentAssistTest {
private boolean fFailingTest; private boolean fFailingTest;
public CompletionProposalsBaseTest(String name) { public CompletionProposalsBaseTest(String name) {
@ -42,9 +40,6 @@ public abstract class CompletionProposalsBaseTest extends AbstractContentAssistT
super(name, isCpp); super(name, isCpp);
} }
/*
* @see junit.framework.TestCase#getName()
*/
@Override @Override
public String getName() { public String getName() {
if (fFailingTest) { if (fFailingTest) {
@ -53,9 +48,6 @@ public abstract class CompletionProposalsBaseTest extends AbstractContentAssistT
return super.getName(); return super.getName();
} }
/*
* @see org.eclipse.cdt.core.testplugin.util.BaseTestCase#setExpectFailure(int)
*/
@Override @Override
public void setExpectFailure(int bugnumber) { public void setExpectFailure(int bugnumber) {
super.setExpectFailure(bugnumber); super.setExpectFailure(bugnumber);

View file

@ -18,10 +18,8 @@ import junit.framework.TestSuite;
* *
* Testing Namespace_Reference, with no prefix * Testing Namespace_Reference, with no prefix
* Bug#50471 : Wrong completion kind after the "using" keyword * Bug#50471 : Wrong completion kind after the "using" keyword
*
*/ */
public class CompletionTest_NamespaceRef_NoPrefix extends CompletionProposalsBaseTest{ public class CompletionTest_NamespaceRef_NoPrefix extends CompletionProposalsBaseTest{
private final String fileName = "CompletionTestStart32.cpp"; private final String fileName = "CompletionTestStart32.cpp";
private final String fileFullPath ="resources/contentassist/" + fileName; private final String fileFullPath ="resources/contentassist/" + fileName;
private final String headerFileName = "CompletionTestStart.h"; private final String headerFileName = "CompletionTestStart.h";
@ -43,59 +41,38 @@ public class CompletionTest_NamespaceRef_NoPrefix extends CompletionProposalsBa
return suite; return suite;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
*/
@Override @Override
protected int getCompletionPosition() { protected int getCompletionPosition() {
return getBuffer().indexOf("namespace ") + 10; return getBuffer().indexOf("namespace ") + 10;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
*/
@Override @Override
protected String getExpectedPrefix() { protected String getExpectedPrefix() {
return expectedPrefix; return expectedPrefix;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
*/
@Override @Override
protected String[] getExpectedResultsValues() { protected String[] getExpectedResultsValues() {
return expectedResults; return expectedResults;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
*/
@Override @Override
protected String getFileName() { protected String getFileName() {
return fileName; return fileName;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
*/
@Override @Override
protected String getFileFullPath() { protected String getFileFullPath() {
return fileFullPath; return fileFullPath;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
*/
@Override @Override
protected String getHeaderFileFullPath() { protected String getHeaderFileFullPath() {
return headerFileFullPath; return headerFileFullPath;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
*/
@Override @Override
protected String getHeaderFileName() { protected String getHeaderFileName() {
return headerFileName; return headerFileName;
} }
} }