mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-26 21:09:26 +02:00
Adding static properties to extended RTTI
This commit is contained in:
parent
89b1cdefbe
commit
4b92df28cf
@ -1065,8 +1065,10 @@ implementation
|
||||
sym:=tsym(st.SymList[i]);
|
||||
if (tsym(sym).typ=propertysym) and
|
||||
(sym.visibility in visibilities) and
|
||||
(extended_rtti or (tpropertysym(sym).parast=Nil)) and
|
||||
not (sp_static in sym.symoptions) then
|
||||
(extended_rtti or (
|
||||
(tpropertysym(sym).parast=Nil) and
|
||||
not (sp_static in sym.symoptions)
|
||||
)) then
|
||||
inc(result);
|
||||
end;
|
||||
end;
|
||||
@ -1158,6 +1160,9 @@ implementation
|
||||
if addcomments then
|
||||
tcb.emit_comment(#9'proc types');
|
||||
tcb.emit_ord_const(proctypesinfo,u8inttype);
|
||||
if addcomments then
|
||||
tcb.emit_comment(#9'is static prop');
|
||||
tcb.emit_ord_const(ord(sp_static in sym.symoptions),pasbool1type);
|
||||
{ index parameters }
|
||||
if addcomments then
|
||||
tcb.emit_comment(#9'indexed params');
|
||||
@ -1191,8 +1196,7 @@ implementation
|
||||
sym:=tsym(st.SymList[i]);
|
||||
if (sym.typ=propertysym) and
|
||||
(sym.visibility in visibilities) and
|
||||
(extended_rtti or (tpropertysym(sym).parast=Nil)) and
|
||||
not (sp_static in sym.symoptions) then
|
||||
(extended_rtti or (tpropertysym(sym).parast=Nil)) then
|
||||
begin
|
||||
if extended_rtti then
|
||||
begin
|
||||
@ -1226,7 +1230,7 @@ implementation
|
||||
tcb.end_anonymous_record;
|
||||
maybe_add_comment(tcb,'RTTI: end property '+sym.prettyname);
|
||||
end
|
||||
else
|
||||
else if not (sp_static in sym.symoptions) then
|
||||
write_propinfo_data(tcb,tpropertysym(sym));
|
||||
end;
|
||||
end;
|
||||
|
@ -1124,6 +1124,7 @@ unit TypInfo;
|
||||
// 6 : true, constant index property
|
||||
PropProcs : Byte;
|
||||
|
||||
IsStatic : Boolean;
|
||||
PropParams : PPropParams;
|
||||
|
||||
{$ifdef PROVIDE_ATTR_TABLE}
|
||||
@ -5148,4 +5149,4 @@ begin
|
||||
end;
|
||||
{$ENDIF HAVE_INVOKEHELPER}
|
||||
|
||||
end.
|
||||
end.
|
||||
|
34
tests/test/texrtti20.pp
Normal file
34
tests/test/texrtti20.pp
Normal file
@ -0,0 +1,34 @@
|
||||
{$Mode ObjFPC}
|
||||
uses typinfo;
|
||||
|
||||
type
|
||||
{$RTTI EXPLICIT
|
||||
FIELDS([vcPublic])
|
||||
PROPERTIES([vcPublic,vcPublished])
|
||||
METHODS([vcPublic,vcPublished])}
|
||||
TPropClass=class
|
||||
private
|
||||
FValue: Integer;
|
||||
class var
|
||||
FClassValue: Integer;
|
||||
public
|
||||
property InstanceProp: Integer read FValue;
|
||||
class property ClassProp: Integer read FClassValue;
|
||||
end;
|
||||
|
||||
var
|
||||
cd:PClassData;
|
||||
begin
|
||||
cd:=PClassData(GetTypeData(TypeInfo(TPropClass)));
|
||||
if not assigned(cd^.ExRTTITable) then
|
||||
Halt(1);
|
||||
if cd^.ExRTTITable^.PropCount<>2 then
|
||||
Halt(2);
|
||||
if (cd^.ExRTTITable^.Prop[0]^.Info^.Name<>'InstanceProp') or
|
||||
(cd^.ExRTTITable^.Prop[0]^.Info^.IsStatic<>False) then
|
||||
Halt(3);
|
||||
if (cd^.ExRTTITable^.Prop[1]^.Info^.Name<>'ClassProp') or
|
||||
(cd^.ExRTTITable^.Prop[1]^.Info^.IsStatic<>True) then
|
||||
Halt(3);
|
||||
WriteLn('ok');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user