mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 363244. Fixed the case when newly inserted nodes are wrapped in
ContainerNode.
This commit is contained in:
parent
adc46fe221
commit
5fb38d3912
1 changed files with 8 additions and 0 deletions
|
@ -58,6 +58,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ContainerNode;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
||||
|
@ -1016,6 +1017,13 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
if (modification.getKind() != ModificationKind.APPEND_CHILD)
|
||||
return false;
|
||||
IASTNode node = modification.getNewNode();
|
||||
if (node instanceof ContainerNode) {
|
||||
for (IASTNode containedNode : ((ContainerNode) node).getNodes()) {
|
||||
if (!(containedNode instanceof IASTDeclaration || containedNode instanceof IASTStatement))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return node instanceof IASTDeclaration || node instanceof IASTStatement;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue