mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-14 21:59:24 +02:00
rtl: added TRttiProperty.Index and IsClassProperty
This commit is contained in:
parent
37b7f89a39
commit
752c5a130d
@ -283,6 +283,9 @@ type
|
||||
TRttiProperty = class(TRttiDataMember)
|
||||
private
|
||||
function GetDataType: TRttiType; override;
|
||||
function GetDefault: JSValue;
|
||||
function GetIndex: Integer;
|
||||
function GetIsClassProperty: boolean;
|
||||
function GetPropertyTypeInfo: TTypeMemberProperty;
|
||||
function GetPropertyType: TRttiType;
|
||||
function GetIsWritable: boolean; override;
|
||||
@ -298,6 +301,9 @@ type
|
||||
|
||||
property PropertyTypeInfo: TTypeMemberProperty read GetPropertyTypeInfo;
|
||||
property PropertyType: TRttiType read GetPropertyType;
|
||||
property Default: JSValue read GetDefault;
|
||||
property Index: Integer read GetIndex;
|
||||
property IsClassProperty: boolean read GetIsClassProperty;
|
||||
property IsReadable: boolean read GetIsReadable;
|
||||
property IsWritable: boolean read GetIsWritable;
|
||||
property Visibility: TMemberVisibility read GetVisibility;
|
||||
@ -2271,6 +2277,24 @@ begin
|
||||
Result := GetPropertyType;
|
||||
end;
|
||||
|
||||
function TRttiProperty.GetDefault: JSValue;
|
||||
begin
|
||||
Result:=PropertyTypeInfo.Default;
|
||||
end;
|
||||
|
||||
function TRttiProperty.GetIndex: Integer;
|
||||
begin
|
||||
if isUndefined(PropertyTypeInfo.Index) then
|
||||
Result:=0
|
||||
else
|
||||
Result:=Integer(PropertyTypeInfo.Index);
|
||||
end;
|
||||
|
||||
function TRttiProperty.GetIsClassProperty: boolean;
|
||||
begin
|
||||
Result:=(PropertyTypeInfo.Flags and pfClassProperty) > 0;
|
||||
end;
|
||||
|
||||
function TRttiProperty.GetPropertyTypeInfo: TTypeMemberProperty;
|
||||
begin
|
||||
Result := TTypeMemberProperty(inherited Handle);
|
||||
|
@ -252,6 +252,7 @@ const
|
||||
pfStoredFunction = 12; // stored function, function name is in Stored
|
||||
pfHasIndex = 16; { if getter is function, append Index as last param
|
||||
if setter is function, append Index as second last param }
|
||||
pfClassProperty = 32;
|
||||
type
|
||||
{ TTypeMemberProperty - Kind = tmkProperty }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user