From 41bb986be0a50e56682a60137d50743df9e07270 Mon Sep 17 00:00:00 2001 From: Emanuel Graf Date: Tue, 4 Jan 2011 14:50:52 +0000 Subject: [PATCH] Bug 296192: Extract method removes essential macros and breaks formatting https://bugs.eclipse.org/bugs/show_bug.cgi?id=296192 Bugfix patch that fixes a case where comments at the end of a block are lost for C code (Comment #2) --- .../core/dom/rewrite/commenthandler/ASTCommenterVisitor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/commenthandler/ASTCommenterVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/commenthandler/ASTCommenterVisitor.java index c2c62008128..503dc28ebdf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/commenthandler/ASTCommenterVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/commenthandler/ASTCommenterVisitor.java @@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.dom.rewrite.commenthandler; import org.eclipse.cdt.core.dom.ast.IASTComment; +import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; @@ -29,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompoundStatement; /** * A visitor for the comments. Calls the NodeCommenter to assign the comments. @@ -175,7 +175,7 @@ public class ASTCommenterVisitor extends CPPASTVisitor { } @Override public int leave(IASTStatement statement) { - if(statement instanceof CPPASTCompoundStatement) { + if(statement instanceof IASTCompoundStatement) { return nodeCommenter.appendFreestandingComments((ASTNode)statement); } nodeCommenter.appendComments((ASTNode)statement);