View Issue Details

IDProjectCategoryView StatusLast Update
0037540pas2jsrtlpublic2020-08-11 13:47
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Fixed in Versiontrunk 
Summary0037540: RTTI Implementation
DescriptionImplemented the get and set functions of the properties.
TagsNo tags attached.
Fixed in Revision823
Attached Files

Activities

henrique

2020-08-10 19:57

reporter  

RTTI.patch (1,830 bytes)   
From 3badf537013ce79665517b55b3d70fb379b13eab Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Mon, 10 Aug 2020 14:53:44 -0300
Subject: [PATCH] Get e set da propriedades.

---
 packages/rtl/rtti.pas | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/packages/rtl/rtti.pas b/packages/rtl/rtti.pas
index 8ef2cf7..5511107 100644
--- a/packages/rtl/rtti.pas
+++ b/packages/rtl/rtti.pas
@@ -166,8 +166,8 @@ type
   protected
     function GetVisibility: TMemberVisibility; override;
   public
-    //function GetValue(Instance: Pointer): TValue;
-    //procedure SetValue(Instance: Pointer; const AValue: TValue);
+    function GetValue(Instance: TObject): TValue;
+    procedure SetValue(Instance: TObject; const AValue: TValue);
     property PropertyType: TRttiType read GetPropertyType;
     property IsReadable: boolean read GetIsReadable;
     property IsWritable: boolean read GetIsWritable;
@@ -209,6 +209,7 @@ type
     function GetDeclaredMethods: TRttiMethodArray; virtual;
     function GetDeclaredFields: TRttiFieldArray; virtual;
 
+    property Handle: TTypeInfo read FTypeInfo;
     property IsInstance: boolean read GetIsInstance;
     //property isManaged: boolean read GetIsManaged;
     property IsOrdinal: boolean read GetIsOrdinal;
@@ -666,6 +667,16 @@ end;
 
 { TRttiProperty }
 
+function TRttiProperty.GetValue(Instance: TObject): TValue;
+begin
+  Result := TValue.FromJSValue(GetJSValueProp(Instance, TTypeMemberProperty(FTypeInfo)));
+end;
+
+procedure TRttiProperty.SetValue(Instance: TObject; const AValue: TValue);
+begin
+  SetJSValueProp(Instance, TTypeMemberProperty(FTypeInfo), AValue);
+end;
+
 function TRttiProperty.GetPropertyType: TRttiType;
 begin
   Result := GRttiContext.GetType(FTypeInfo);
-- 
2.28.0.windows.1

RTTI.patch (1,830 bytes)   

Michael Van Canneyt

2020-08-11 13:47

administrator   ~0124759

Checked & applied, thank you very much !

Issue History

Date Modified Username Field Change
2020-08-10 19:57 henrique New Issue
2020-08-10 19:57 henrique File Added: RTTI.patch
2020-08-11 07:56 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-11 07:56 Michael Van Canneyt Status new => assigned
2020-08-11 13:47 Michael Van Canneyt Status assigned => resolved
2020-08-11 13:47 Michael Van Canneyt Resolution open => fixed
2020-08-11 13:47 Michael Van Canneyt Fixed in Version => trunk
2020-08-11 13:47 Michael Van Canneyt Fixed in Revision => 823
2020-08-11 13:47 Michael Van Canneyt Note Added: 0124759