diff options
author | Emanuel Graf | 2011-03-07 07:26:26 +0000 |
---|---|---|
committer | Emanuel Graf | 2011-03-07 07:26:26 +0000 |
commit | 654e12094a5b0b77e8877550922343dc5def49c9 (patch) | |
tree | 84adebc25b342e27628c8ee9460f03dfe917e3c2 /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite | |
parent | c2b14277a39ee7364881508795d12abcc1bbeb9e (diff) | |
download | org.eclipse.cdt-654e12094a5b0b77e8877550922343dc5def49c9.tar.gz org.eclipse.cdt-654e12094a5b0b77e8877550922343dc5def49c9.tar.xz org.eclipse.cdt-654e12094a5b0b77e8877550922343dc5def49c9.zip |
Bug 337937: CopyLocation for copied AST-Node
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337937
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite')
2 files changed, 16 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/ASTLiteralNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/ASTLiteralNode.java index 8da53a7b733..638108f78a5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/ASTLiteralNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/ASTLiteralNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2011 Wind River Systems, Inc. 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 @@ -104,6 +104,10 @@ public class ASTLiteralNode implements IASTNode { throw new UnsupportedOperationException(); } + public IASTNode copy(CopyStyle style) { + throw new UnsupportedOperationException(); + } + public boolean isActive() { return true; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java index 39f2dd0a956..a9cfdeee41b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 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 @@ -43,13 +43,20 @@ public class ContainerNode extends ASTNode { } public ContainerNode copy() { + return copy(CopyStyle.withoutLocations); + } + + public ContainerNode copy(CopyStyle style) { ContainerNode copy = new ContainerNode(); - for(IASTNode node : getNodes()) - copy.addNode(node == null ? null : node.copy()); + for (IASTNode node : getNodes()) + copy.addNode(node == null ? null : node.copy(style)); copy.setOffsetAndLength(this); + if (style == CopyStyle.withLocations) { + copy.setCopyLocation(this); + } return copy; } - + public void addNode(IASTNode node) { nodes.add(node); if(node.getParent() == null) { |