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.
@@ -94,20 +95,23 @@ impl BooleanDecisionCtx {
94
95
// - 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".
95
96
// - 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".
96
97
fnrecord_conditions(&mutself,op:LogicalOp){
97
-
let parent_condition = self.decision_stack.pop_back().unwrap_or_default();
98
-
let lhs_id = if parent_condition.condition_id == ConditionId::NONE{
99
-
ConditionId::from(self.next_condition_id())
100
-
}else{
101
-
parent_condition.condition_id
98
+
let parent_condition = matchself.decision_stack.pop_back(){
99
+
Some(info) => info,
100
+
None => ConditionInfo{
101
+
condition_id:self.next_condition_id(),
102
+
true_next_id:None,
103
+
false_next_id:None,
104
+
},
102
105
};
106
+
let lhs_id = parent_condition.condition_id;
103
107
104
108
let rhs_condition_id = self.next_condition_id();
105
109
106
110
let(lhs, rhs) = match op {
107
111
LogicalOp::And => {
108
112
let lhs = ConditionInfo{
109
113
condition_id: lhs_id,
110
-
true_next_id: rhs_condition_id,
114
+
true_next_id:Some(rhs_condition_id),
111
115
false_next_id: parent_condition.false_next_id,
112
116
};
113
117
let rhs = ConditionInfo{
@@ -121,7 +125,7 @@ impl BooleanDecisionCtx {
121
125
let lhs = ConditionInfo{
122
126
condition_id: lhs_id,
123
127
true_next_id: parent_condition.true_next_id,
124
-
false_next_id: rhs_condition_id,
128
+
false_next_id:Some(rhs_condition_id),
125
129
};
126
130
let rhs = ConditionInfo{
127
131
condition_id: rhs_condition_id,
@@ -142,11 +146,15 @@ impl BooleanDecisionCtx {
142
146
true_marker:BlockMarkerId,
143
147
false_marker:BlockMarkerId,
144
148
){
145
-
let condition_info = self.decision_stack.pop_back().unwrap_or_default();
146
-
if condition_info.true_next_id == ConditionId::NONE{
149
+
let condition_info = self.decision_stack.pop_back().unwrap_or(ConditionInfo{
150
+
condition_id:ConditionId::START,
151
+
true_next_id:None,
152
+
false_next_id:None,
153
+
});
154
+
if condition_info.true_next_id.is_none(){
147
155
self.decision_info.end_markers.push(true_marker);
148
156
}
149
-
if condition_info.false_next_id == ConditionId::NONE{
0 commit comments