* fix #41063: don't add classrefdefs or objectdefs to the WPOInfo if they are declared locally (e.g. capturer instances)

+ added test
This commit is contained in:
Sven/Sarah Barth 2024-12-26 16:32:45 +01:00
parent 291d2e911a
commit 32b3477fe2
3 changed files with 37 additions and 2 deletions

View File

@ -8724,7 +8724,8 @@ implementation
if not classref_created_in_current_module then
begin
classref_created_in_current_module:=true;
current_module.wpoinfo.addcreatedobjtypeforclassref(self);
if not (owner.symtabletype in [localsymtable]) then
current_module.wpoinfo.addcreatedobjtypeforclassref(self);
end;
end;
@ -8734,7 +8735,8 @@ implementation
if not created_in_current_module then
begin
created_in_current_module:=true;
current_module.wpoinfo.addcreatedobjtype(self);
if not (owner.symtabletype in [localsymtable]) then
current_module.wpoinfo.addcreatedobjtype(self);
end;
end;

11
tests/webtbs/tw41063.pp Normal file
View File

@ -0,0 +1,11 @@
{ %wpoparas=optvmts }
{ %wpopasses=1 }
program tw41063;
{$mode objfpc}{$h+}
uses uw41063;
begin
end.

22
tests/webtbs/uw41063.pp Normal file
View File

@ -0,0 +1,22 @@
unit uw41063;
{$mode objfpc}{$h+}
{$modeswitch functionreferences}
interface
type
TMyClass = class
FProcRef: reference to procedure;
procedure proc;
end;
implementation
procedure TMyClass.proc;
begin
FProcRef := @proc;
end;
end.