mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
Fix invocation of macro explorere for selections beyond last declaration.
This commit is contained in:
parent
831dd9ee1f
commit
e7bb0ea2c2
1 changed files with 29 additions and 24 deletions
|
@ -105,13 +105,19 @@ public class CMacroExpansionInput {
|
|||
}
|
||||
if (fAllowSelection) {
|
||||
// selection
|
||||
fEnclosingNode= nodeSelector.findEnclosingNode(fTextRegion.getOffset(), fTextRegion.getLength());
|
||||
if (fEnclosingNode != null) {
|
||||
boolean macroOccurrence= false;
|
||||
if (fEnclosingNode.getParent() instanceof IASTPreprocessorMacroExpansion) {
|
||||
fEnclosingNode= nodeSelector.findEnclosingNode(fTextRegion.getOffset(), fTextRegion.getLength());
|
||||
if (fEnclosingNode == null) {
|
||||
// selection beyond last declaration
|
||||
fEnclosingNode= ast;
|
||||
}
|
||||
else if (fEnclosingNode.getParent() instanceof IASTPreprocessorMacroExpansion) {
|
||||
// selection enclosed by the name of a macro expansion
|
||||
fEnclosingNode= fEnclosingNode.getParent();
|
||||
}
|
||||
|
||||
if (fEnclosingNode instanceof IASTPreprocessorMacroExpansion) {
|
||||
// selection enclosed by a macro expansion
|
||||
addExpansionNode(fEnclosingNode);
|
||||
macroOccurrence= true;
|
||||
}
|
||||
|
@ -136,7 +142,6 @@ public class CMacroExpansionInput {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue