Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuel Graf2010-03-18 09:51:42 -0400
committerEmanuel Graf2010-03-18 09:51:42 -0400
commitd9629c20b03fadfda72f49a0cdd4fc0b48a4314c (patch)
tree3ec7a427359786993487726e229358155b4dd712 /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite
parent05632966684c142564437c45079f1dd2bd2015d1 (diff)
downloadorg.eclipse.cdt-d9629c20b03fadfda72f49a0cdd4fc0b48a4314c.tar.gz
org.eclipse.cdt-d9629c20b03fadfda72f49a0cdd4fc0b48a4314c.tar.xz
org.eclipse.cdt-d9629c20b03fadfda72f49a0cdd4fc0b48a4314c.zip
Fix for failing unit tests
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
index 5aa35c3d71..44ac7d9f4b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
@@ -181,7 +181,6 @@ public class ChangeGenerator extends CPPASTVisitor {
fileLocation = node.getTranslationUnit().flattenLocationsToFile(node.getNodeLocations());
}
}
-
return fileLocation;
}
@@ -259,8 +258,13 @@ public class ChangeGenerator extends CPPASTVisitor {
newNodeCode));
break;
case APPEND_CHILD:
+ if(modification.getTargetNode() instanceof IASTTranslationUnit && ((IASTTranslationUnit)modification.getTargetNode()).getDeclarations().length > 0) {
+ IASTTranslationUnit tu = (IASTTranslationUnit)modification.getTargetNode();
+ IASTDeclaration lastDecl = tu.getDeclarations()[tu.getDeclarations().length -1];
+ targetLocation = lastDecl.getFileLocation();
+ }
String lineDelimiter = FileHelper.determineLineDelimiter(FileHelper.getIFilefromIASTNode(modification.getTargetNode()));
- edit.addChild(new InsertEdit(targetLocation.getNodeOffset()
+ edit.addChild(new InsertEdit(targetLocation.getNodeOffset()
+ targetLocation.getNodeLength(),lineDelimiter + lineDelimiter + newNodeCode));
break;
}

Back to the top