Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2007-12-07 04:44:17 -0500
committerAnton Leherbauer2007-12-07 04:44:17 -0500
commitdbe707e76a980a09266930fb218391f92989f999 (patch)
tree16384c767e989c099c4974a76ef3f6a55150bb18
parent1b147a1ddafafdde0727a1fbdb17af8211377fb8 (diff)
downloadorg.eclipse.cdt-dbe707e76a980a09266930fb218391f92989f999.tar.gz
org.eclipse.cdt-dbe707e76a980a09266930fb218391f92989f999.tar.xz
org.eclipse.cdt-dbe707e76a980a09266930fb218391f92989f999.zip
Fix for 209203: Wrong global variables syntax coloring for template parameters
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp7
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java2
3 files changed, 13 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp b/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
index c17ff949b1..8a86010d10 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
@@ -127,3 +127,10 @@ label:
SDKFunction();
return 0;
}
+
+//http://bugs.eclipse.org/209203
+template <int n>
+int f()
+{
+ return n;
+}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
index 16ae401893..eafaf26a72 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
@@ -192,6 +192,8 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
createPosition(77, 27, 2),
createPosition(83, 15, 2),
createPosition(83, 66, 2),
+ createPosition(131, 14, 1),
+ createPosition(134, 9, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -258,6 +260,7 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
createPosition(12, 12, 16),
createPosition(19, 16, 10),
createPosition(98, 8, 13),
+ createPosition(132, 4, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -274,6 +277,7 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
createPosition(98, 8, 13),
createPosition(99, 1, 16),
createPosition(126, 4, 11),
+ createPosition(132, 4, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
index 7cd44fd223..00dfb9cf51 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
@@ -47,6 +47,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
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;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding;
@@ -935,6 +936,7 @@ public class SemanticHighlightings {
if (binding instanceof IVariable
&& !(binding instanceof IField)
&& !(binding instanceof IParameter)
+ && !(binding instanceof ICPPTemplateNonTypeParameter)
&& !(binding instanceof IProblemBinding)) {
try {
IScope scope= binding.getScope();

Back to the top