bugfix: detecting potential closures in nested polymorph lookups
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 24 Apr 2023 01:56:23 +0000 (20:56 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 24 Apr 2023 01:56:23 +0000 (20:56 -0500)
compiler/src/clone.c

index fc94a293308d78122e66aba79f71c44a5c701e93..0bcdd608f8bdc5467fd6dae9c8de6e7335142e2a 100644 (file)
@@ -524,7 +524,7 @@ AstNode* ast_clone(bh_allocator a, void* n) {
                 df->scope_to_lookup_captured_values = NULL;
             }
 
-            if (clone_depth > 1) {
+            if (clone_depth > 1 && captured_entities) {
                 sf->flags |= Ast_Flag_Function_Is_Lambda_Inside_PolyProc;
                 df->flags &= ~Ast_Flag_Function_Is_Lambda_Inside_PolyProc;
                 E(df);