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