View Issue Details

IDProjectCategoryView StatusLast Update
0037751pas2jsrtlpublic2020-09-21 13:06
Reporterhenrique Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
PlatformPas2JsOSWindows 
Summary0037751: Invoke procedure
DescriptionI implemented only invoke for class constructors. I need it for a deserializer I'm implementing.
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

henrique

2020-09-15 21:55

reporter  

Invoke.patch (564 bytes)   
diff -r packages/rtl/rtti.pas (1159301e) packages/rtl/rtti.pas (Working Tree)
152a153,154
>     function Invoke(ThisArg: TJSObject; const AArgs: TJSValueDynArray): TValue;
> 
992a995,1007
> function TRttiMethod.Invoke(ThisArg: TJSObject; const AArgs: TJSValueDynArray): TValue;
> var
>   Metaclass: TJSObject;
> 
> begin
>   if IsConstructor then
>   begin
>     Metaclass := TJSObject(TRttiInstanceType(Parent).MetaClassType);
> 
>     Result := TValue.FromJSValue(TJSFunction(Metaclass['$create']).apply(Metaclass, [Name]));
>   end;
> end;
> 
Invoke.patch (564 bytes)   

henrique

2020-09-16 16:36

reporter   ~0125570

The way I do before, don't create the correct class.
Constructor.patch (425 bytes)   
diff -r packages/rtl/rtti.pas (1159301e) packages/rtl/rtti.pas (Working Tree)
152a153,154
>     function Invoke(ThisArg: TJSObject; const AArgs: TJSValueDynArray): TValue;
> 
992a995,1000
> function TRttiMethod.Invoke(ThisArg: TJSObject; const AArgs: TJSValueDynArray): TValue;
> begin
>   if IsConstructor then
>     Result := TValue.FromJSValue(TJSFunction(ThisArg['$create']).apply(ThisArg, [Name]));
> end;
> 
Constructor.patch (425 bytes)   

Issue History

Date Modified Username Field Change
2020-09-15 21:55 henrique New Issue
2020-09-15 21:55 henrique File Added: Invoke.patch
2020-09-16 16:36 henrique Note Added: 0125570
2020-09-16 16:36 henrique File Added: Constructor.patch