mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-01 06:22:39 +02:00
compiler: write INIT and RTTI info also for defs of nested records and classes + test (issue #0020909)
git-svn-id: trunk@20162 -
This commit is contained in:
parent
d752ce2c11
commit
a71d588105
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -12163,6 +12163,7 @@ tests/webtbs/tw20873.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw20874a.pp svneol=native#text/pascal
|
tests/webtbs/tw20874a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20874b.pp svneol=native#text/pascal
|
tests/webtbs/tw20874b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20889.pp svneol=native#text/pascal
|
tests/webtbs/tw20889.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw20909.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20962.pp svneol=native#text/plain
|
tests/webtbs/tw20962.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw20995a.pp svneol=native#text/pascal
|
tests/webtbs/tw20995a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20995b.pp svneol=native#text/pascal
|
tests/webtbs/tw20995b.pp svneol=native#text/pascal
|
||||||
@ -12986,6 +12987,8 @@ tests/webtbs/uw19701.pas svneol=native#text/plain
|
|||||||
tests/webtbs/uw19851.pp svneol=native#text/pascal
|
tests/webtbs/uw19851.pp svneol=native#text/pascal
|
||||||
tests/webtbs/uw2004.inc svneol=native#text/plain
|
tests/webtbs/uw2004.inc svneol=native#text/plain
|
||||||
tests/webtbs/uw2040.pp svneol=native#text/plain
|
tests/webtbs/uw2040.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/uw20909a.pas svneol=native#text/pascal
|
||||||
|
tests/webtbs/uw20909b.pas svneol=native#text/pascal
|
||||||
tests/webtbs/uw2266a.inc svneol=native#text/plain
|
tests/webtbs/uw2266a.inc svneol=native#text/plain
|
||||||
tests/webtbs/uw2266b.pas svneol=native#text/plain
|
tests/webtbs/uw2266b.pas svneol=native#text/plain
|
||||||
tests/webtbs/uw2269.inc svneol=native#text/plain
|
tests/webtbs/uw2269.inc svneol=native#text/plain
|
||||||
|
@ -1398,8 +1398,8 @@ implementation
|
|||||||
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable,false);
|
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable,false);
|
||||||
|
|
||||||
{ generate rtti/init tables }
|
{ generate rtti/init tables }
|
||||||
write_persistent_type_info(current_module.globalsymtable);
|
write_persistent_type_info(current_module.globalsymtable,true);
|
||||||
write_persistent_type_info(current_module.localsymtable);
|
write_persistent_type_info(current_module.localsymtable,false);
|
||||||
|
|
||||||
{ Tables }
|
{ Tables }
|
||||||
InsertThreadvars;
|
InsertThreadvars;
|
||||||
@ -2395,7 +2395,7 @@ implementation
|
|||||||
InsertThreadvars;
|
InsertThreadvars;
|
||||||
|
|
||||||
{ generate rtti/init tables }
|
{ generate rtti/init tables }
|
||||||
write_persistent_type_info(current_module.localsymtable);
|
write_persistent_type_info(current_module.localsymtable,false);
|
||||||
|
|
||||||
{ if an Objective-C module, generate rtti and module info }
|
{ if an Objective-C module, generate rtti and module info }
|
||||||
MaybeGenerateObjectiveCImageInfo(nil,current_module.localsymtable);
|
MaybeGenerateObjectiveCImageInfo(nil,current_module.localsymtable);
|
||||||
|
@ -50,7 +50,7 @@ interface
|
|||||||
procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
|
procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
|
||||||
|
|
||||||
{ generate persistent type information like VMT, RTTI and inittables }
|
{ generate persistent type information like VMT, RTTI and inittables }
|
||||||
procedure write_persistent_type_info(st:tsymtable);
|
procedure write_persistent_type_info(st:tsymtable;is_global:boolean);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -1552,7 +1552,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure write_persistent_type_info(st:tsymtable);
|
procedure write_persistent_type_info(st:tsymtable;is_global:boolean);
|
||||||
var
|
var
|
||||||
i : longint;
|
i : longint;
|
||||||
def : tdef;
|
def : tdef;
|
||||||
@ -1563,14 +1563,14 @@ implementation
|
|||||||
def:=tdef(st.DefList[i]);
|
def:=tdef(st.DefList[i]);
|
||||||
case def.typ of
|
case def.typ of
|
||||||
recorddef :
|
recorddef :
|
||||||
write_persistent_type_info(trecorddef(def).symtable);
|
write_persistent_type_info(trecorddef(def).symtable,is_global);
|
||||||
objectdef :
|
objectdef :
|
||||||
begin
|
begin
|
||||||
{ Skip generics and forward defs }
|
{ Skip generics and forward defs }
|
||||||
if (df_generic in def.defoptions) or
|
if (df_generic in def.defoptions) or
|
||||||
(oo_is_forward in tobjectdef(def).objectoptions) then
|
(oo_is_forward in tobjectdef(def).objectoptions) then
|
||||||
continue;
|
continue;
|
||||||
write_persistent_type_info(tobjectdef(def).symtable);
|
write_persistent_type_info(tobjectdef(def).symtable,is_global);
|
||||||
{ Write also VMT if not done yet }
|
{ Write also VMT if not done yet }
|
||||||
if not(ds_vmt_written in def.defstates) then
|
if not(ds_vmt_written in def.defstates) then
|
||||||
begin
|
begin
|
||||||
@ -1587,9 +1587,9 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if assigned(tprocdef(def).localst) and
|
if assigned(tprocdef(def).localst) and
|
||||||
(tprocdef(def).localst.symtabletype=localsymtable) then
|
(tprocdef(def).localst.symtabletype=localsymtable) then
|
||||||
write_persistent_type_info(tprocdef(def).localst);
|
write_persistent_type_info(tprocdef(def).localst,false);
|
||||||
if assigned(tprocdef(def).parast) then
|
if assigned(tprocdef(def).parast) then
|
||||||
write_persistent_type_info(tprocdef(def).parast);
|
write_persistent_type_info(tprocdef(def).parast,false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ generate always persistent tables for types in the interface so it can
|
{ generate always persistent tables for types in the interface so it can
|
||||||
@ -1597,7 +1597,7 @@ implementation
|
|||||||
{ Init }
|
{ Init }
|
||||||
if (
|
if (
|
||||||
assigned(def.typesym) and
|
assigned(def.typesym) and
|
||||||
(st.symtabletype=globalsymtable) and
|
is_global and
|
||||||
not is_objc_class_or_protocol(def)
|
not is_objc_class_or_protocol(def)
|
||||||
) or
|
) or
|
||||||
is_managed_type(def) or
|
is_managed_type(def) or
|
||||||
@ -1606,7 +1606,7 @@ implementation
|
|||||||
{ RTTI }
|
{ RTTI }
|
||||||
if (
|
if (
|
||||||
assigned(def.typesym) and
|
assigned(def.typesym) and
|
||||||
(st.symtabletype=globalsymtable) and
|
is_global and
|
||||||
not is_objc_class_or_protocol(def)
|
not is_objc_class_or_protocol(def)
|
||||||
) or
|
) or
|
||||||
(ds_rtti_table_used in def.defstates) then
|
(ds_rtti_table_used in def.defstates) then
|
||||||
|
11
tests/webtbs/tw20909.pp
Normal file
11
tests/webtbs/tw20909.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{%norun}
|
||||||
|
program tw20909;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uw20909a, uw20909b;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
26
tests/webtbs/uw20909a.pas
Normal file
26
tests/webtbs/uw20909a.pas
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
unit uw20909a;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, uw20909b;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TMyEvent = procedure(var Items: Storage.Folders.TItem) of object;
|
||||||
|
|
||||||
|
TMyClass = class
|
||||||
|
private
|
||||||
|
FOnChange: uw20909b.Storage.Folders.TItemsEvent;
|
||||||
|
FMyEvent: TMyEvent;
|
||||||
|
public
|
||||||
|
property OnChange: Storage.Folders.TItemsEvent read FOnChange write FOnChange;
|
||||||
|
property MyEvent: TMyEvent read FMyEvent write FMyEvent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
35
tests/webtbs/uw20909b.pas
Normal file
35
tests/webtbs/uw20909b.pas
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
unit uw20909b;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
Storage = class
|
||||||
|
public
|
||||||
|
type
|
||||||
|
Folders = class
|
||||||
|
public
|
||||||
|
const
|
||||||
|
FLAG_REFRESH = 1;
|
||||||
|
FLAG_DELETE = 2;
|
||||||
|
type
|
||||||
|
TItem = record
|
||||||
|
ID: int64;
|
||||||
|
Path: string;
|
||||||
|
end;
|
||||||
|
PItem = ^TItem;
|
||||||
|
TItems = array of PItem;
|
||||||
|
PItems = ^TItems;
|
||||||
|
|
||||||
|
TItemsEvent = procedure(var Items: TItems) of object;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user