You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// At first we assign ConditionIds for each sub expression.
@@ -95,20 +96,23 @@ impl BooleanDecisionCtx {
95
96
// - If the op is AND, the "false_next" of LHS and RHS should be the parent's "false_next". While "true_next" of the LHS is the RHS, the "true next" of RHS is the parent's "true_next".
96
97
// - If the op is OR, the "true_next" of LHS and RHS should be the parent's "true_next". While "false_next" of the LHS is the RHS, the "false next" of RHS is the parent's "false_next".
97
98
fnrecord_conditions(&mutself,op:LogicalOp){
98
-
let parent_condition = self.decision_stack.pop_back().unwrap_or_default();
99
-
let lhs_id = if parent_condition.condition_id == ConditionId::NONE{
100
-
ConditionId::from(self.next_condition_id())
101
-
}else{
102
-
parent_condition.condition_id
99
+
let parent_condition = matchself.decision_stack.pop_back(){
100
+
Some(info) => info,
101
+
None => ConditionInfo{
102
+
condition_id:self.next_condition_id(),
103
+
true_next_id:None,
104
+
false_next_id:None,
105
+
},
103
106
};
107
+
let lhs_id = parent_condition.condition_id;
104
108
105
109
let rhs_condition_id = self.next_condition_id();
106
110
107
111
let(lhs, rhs) = match op {
108
112
LogicalOp::And => {
109
113
let lhs = ConditionInfo{
110
114
condition_id: lhs_id,
111
-
true_next_id: rhs_condition_id,
115
+
true_next_id:Some(rhs_condition_id),
112
116
false_next_id: parent_condition.false_next_id,
113
117
};
114
118
let rhs = ConditionInfo{
@@ -122,7 +126,7 @@ impl BooleanDecisionCtx {
122
126
let lhs = ConditionInfo{
123
127
condition_id: lhs_id,
124
128
true_next_id: parent_condition.true_next_id,
125
-
false_next_id: rhs_condition_id,
129
+
false_next_id:Some(rhs_condition_id),
126
130
};
127
131
let rhs = ConditionInfo{
128
132
condition_id: rhs_condition_id,
@@ -143,11 +147,15 @@ impl BooleanDecisionCtx {
143
147
true_marker:BlockMarkerId,
144
148
false_marker:BlockMarkerId,
145
149
){
146
-
let condition_info = self.decision_stack.pop_back().unwrap_or_default();
147
-
if condition_info.true_next_id == ConditionId::NONE{
150
+
let condition_info = self.decision_stack.pop_back().unwrap_or(ConditionInfo{
151
+
condition_id:ConditionId::START,
152
+
true_next_id:None,
153
+
false_next_id:None,
154
+
});
155
+
if condition_info.true_next_id.is_none(){
148
156
self.decision_info.end_markers.push(true_marker);
149
157
}
150
-
if condition_info.false_next_id == ConditionId::NONE{
0 commit comments