Browse Source

* a function also captures other nested functions when these are called

Sven/Sarah Barth 3 years ago
parent
commit
cdf676c9b5
1 changed files with 7 additions and 0 deletions
  1. 7 0
      compiler/ncal.pas

+ 7 - 0
compiler/ncal.pas

@@ -4200,6 +4200,13 @@ implementation
          if assigned(call_vmt_node) then
            typecheckpass(call_vmt_node);
 
+         if assigned(current_procinfo) and
+             (procdefinition.typ=procdef) and
+             (procdefinition.parast.symtablelevel<=current_procinfo.procdef.parast.symtablelevel) and
+             (procdefinition.parast.symtablelevel>normal_function_level) and
+             (current_procinfo.procdef.parast.symtablelevel>normal_function_level) then
+           current_procinfo.add_captured_sym(tprocdef(procdefinition).procsym,fileinfo);
+
          finally
            aktcallnode:=oldcallnode;
          end;