mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
Bug 486682 - Syntax coloring of macro arguments that occur in reverse order in the AST
Change-Id: Ib038a39ada52d44356c4207bef72a681dd3aa790
This commit is contained in:
parent
f1e935c1ad
commit
a201468432
2 changed files with 15 additions and 16 deletions
|
@ -507,4 +507,13 @@ public class SemanticHighlightingTest extends TestCase {
|
|||
public void testDependentEnum_486688() throws Exception {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,10 +66,8 @@ 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;
|
||||
|
@ -91,7 +89,6 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
|||
visitNode(macroDef.getName());
|
||||
}
|
||||
}
|
||||
fMinLocation= -1;
|
||||
|
||||
// Visit macro expansions.
|
||||
IASTPreprocessorMacroExpansion[] macroExps= tu.getMacroExpansions();
|
||||
|
@ -105,7 +102,6 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
fMinLocation= -1;
|
||||
|
||||
// Visit ordinary code.
|
||||
return super.visit(tu);
|
||||
|
@ -207,12 +203,9 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
|||
if (imageLocation != null) {
|
||||
if (imageLocation.getLocationKind() != IASTImageLocation.MACRO_DEFINITION) {
|
||||
int offset= imageLocation.getNodeOffset();
|
||||
if (offset >= fMinLocation) {
|
||||
int length= imageLocation.getNodeLength();
|
||||
if (offset >= 0 && length > 0) {
|
||||
fMinLocation= offset + length;
|
||||
addPosition(offset, length, highlightingStyle);
|
||||
}
|
||||
int length= imageLocation.getNodeLength();
|
||||
if (offset >= 0 && length > 0) {
|
||||
addPosition(offset, length, highlightingStyle);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -235,12 +228,9 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
|||
return;
|
||||
}
|
||||
int offset= nodeLocation.getNodeOffset();
|
||||
if (offset >= fMinLocation) {
|
||||
int length= nodeLocation.getNodeLength();
|
||||
if (offset > -1 && length > 0) {
|
||||
fMinLocation= offset + length;
|
||||
addPosition(offset, length, highlightingStyle);
|
||||
}
|
||||
int length= nodeLocation.getNodeLength();
|
||||
if (offset > -1 && length > 0) {
|
||||
addPosition(offset, length, highlightingStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue