mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 03:45:35 +02:00
Change generator for nested AST-modifications, by Emanuel Graf, bug 226306.
This commit is contained in:
parent
5dacb8918f
commit
ce5aae6649
5 changed files with 156 additions and 20 deletions
|
@ -376,7 +376,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
private void writeCompoundStatement(IASTCompoundStatement compoundStatement) {
|
private void writeCompoundStatement(IASTCompoundStatement compoundStatement) {
|
||||||
scribe.printLBrace();
|
scribe.printLBrace();
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
for (IASTStatement statements : compoundStatement.getStatements()) {
|
for (IASTStatement statements : getNestedStatements(compoundStatement)) {
|
||||||
statements.accept(visitor);
|
statements.accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +391,10 @@ public class StatementWriter extends NodeWriter{
|
||||||
scribe.printRBrace();
|
scribe.printRBrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IASTStatement[] getNestedStatements(IASTCompoundStatement compoundStatement) {
|
||||||
|
return compoundStatement.getStatements();
|
||||||
|
}
|
||||||
|
|
||||||
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
|
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
|
||||||
if (statement instanceof IASTCompoundStatement){
|
if (statement instanceof IASTCompoundStatement){
|
||||||
//TODO hsr existiert noch eine methode
|
//TODO hsr existiert noch eine methode
|
||||||
|
|
|
@ -31,25 +31,32 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||||
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.ASTModificationStore;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Visits the nodes in consideration of {@link ASTModification}s.
|
||||||
|
*
|
||||||
|
* @since 5.0
|
||||||
|
* @author Emanuel Graf IFS
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
|
|
||||||
private static final String DEFAULT_INDENTATION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_INDENTATION = ""; //$NON-NLS-1$
|
||||||
private final ASTModificationStore modificationStore;
|
private final ASTModificationStore modificationStore;
|
||||||
private ASTModificationMap modificationsForScope;
|
|
||||||
private final String fileScope;
|
private final String fileScope;
|
||||||
|
private ModificationScopeStack stack;
|
||||||
|
|
||||||
public ChangeGeneratorWriterVisitor(CPPASTVisitor delegateVisitor,
|
public ChangeGeneratorWriterVisitor(CPPASTVisitor delegateVisitor,
|
||||||
ASTModificationStore modificationStore, String fileScope, NodeCommentMap commentMap) {
|
ASTModificationStore modificationStore, String fileScope, NodeCommentMap commentMap) {
|
||||||
super(commentMap);
|
super(commentMap);
|
||||||
|
|
||||||
this.modificationStore = modificationStore;
|
this.modificationStore = modificationStore;
|
||||||
this.modificationsForScope = modificationStore.getRootModifications();
|
|
||||||
this.fileScope = fileScope;
|
this.fileScope = fileScope;
|
||||||
|
this.stack = new ModificationScopeStack(modificationStore);
|
||||||
|
|
||||||
shouldVisitExpressions = delegateVisitor.shouldVisitExpressions;
|
shouldVisitExpressions = delegateVisitor.shouldVisitExpressions;
|
||||||
shouldVisitStatements = delegateVisitor.shouldVisitStatements;
|
shouldVisitStatements = delegateVisitor.shouldVisitStatements;
|
||||||
|
@ -83,9 +90,9 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
declSpecWriter = new ModifiedASTDeclSpecWriter(scribe, this, modStore, commentMap);
|
declSpecWriter = new ModifiedASTDeclSpecWriter(scribe, this, modStore, commentMap);
|
||||||
|
|
||||||
this.modificationStore = modStore;
|
this.modificationStore = modStore;
|
||||||
this.modificationsForScope = modificationStore.getRootModifications();
|
|
||||||
this.fileScope = fileScope;
|
this.fileScope = fileScope;
|
||||||
this.shouldVisitTranslationUnit = true;
|
this.shouldVisitTranslationUnit = true;
|
||||||
|
this.stack = new ModificationScopeStack(modificationStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,72 +140,84 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclaration declaration) {
|
public int leave(IASTDeclaration declaration) {
|
||||||
super.leave(declaration);
|
super.leave(declaration);
|
||||||
|
doAfterEveryNode(declaration);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclarator declarator) {
|
public int leave(IASTDeclarator declarator) {
|
||||||
super.leave(declarator);
|
super.leave(declarator);
|
||||||
|
doAfterEveryNode(declarator);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclSpecifier declSpec) {
|
public int leave(IASTDeclSpecifier declSpec) {
|
||||||
super.leave(declSpec);
|
super.leave(declSpec);
|
||||||
|
doAfterEveryNode(declSpec);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTEnumerator enumerator) {
|
public int leave(IASTEnumerator enumerator) {
|
||||||
super.leave(enumerator);
|
super.leave(enumerator);
|
||||||
|
doAfterEveryNode(enumerator);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTExpression expression) {
|
public int leave(IASTExpression expression) {
|
||||||
super.leave(expression);
|
super.leave(expression);
|
||||||
|
doAfterEveryNode(expression);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTInitializer initializer) {
|
public int leave(IASTInitializer initializer) {
|
||||||
super.leave(initializer);
|
super.leave(initializer);
|
||||||
|
doAfterEveryNode(initializer);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTName name) {
|
public int leave(IASTName name) {
|
||||||
super.leave(name);
|
super.leave(name);
|
||||||
|
doAfterEveryNode(name);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTParameterDeclaration parameterDeclaration) {
|
public int leave(IASTParameterDeclaration parameterDeclaration) {
|
||||||
super.leave(parameterDeclaration);
|
super.leave(parameterDeclaration);
|
||||||
|
doAfterEveryNode(parameterDeclaration);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTProblem problem) {
|
public int leave(IASTProblem problem) {
|
||||||
super.leave(problem);
|
super.leave(problem);
|
||||||
|
doAfterEveryNode(problem);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTStatement statement) {
|
public int leave(IASTStatement statement) {
|
||||||
super.leave(statement);
|
super.leave(statement);
|
||||||
|
doAfterEveryNode(statement);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTTranslationUnit tu) {
|
public int leave(IASTTranslationUnit tu) {
|
||||||
super.leave(tu);
|
super.leave(tu);
|
||||||
|
doAfterEveryNode(tu);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTTypeId typeId) {
|
public int leave(IASTTypeId typeId) {
|
||||||
super.leave(typeId);
|
super.leave(typeId);
|
||||||
|
doAfterEveryNode(typeId);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,8 +323,11 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int doBeforeEveryNode(IASTNode node) {
|
protected void doAfterEveryNode(IASTNode node) {
|
||||||
|
stack.popScope(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int doBeforeEveryNode(IASTNode node) {
|
||||||
if (fileScope != null) {
|
if (fileScope != null) {
|
||||||
String file = getCorrespondingFile(node);
|
String file = getCorrespondingFile(node);
|
||||||
if (!fileScope.equals(file)) {
|
if (!fileScope.equals(file)) {
|
||||||
|
@ -313,9 +335,8 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modificationsForScope != null
|
if (stack.getModifiedNodes().contains(node)) {
|
||||||
&& modificationsForScope.getModifiedNodes().contains(node)) {
|
List<ASTModification> modificationList = stack
|
||||||
List<ASTModification> modificationList = modificationsForScope
|
|
||||||
.getModificationsForNode(node);
|
.getModificationsForNode(node);
|
||||||
if (modificationList == null) {
|
if (modificationList == null) {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
|
@ -324,19 +345,19 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
for (ASTModification currentMod : modificationList) {
|
for (ASTModification currentMod : modificationList) {
|
||||||
switch (currentMod.getKind()) {
|
switch (currentMod.getKind()) {
|
||||||
case APPEND_CHILD:
|
case APPEND_CHILD:
|
||||||
|
stack.pushScope(node);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
case INSERT_BEFORE:
|
case INSERT_BEFORE:
|
||||||
|
stack.pushScope(node);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
case REPLACE:
|
case REPLACE:
|
||||||
|
|
||||||
if (currentMod.getNewNode() == null) {
|
if (currentMod.getNewNode() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
stack.pushScope(node);
|
||||||
ASTModificationMap modificationsForThisScope = modificationsForScope;
|
|
||||||
modificationsForScope = modificationStore
|
|
||||||
.getNestedModifications(currentMod);
|
|
||||||
currentMod.getNewNode().accept(this);
|
currentMod.getNewNode().accept(this);
|
||||||
modificationsForScope = modificationsForThisScope;
|
stack.popScope(node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
|
||||||
|
* Rapperswil, University of applied sciences and others
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Institute for Software - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||||
|
|
||||||
|
public class ModificationScopeStack {
|
||||||
|
private LinkedList<List<ASTModification>> scopeStack;
|
||||||
|
private ASTModificationStore modStore;
|
||||||
|
|
||||||
|
public ModificationScopeStack(ASTModificationStore modificationStore) {
|
||||||
|
scopeStack = new LinkedList<List<ASTModification>>();
|
||||||
|
modStore = modificationStore;
|
||||||
|
ArrayList<ASTModification> nullModList = new ArrayList<ASTModification>();
|
||||||
|
nullModList.add(null);
|
||||||
|
scopeStack.addFirst(nullModList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pushScope(IASTNode node) {
|
||||||
|
List<ASTModification> newMods = new ArrayList<ASTModification>();
|
||||||
|
for(ASTModification peekMod : scopeStack.peek()) {
|
||||||
|
ASTModificationMap nestedMods = modStore.getNestedModifications(peekMod);
|
||||||
|
if (nestedMods != null) {
|
||||||
|
newMods.addAll(nestedMods.getModificationsForNode(node));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newMods.isEmpty()) {
|
||||||
|
scopeStack.addFirst(newMods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ASTModification> getNestedModifikationsForNode(IASTNode node) {
|
||||||
|
ASTModificationMap rootModifications = modStore.getRootModifications();
|
||||||
|
if (rootModifications == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return rootModifications.getModificationsForNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void popScope(IASTNode node) {
|
||||||
|
List<ASTModification> peek = scopeStack.peek();
|
||||||
|
if (peek != null) {
|
||||||
|
if (!peek.isEmpty() && peek.get(0).getTargetNode() == node) {
|
||||||
|
scopeStack.removeFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<IASTNode> getModifiedNodes() {
|
||||||
|
List<ASTModification> aktModList = scopeStack.peek();
|
||||||
|
if (aktModList == null) {
|
||||||
|
return getNestedModifiedNodes();
|
||||||
|
}
|
||||||
|
Collection<IASTNode> nodes = new ArrayList<IASTNode>();
|
||||||
|
for (ASTModification modification : aktModList) {
|
||||||
|
ASTModificationMap nestedModifications = modStore.getNestedModifications(modification);
|
||||||
|
if (nestedModifications != null) {
|
||||||
|
nodes.addAll(nestedModifications.getModifiedNodes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Collections.unmodifiableCollection(nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Collection<IASTNode> getNestedModifiedNodes() {
|
||||||
|
ASTModificationMap rootModifications = modStore.getRootModifications();
|
||||||
|
if(rootModifications == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return rootModifications.getModifiedNodes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ASTModification> getModificationsForNode(IASTNode node) {
|
||||||
|
List<ASTModification> aktModList = scopeStack.peek();
|
||||||
|
if (aktModList == null) {
|
||||||
|
return getNestedModifikationsForNode(node);
|
||||||
|
}
|
||||||
|
List<ASTModification> modForNodeList = new ArrayList<ASTModification>();
|
||||||
|
for (ASTModification modification : aktModList) {
|
||||||
|
modForNodeList.addAll(modStore.getNestedModifications(modification).getModificationsForNode(node));
|
||||||
|
}
|
||||||
|
return Collections.unmodifiableList(modForNodeList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -27,18 +27,18 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
||||||
|
|
||||||
private final ASTModificationHelper modificationHelpder;
|
private final ASTModificationHelper modificationHelper;
|
||||||
|
|
||||||
public ModifiedASTExpressionWriter(Scribe scribe, CPPASTVisitor visitor,
|
public ModifiedASTExpressionWriter(Scribe scribe, CPPASTVisitor visitor,
|
||||||
MacroExpansionHandler macroHandler, ASTModificationStore modStore, NodeCommentMap commentMap) {
|
MacroExpansionHandler macroHandler, ASTModificationStore modStore, NodeCommentMap commentMap) {
|
||||||
super(scribe, visitor, macroHandler, commentMap);
|
super(scribe, visitor, macroHandler, commentMap);
|
||||||
this.modificationHelpder = new ASTModificationHelper(modStore);
|
this.modificationHelper = new ASTModificationHelper(modStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeExpressions(IASTExpressionList expList,
|
protected void writeExpressions(IASTExpressionList expList,
|
||||||
IASTExpression[] expressions) {
|
IASTExpression[] expressions) {
|
||||||
IASTExpression[] modifiedExpressions = modificationHelpder.createModifiedChildArray(expList, expressions);
|
IASTExpression[] modifiedExpressions = modificationHelper.createModifiedChildArray(expList, expressions);
|
||||||
super.writeExpressions(expList, modifiedExpressions);
|
super.writeExpressions(expList, modifiedExpressions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
||||||
IASTExpression initializer = newExp.getNewInitializer();
|
IASTExpression initializer = newExp.getNewInitializer();
|
||||||
|
|
||||||
if(initializer != null){
|
if(initializer != null){
|
||||||
for(ASTModification childModification : modificationHelpder.modificationsForNode(initializer)){
|
for(ASTModification childModification : modificationHelper.modificationsForNode(initializer)){
|
||||||
switch(childModification.getKind()){
|
switch(childModification.getKind()){
|
||||||
case REPLACE:
|
case REPLACE:
|
||||||
if(childModification.getNewNode() instanceof IASTInitializer){
|
if(childModification.getNewNode() instanceof IASTInitializer){
|
||||||
|
@ -66,7 +66,7 @@ public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(ASTModification parentModification : modificationHelpder.modificationsForNode(newExp)){
|
for(ASTModification parentModification : modificationHelper.modificationsForNode(newExp)){
|
||||||
if(parentModification.getKind() == ModificationKind.APPEND_CHILD){
|
if(parentModification.getKind() == ModificationKind.APPEND_CHILD){
|
||||||
IASTNode newNode = parentModification.getNewNode();
|
IASTNode newNode = parentModification.getNewNode();
|
||||||
if(newNode instanceof IASTInitializer){
|
if(newNode instanceof IASTInitializer){
|
||||||
|
@ -81,7 +81,7 @@ public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
||||||
@Override
|
@Override
|
||||||
protected IASTExpression[] getNewTypeIdArrayExpressions(
|
protected IASTExpression[] getNewTypeIdArrayExpressions(
|
||||||
ICPPASTNewExpression newExp, IASTExpression[] expressions) {
|
ICPPASTNewExpression newExp, IASTExpression[] expressions) {
|
||||||
IASTExpression[] modifiedExpressions = modificationHelpder.createModifiedChildArray(newExp, expressions);
|
IASTExpression[] modifiedExpressions = modificationHelper.createModifiedChildArray(newExp, expressions);
|
||||||
return modifiedExpressions;
|
return modifiedExpressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||||
|
@ -40,4 +41,11 @@ public class ModifiedASTStatementWriter extends StatementWriter {
|
||||||
IASTDeclaration replacementNode = modificationHelper.getNodeAfterReplacement(declaration);
|
IASTDeclaration replacementNode = modificationHelper.getNodeAfterReplacement(declaration);
|
||||||
super.writeDeclarationWithoutSemicolon(replacementNode);
|
super.writeDeclarationWithoutSemicolon(replacementNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IASTStatement[] getNestedStatements(IASTCompoundStatement compoundStatement) {
|
||||||
|
return modificationHelper.createModifiedChildArray(compoundStatement, compoundStatement.getStatements());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue