mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Follow up for bug 249801.
This commit is contained in:
parent
caac3238db
commit
4f6ab7cd2e
1 changed files with 28 additions and 2 deletions
|
@ -201,10 +201,36 @@ public class ASTNodeSpecification<T extends IASTNode> {
|
|||
}
|
||||
|
||||
public IASTPreprocessorMacroExpansion findLeadingMacroExpansion(ASTNodeSelector nodeSelector) {
|
||||
return nodeSelector.findEnclosingMacroExpansion(fZeroToLeft ? fFileOffset-1 : fFileOffset, 1);
|
||||
IASTPreprocessorMacroExpansion exp= nodeSelector.findEnclosingMacroExpansion(fZeroToLeft ? fFileOffset-1 : fFileOffset, 1);
|
||||
if (fRelation == Relation.ENCLOSING)
|
||||
return exp;
|
||||
|
||||
if (exp != null) {
|
||||
IASTFileLocation loc= exp.getFileLocation();
|
||||
if (loc != null) {
|
||||
final int offset= loc.getNodeOffset();
|
||||
final int endOffset= offset+loc.getNodeLength();
|
||||
if (offset == fFileOffset && endOffset <= fFileEndOffset)
|
||||
return exp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IASTPreprocessorMacroExpansion findTrailingMacroExpansion(ASTNodeSelector nodeSelector) {
|
||||
return nodeSelector.findEnclosingMacroExpansion(fZeroToLeft ? fFileEndOffset : fFileEndOffset-1, 1);
|
||||
IASTPreprocessorMacroExpansion exp= nodeSelector.findEnclosingMacroExpansion(fFileEndOffset==fFileOffset && !fZeroToLeft ? fFileEndOffset : fFileEndOffset-1, 1);
|
||||
if (fRelation == Relation.ENCLOSING)
|
||||
return exp;
|
||||
|
||||
if (exp != null) {
|
||||
IASTFileLocation loc= exp.getFileLocation();
|
||||
if (loc != null) {
|
||||
final int offset= loc.getNodeOffset();
|
||||
final int endOffset= offset+loc.getNodeLength();
|
||||
if (endOffset == fFileEndOffset && offset >= fFileOffset)
|
||||
return exp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue