File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -51,16 +51,18 @@ void IfThenAction::toJson(Json &js) const {
51
51
52
52
auto &js_children = js[" children" ];
53
53
54
- int index = 0 ;
54
+ int prefix_num = 0 ;
55
55
for (auto &item : if_then_actions_) {
56
56
std::ostringstream oss;
57
- oss << std::setw (2 ) << std::setfill (' 0' ) << index << ' .' ;
57
+ oss << std::setw (2 ) << std::setfill (' 0' ) << prefix_num << ' .' ;
58
58
auto prefix = oss.str ();
59
59
60
60
item.first ->toJson (js_children[prefix + " if" ]);
61
61
item.second ->toJson (js_children[prefix + " then" ]);
62
- ++index ;
62
+ ++prefix_num ;
63
63
}
64
+
65
+ js[" index" ] = index_;
64
66
}
65
67
66
68
int IfThenAction::addChildAs (Action *child, const std::string &role) {
@@ -130,7 +132,7 @@ void IfThenAction::onStart() {
130
132
AssembleAction::onStart ();
131
133
132
134
index_ = 0 ;
133
- tryNext ();
135
+ doStart ();
134
136
}
135
137
136
138
void IfThenAction::onStop () {
@@ -164,7 +166,7 @@ void IfThenAction::onReset() {
164
166
}
165
167
}
166
168
167
- void IfThenAction::tryNext () {
169
+ void IfThenAction::doStart () {
168
170
if (index_ >= if_then_actions_.size ()) {
169
171
finish (false , Reason (ACTION_REASON_IF_THEN_SKIP, " IfThenSkip" ));
170
172
return ;
@@ -183,7 +185,7 @@ void IfThenAction::onIfActionFinished(bool is_succ) {
183
185
} else {
184
186
// ! 跳至下一个分支
185
187
++index_;
186
- tryNext ();
188
+ doStart ();
187
189
}
188
190
}
189
191
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class IfThenAction : public AssembleAction {
91
91
virtual void onReset () override ;
92
92
93
93
protected:
94
- void tryNext ();
94
+ void doStart ();
95
95
void onIfActionFinished (bool is_succ);
96
96
97
97
private:
You can’t perform that action at this time.
0 commit comments