comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 13915:d6b340b757a2

Truffle: refactorings
author Andreas Woess <andreas.woess@jku.at>
date Sat, 08 Feb 2014 06:33:29 +0100
parents 641f22b1c6b8
children f46cab39a9a2
comparison
equal deleted inserted replaced
13914:a8ff7d969666 13915:d6b340b757a2
170 * @param newNode the new node that is the replacement 170 * @param newNode the new node that is the replacement
171 * @param reason a description of the reason for the replacement 171 * @param reason a description of the reason for the replacement
172 * @return the new node 172 * @return the new node
173 */ 173 */
174 public final <T extends Node> T replace(T newNode, String reason) { 174 public final <T extends Node> T replace(T newNode, String reason) {
175 CompilerDirectives.transferToInterpreter(); 175 CompilerDirectives.transferToInterpreterAndInvalidate();
176 if (this.getParent() == null) { 176 if (this.getParent() == null) {
177 throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent."); 177 throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
178 } 178 }
179 if (sourceSection != null && newNode.getSourceSection() == null) { 179 if (sourceSection != null && newNode.getSourceSection() == null) {
180 // Pass on the source section to the new node. 180 // Pass on the source section to the new node.