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

Revert "Bug 486682 - Syntax coloring of macro arguments that occur in reverse order in the AST"

This commit caused a regression in syntax coloring, as reported in bugs 490415 and 496696.

Change-Id: Ibfa7004b11677be56eb5a18d8236af2300de56cb
This commit is contained in:
Nathan Ridge 2016-06-25 03:17:55 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 492fc0a164
commit 7a4d4fdb95
2 changed files with 10 additions and 12 deletions

View file

@ -508,15 +508,6 @@ public class SemanticHighlightingTest extends TestCase {
makeAssertions();
}
// #define MACRO(Name, Type) Type Name(); //$macroDefinition
// typedef int Int; //$typedef
// class S { //$class
// MACRO(foo, Int) //$macroSubstitution,methodDeclaration,typedef
// };
public void testMethodNameInsideMacro_486682() throws Exception {
makeAssertions();
}
// #define WALDO(name) const char* Name() override { return name; } //$macroDefinition
// class S { //$class
// WALDO("name") //$macroSubstitution

View file

@ -67,8 +67,10 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
private class PositionCollector extends ASTVisitor {
/** The semantic token */
private SemanticToken fToken= new SemanticToken();
private int fMinLocation;
public PositionCollector(boolean visitImplicitNames) {
fMinLocation= -1;
shouldVisitTranslationUnit= true;
shouldVisitNames= true;
shouldVisitDeclarations= true;
@ -90,6 +92,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
visitNode(macroDef.getName());
}
}
fMinLocation= -1;
// Visit macro expansions.
IASTPreprocessorMacroExpansion[] macroExps= tu.getMacroExpansions();
@ -103,6 +106,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
}
}
}
fMinLocation= -1;
// Visit ordinary code.
return super.visit(tu);
@ -230,9 +234,12 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
*/
private void highlightLocation(IASTNodeLocation nodeLocation, HighlightingStyle highlightingStyle) {
int offset= nodeLocation.getNodeOffset();
int length= nodeLocation.getNodeLength();
if (offset > -1 && length > 0) {
addPosition(offset, length, highlightingStyle);
if (offset >= fMinLocation) {
int length= nodeLocation.getNodeLength();
if (offset > -1 && length > 0) {
fMinLocation= offset + length;
addPosition(offset, length, highlightingStyle);
}
}
}