mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 194592 - Code Completion in generic class is not working
This commit is contained in:
parent
f0af376bb5
commit
59bc9825a4
2 changed files with 30 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||
|
@ -168,8 +169,20 @@ public class CPPUnknownScope implements ICPPScope, ICPPInternalUnknownScope {
|
|||
}
|
||||
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings, boolean checkPointOfDecl) {
|
||||
if (prefixLookup)
|
||||
if (prefixLookup) {
|
||||
if (binding instanceof ICPPDeferredClassInstance) {
|
||||
try {
|
||||
ICPPDeferredClassInstance instance = (ICPPDeferredClassInstance) binding;
|
||||
IScope scope = instance.getClassTemplate().getCompositeScope();
|
||||
if (scope != null) {
|
||||
return scope.getBindings(name, resolve, prefixLookup, acceptLocalBindings);
|
||||
}
|
||||
} catch (DOMException exc) {
|
||||
CCorePlugin.log(exc);
|
||||
}
|
||||
}
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
return new IBinding[] {getBinding(name, resolve, acceptLocalBindings)};
|
||||
}
|
||||
|
|
|
@ -1199,4 +1199,20 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
|
||||
}
|
||||
|
||||
//template <class type>
|
||||
//class Queue {
|
||||
// TClass<type>* myQueue;
|
||||
//public:
|
||||
// Queue() {
|
||||
// myQueue = new TClass<type>;
|
||||
// }
|
||||
// bool isEmtpy() {
|
||||
// return myQueue->a/*cursor*/
|
||||
// }
|
||||
//};
|
||||
public void testContentAssistInDeferredClassInstance_Bug194592() throws Exception {
|
||||
final String[] expected= {"add()"};
|
||||
assertCompletionResults(fCursorOffset, expected, COMPARE_REP_STRINGS);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue