changeset 11648:4ab1f371adc8

Do not assign new source section if replacing node already has source section assigned.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 15 Sep 2013 16:31:32 +0200
parents a21a54b7ead1
children e8dfad9a424f
files graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Sun Sep 15 16:31:11 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Sun Sep 15 16:31:32 2013 +0200
@@ -75,7 +75,7 @@
             // source attribution, which would otherwise trigger this
             // exception. This method will eventually be deprecated.
             if (getSourceSection() != section) {
-                throw new IllegalStateException("Source section is already assigned.");
+                throw new IllegalStateException("Source section is already assigned. Old: " + getSourceSection() + ", new: " + section);
             }
         }
         this.sourceSection = section;
@@ -174,7 +174,7 @@
         if (this.getParent() == null) {
             throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
         }
-        if (sourceSection != null) {
+        if (sourceSection != null && newNode.getSourceSection() == null) {
             // Pass on the source section to the new node.
             newNode.assignSourceSection(sourceSection);
         }