1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 379626 - Incorrect syntax coloring of dependent method call

Change-Id: Id1b327a814d91ff88984362402666a9e640248f5
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/35519
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2014-10-26 02:44:29 -04:00 committed by Sergey Prigogin
parent 356478286c
commit dd919f8f93
3 changed files with 23 additions and 7 deletions

View file

@ -475,14 +475,10 @@ public class CPPSemantics {
// binding.
final ASTNodeProperty namePropertyInParent = name.getPropertyInParent();
if (binding == null && data.skippedScope != null) {
if (data.hasFunctionArguments()) {
binding= new CPPDeferredFunction(data.skippedScope, name.getSimpleID(), null);
if (namePropertyInParent == IASTNamedTypeSpecifier.NAME) {
binding= new CPPUnknownMemberClass(data.skippedScope, name.getSimpleID());
} else {
if (namePropertyInParent == IASTNamedTypeSpecifier.NAME) {
binding= new CPPUnknownMemberClass(data.skippedScope, name.getSimpleID());
} else {
binding= new CPPUnknownMethod(data.skippedScope, name.getSimpleID());
}
binding= new CPPUnknownMethod(data.skippedScope, name.getSimpleID());
}
}

View file

@ -381,4 +381,16 @@ public class SemanticHighlightingTest extends TestCase {
public void testVariousHighlightings() throws Exception {
makeAssertions();
}
// class C { //$class
// template <typename T> void bar(T); //$templateParameter,methodDeclaration,templateParameter
// };
//
// template <typename U> //$templateParameter
// void foo(U u) { //$functionDeclaration,templateParameter,parameterVariable
// C().bar(u); //$class,method,parameterVariable
// }
public void testDependentMethodCall_379626() throws Exception {
makeAssertions();
}
}

View file

@ -52,6 +52,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVirtSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
@ -482,6 +484,12 @@ public class SemanticHighlightings {
IBinding binding= token.getBinding();
if (binding instanceof ICPPMethod) {
return true;
} else if (binding instanceof ICPPDeferredFunction) {
for (ICPPFunction candidate : ((ICPPDeferredFunction) binding).getCandidates()) {
if (candidate instanceof ICPPMethod) {
return true;
}
}
}
}
return false;