mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
Cosmetics.
This commit is contained in:
parent
3e9fb77a50
commit
16f230e2a4
2 changed files with 13 additions and 11 deletions
|
@ -800,7 +800,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
}
|
}
|
||||||
final IParserLogService log;
|
final IParserLogService log;
|
||||||
if (monitor instanceof ICanceler) {
|
if (monitor instanceof ICanceler) {
|
||||||
log= new ParserLogService(DebugLogConstants.PARSER, (ICanceler)monitor);
|
log= new ParserLogService(DebugLogConstants.PARSER, (ICanceler) monitor);
|
||||||
} else {
|
} else {
|
||||||
log= ParserUtil.getParserLogService();
|
log= ParserUtil.getParserLogService();
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class ASTCommenter {
|
||||||
|
|
||||||
private static ArrayList<IASTComment> getCommentsInWorkspace(IASTTranslationUnit tu) {
|
private static ArrayList<IASTComment> getCommentsInWorkspace(IASTTranslationUnit tu) {
|
||||||
IASTComment[] comments = tu.getComments();
|
IASTComment[] comments = tu.getComments();
|
||||||
ArrayList<IASTComment> commentsInWorksapce = new ArrayList<IASTComment>();
|
ArrayList<IASTComment> commentsInWorkspace = new ArrayList<IASTComment>();
|
||||||
|
|
||||||
if (comments == null || comments.length == 0) {
|
if (comments == null || comments.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -200,15 +200,16 @@ public class ASTCommenter {
|
||||||
|
|
||||||
for (IASTComment comment : comments) {
|
for (IASTComment comment : comments) {
|
||||||
if (isInWorkspace(comment)) {
|
if (isInWorkspace(comment)) {
|
||||||
commentsInWorksapce.add(comment);
|
commentsInWorkspace.add(comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return commentsInWorksapce;
|
return commentsInWorkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<IASTComment> removeAllPreprocessorComments(IASTTranslationUnit tu, ArrayList<IASTComment> comments) {
|
private static ArrayList<IASTComment> removeAllPreprocessorComments(IASTTranslationUnit tu,
|
||||||
|
ArrayList<IASTComment> comments) {
|
||||||
IASTPreprocessorStatement[] preprocessorStatements = tu.getAllPreprocessorStatements();
|
IASTPreprocessorStatement[] preprocessorStatements = tu.getAllPreprocessorStatements();
|
||||||
TreeMap<Integer,String> treeOfPreProcessorLines = new TreeMap<Integer,String>();
|
TreeMap<Integer, String> treeOfPreProcessorLines = new TreeMap<Integer,String>();
|
||||||
TreeMap<String, ArrayList<Integer>> ppOffsetForFiles = new TreeMap<String, ArrayList<Integer>>();
|
TreeMap<String, ArrayList<Integer>> ppOffsetForFiles = new TreeMap<String, ArrayList<Integer>>();
|
||||||
|
|
||||||
for (IASTPreprocessorStatement statement : preprocessorStatements) {
|
for (IASTPreprocessorStatement statement : preprocessorStatements) {
|
||||||
|
@ -229,11 +230,11 @@ public class ASTCommenter {
|
||||||
int comStartLineNumber = OffsetHelper.getStartingLineNumber(comment);
|
int comStartLineNumber = OffsetHelper.getStartingLineNumber(comment);
|
||||||
String fileName = comment.getFileLocation().getFileName();
|
String fileName = comment.getFileLocation().getFileName();
|
||||||
if (treeOfPreProcessorLines.containsKey(comStartLineNumber)
|
if (treeOfPreProcessorLines.containsKey(comStartLineNumber)
|
||||||
&& treeOfPreProcessorLines.get(comStartLineNumber).equals(fileName
|
&& treeOfPreProcessorLines.get(comStartLineNumber).equals(fileName)) {
|
||||||
)) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (commentIsAtTheBeginningBeforePreprocessorStatements(comment, ppOffsetForFiles.get(fileName), tu)) {
|
if (commentIsAtTheBeginningBeforePreprocessorStatements(comment,
|
||||||
|
ppOffsetForFiles.get(fileName), tu)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
commentsInCode.add(comment);
|
commentsInCode.add(comment);
|
||||||
|
@ -284,7 +285,8 @@ public class ASTCommenter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NodeCommentMap addCommentsToCommentMap(IASTTranslationUnit rootNode, ArrayList<IASTComment> comments){
|
private static NodeCommentMap addCommentsToCommentMap(IASTTranslationUnit rootNode,
|
||||||
|
ArrayList<IASTComment> comments){
|
||||||
NodeCommentMap commentMap = new NodeCommentMap();
|
NodeCommentMap commentMap = new NodeCommentMap();
|
||||||
CommentHandler commHandler = new CommentHandler(comments);
|
CommentHandler commHandler = new CommentHandler(comments);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue