mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 12:29:14 +02:00
* consider Self parameters of nested functions as captured as well
This commit is contained in:
parent
d56a90e5ed
commit
5129c2cb9a
@ -390,7 +390,13 @@ implementation
|
||||
{ reference in nested procedures, variable needs to be in memory }
|
||||
{ and behaves as if its address escapes its parent block }
|
||||
make_not_regable(self,[ra_different_scope]);
|
||||
end;
|
||||
end
|
||||
{ if this is a nested function and it uses the Self parameter then
|
||||
consider this as captured as well (needed for anonymous functions) }
|
||||
else if assigned(current_procinfo) and
|
||||
(vo_is_self in tabstractvarsym(symtableentry).varoptions) and
|
||||
(symtable.symtablelevel>normal_function_level) then
|
||||
current_procinfo.add_captured_sym(symtableentry,fileinfo);
|
||||
resultdef:=tabstractvarsym(symtableentry).vardef;
|
||||
|
||||
{ e.g. self for objects is passed as var-parameter on the caller
|
||||
|
Loading…
Reference in New Issue
Block a user