Variables capturing preparation.
Mark broken anonymous function's tests.

Initialization of closure variable in "var" section fails with "typed constants of classes are not allowed".
Closure variable with generis parameters in type fails with "undefined identidier".
Capturing with nesting level = 1.

Allow to capture local variables of declaring subroutine. Like this:
procedure Owner;
var
  data:integer;
begin
  p:=procedure begin
       writeln(data);
     end
end;

1. Captured variable become capturer's field.
2. Access to captured variables:
   +owner procedure: using variable $capturer which holds link to capturer;
   +closure: using self variable.

TODO:
1. copy/copy_back of procedure params;
2. remove captured variables from owner's symtable;
3. capturing in case of nesting level>1.

Implementation details:
+ capture from closures: detect during parse phase, replace by field access;
+ captured variables from owner's body can be replaces only when body is parsed; currently replaced on first pass of tloadnode.
Dont produce local classes.

Simply register capturer class in module local symtable.

Now we generate frame object as local class. But local classes introduce problems:
-too long mangled names;
-additional changes in ncgvmt to generate interface wrappers;

Moreover there is some strange error. Capturer of function which returns closure-function have incorrect mangled name of Apply method. Assembler fails with error. Probably it will make sense to investigate in future.
Tests for capture with nestin level=1 for local variables(not params).

Capturing of parameters will require copy/copy_back of parameters and handling of var/out modifiers.
Rename "frame object" to "capturer".
Copy captured parameters to capturer.

Capturede function parameters can't be removed since they are part of function signature. Copy values of parameters into corresponding capturer's fields.
Tests for parameters capturing.
Capture with nesting level >= 1.

Access:
Nesting level=0: simple access to variables, possibly using parentfp.
Nesting level=1: we are inside closure(or it's nesting functions); required variable located in capturer which is "self" variable of current method, so load field from self.
Nesting level>1: we are inside closure and required field not inside "self". Load required capturer using "parent" link of capturer.

Parent link:
Each capturer have parent link. For simplicity we create capturer for each function which is on path from closure to captured variable. For example:
procedure have_captured;
  var
    i_am_captured:integer;
  procedure have_not_captured;
    procedure have_closure;
      begin
        p:=procedure
           begin
             writeln(i_am_captured);
           end;
...
have_closure - have capturer because have closure;
have_captured - have capturer because have captured variables;
have_not_captured - also have capturer because is's on path from have_closure to have_captured.

Access to capturer:
1. Normal function(not closure not nested): not require parent link.
2. Nested function(not inside closure): can access parent capturer using parentfp.
3. Closure: "self" variable.
3. Nested inside closure: "self" variable.

Each of described functions can create closure. During new capturer creation parent capturer is accessible as described above.
Make name of capturer defenition unique.

Problem: Commit "Dont produce local classes." makes possible situation when different capturer definitions have same names.
Fix: Add line and pos to name of capturer definition.
Place capturer's parent link in capturer not in procedure's symtable.

Accidental mistake.
Tests for deep capturing. Some test fail.

Problem: closure can capture variable with nesting deeper than 1. But second access to this variable will be incorrect(walk through parent link is missed). There should be optimization which saves last access node, or smth like this. In any case deep access should be moved somewhere from parsing phase. Probably into pass1.
Walk through capturer's parent link using information from symtables.

Current capturer is "self". "parent" link is field of capturer so we can search in symtable and then get type of next capturer. Then generate load and so on. Such code will be more portable than previous version which walks through symtable stack.
Test closure with nested function which captures data.
Fix nesting calculation.
Fix problem with multiple access to same captured variable.

Problem: in case of capturing with deep nesting level(>1) works only first access.
Cause: during first access to captured variable we add copy of this variable to capturer, but symtable of capturer is in symtablestack(see "handle_possible_capture"). Next access will create access to field of capturer which is not handled by us.
Fix: mangle names of symbols which are moved to capturer.
Tests. Closure prodeces closure. More cases of capture.
Move replacement of tloadnode of captured variables into pass_1.

During parsing:
+construct capturers;
+mark variables as captured;
+mirror variables to capturer;
+add parent links to capturer which are used to nested access;

During pass_1:
+replace tloadnode of captured variables by series of tsubscript nodes to access required capturer.
Test for initialization of captured variables in "var" section. Little fix.

Problem: initialization of captured variables in "var" section doesn't work. Resulting program fails in runtime with access violation.
Cause: code which initialize local variables is added before code which creates capturer.
Fix: create capturer and then initialize capturer's fields.
Tests. Get addres of captured variable. Capture record and class.