|
@@ -1463,6 +1463,7 @@ implementation
|
|
|
var
|
|
|
i,j : longint;
|
|
|
capturer : tobjectdef;
|
|
|
+ tocapture,
|
|
|
capturedsyms : tfplist;
|
|
|
convertarg : tconvert_arg;
|
|
|
mapping : pconvert_mapping;
|
|
@@ -1550,6 +1551,10 @@ implementation
|
|
|
|
|
|
selfsym:=get_capturer(pd);
|
|
|
|
|
|
+ { only capture those symbols that weren't capture already by one of
|
|
|
+ the above if-clauses and thus are now listed in capturedsyms }
|
|
|
+ tocapture:=tfplist.create;
|
|
|
+
|
|
|
for i:=0 to pd.localst.symlist.count-1 do
|
|
|
begin
|
|
|
sym:=tsym(pd.localst.symlist[i]);
|
|
@@ -1557,7 +1562,7 @@ implementation
|
|
|
continue;
|
|
|
if assigned(tabstractnormalvarsym(sym).capture_sym) then
|
|
|
if capturedsyms.indexof(sym)<0 then
|
|
|
- capturedsyms.add(sym);
|
|
|
+ tocapture.add(sym);
|
|
|
end;
|
|
|
|
|
|
for i:=0 to pd.parast.symlist.count-1 do
|
|
@@ -1570,13 +1575,13 @@ implementation
|
|
|
outermost method }
|
|
|
not (vo_is_self in tabstractvarsym(sym).varoptions) then
|
|
|
if capturedsyms.indexof(sym)<0 then
|
|
|
- capturedsyms.add(sym);
|
|
|
+ tocapture.add(sym);
|
|
|
end;
|
|
|
|
|
|
- for i:=0 to capturedsyms.count-1 do
|
|
|
+ for i:=0 to tocapture.count-1 do
|
|
|
begin
|
|
|
new(mapping);
|
|
|
- mapping^.oldsym:=tsym(capturedsyms[i]);
|
|
|
+ mapping^.oldsym:=tsym(tocapture[i]);
|
|
|
{$ifdef DEBUG_CAPTURER}writeln('Replacing symbol ',mapping^.oldsym.Name);{$endif}
|
|
|
mapping^.newsym:=tabstractnormalvarsym(mapping^.oldsym).capture_sym;
|
|
|
if not assigned(mapping^.newsym) then
|
|
@@ -1584,6 +1589,8 @@ implementation
|
|
|
mapping^.selfnode:=self_tree_for_sym(selfsym,mapping^.newsym);
|
|
|
convertarg.mappings.add(mapping);
|
|
|
end;
|
|
|
+
|
|
|
+ tocapture.free;
|
|
|
end;
|
|
|
|
|
|
{ not required anymore }
|