aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
diff options
context:
space:
mode:
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
index c05f5cbbe..42c8685ef 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
@@ -49,6 +49,7 @@ public class ReplacingBasicValue extends BasicValue {
boolean isFunctionReturn = false;
boolean isFunctionArgument = false;
boolean isAssignedToMember = false;
+ boolean isAssignedInConditionalBlock = false;
boolean isThis = false;
/**
@@ -67,6 +68,9 @@ public class ReplacingBasicValue extends BasicValue {
if (other.isAssignedToMember) {
isAssignedToMember = true;
}
+ if (other.isAssignedInConditionalBlock) {
+ isAssignedInConditionalBlock = true;
+ }
if (other.isThis) {
isThis = true;
}
@@ -78,7 +82,7 @@ public class ReplacingBasicValue extends BasicValue {
* @return whether or not the value is replaceable
*/
public boolean isReplaceable() {
- return !(isFunctionReturn || isFunctionArgument || isAssignedToMember || isThis);
+ return !(isFunctionReturn || isFunctionArgument || isAssignedToMember || isAssignedInConditionalBlock || isThis);
}
/**
@@ -115,6 +119,15 @@ public class ReplacingBasicValue extends BasicValue {
needSpace = true;
}
+ if (isAssignedInConditionalBlock) {
+ if (needSpace) {
+ sb.append(' ');
+ }
+
+ sb.append("conditional");
+ needSpace = true;
+ }
+
if (isThis) {
if (needSpace) {
sb.append(' ');
@@ -397,6 +410,13 @@ public class ReplacingBasicValue extends BasicValue {
}
/**
+ * Mark this value as being assigned to a variable inside of conditional block.
+ */
+ public void setAssignedInConditionalBlock() {
+ flagSet.isAssignedInConditionalBlock = true;
+ }
+
+ /**
* Indicates whether or not this value is assigned to a class member variable.
*
* @return whether or not this value is assigned to a class member variable
@@ -406,6 +426,15 @@ public class ReplacingBasicValue extends BasicValue {
}
/**
+ * Indicates whether or not this value is assigned to a variable inside of conditional block.
+ *
+ * @return whether or not this value is assigned to a variable inside of conditional block
+ */
+ public boolean isAssignedInConditionalBlock() {
+ return flagSet.isAssignedInConditionalBlock;
+ }
+
+ /**
* Return the ValueHolder identity for this value.
*
* @return the ValueHolderIden for this value