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
assert!(num_unclosed_ifs >= 0,"More OP_ENDIF's than OP_IF's after undo step. (This means there is a bug in the undo logic.)");
198
+
assert_eq!(num_unclosed_ifs,0,"Unable to make up for the OP_IF's in this chunk. Consider a larger target size or more tolerance. Unclosed OP_IF's: {:?}, removed_len: {}, undo.call_stack: {:?}", num_unclosed_ifs, removed_len, undo_info.call_stack);
199
+
(undo_info.call_stack, removed_len)
200
+
}
201
+
101
202
fnfind_next_chunk(&mutself) -> Chunk{
102
203
letmut chunk_scripts = vec![];
103
204
letmut chunk_len = 0;
104
205
letmut num_unclosed_ifs = 0;
105
206
106
207
// All not selected StructuredScripts that have to be added to the call_stack again
// Case 3: Current builder too large and there is no acceptable solution yet
162
-
// TODO: Could add a depth parameter here to even if we have an acceptable solution
163
-
// check if there is a better one in next depth calls
259
+
// Even if we have an acceptable solution we check if there is a better one in next depth calls
164
260
// Chunk inside a call of the current builder.
165
261
// Add all its calls to the call_stack.
166
262
letmut contains_call = false;
@@ -181,28 +277,23 @@ impl Chunker {
181
277
}
182
278
}
183
279
}
184
-
assert!(contains_call || depth <= max_depth,"No support for chunking up ScriptBufs, depth: {}", depth);
280
+
assert!(
281
+
contains_call || depth <= max_depth,
282
+
"No support for chunking up ScriptBufs, depth: {}",
283
+
depth
284
+
);
185
285
depth += 1;
186
286
}else{
187
-
call_stack_undo.push(Box::new(builder));
287
+
self.call_stack.push(Box::new(builder));
188
288
break;
189
289
}
190
290
}
191
291
192
-
// Undo the lately added scripts if we are not closing all ifs with them.
193
-
// TODO: This is an issue because we may remove way more than necessary.
194
-
if num_unclosed_ifs != 0{
195
-
println!("[INFO] Unable to close all ifs. Undoing the added scripts to the point where num_unclosed_ifs was 0.");
196
-
num_unclosed_ifs -= num_unclosed_ifs_undo;
197
-
chunk_len -= chunk_len_undo;
198
-
}
199
-
200
-
assert!(num_unclosed_ifs >= 0,"More OP_ENDIF's than OP_IF's after undo step. (This means there is a bug in the undo logic.)");
201
-
assert_eq!(num_unclosed_ifs,0,"Unable to make up for the OP_IF's in this chunk. Consider a larger target size or more tolerance. Unclosed OP_IF's: {:?}", num_unclosed_ifs);
202
-
203
-
// Always have to do this because of the last call_stack element we popped that did not end up in
0 commit comments