Skip to content

Commit 6ee6e04

Browse files
jnthntatumcopybara-github
authored andcommitted
Make check for optimizeable list append more strict.
Updated to filter hand-rolled map-like comprehensions. PiperOrigin-RevId: 704786900
1 parent 0dceee5 commit 6ee6e04

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

eval/compiler/flat_expr_builder.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ bool IsOptimizableListAppend(
270270
comprehension->result().ident_expr().name() != accu_var) {
271271
return false;
272272
}
273-
if (!comprehension->accu_init().has_list_expr()) {
273+
if (!comprehension->accu_init().has_list_expr() ||
274+
!comprehension->accu_init().list_expr().elements().empty()) {
274275
return false;
275276
}
276277

0 commit comments

Comments
 (0)