mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-07 18:07:49 +02:00
* Add convenience methods for TrttiMethod.invoke()
This commit is contained in:
parent
57e4a2e281
commit
6099074969
@ -216,6 +216,8 @@ type
|
||||
public
|
||||
function GetParameters: TRttiParameterArray;
|
||||
function Invoke(const Instance: TValue; const Args: array of TValue): TValue;
|
||||
function Invoke(const Instance: TObject; const Args: array of TValue): TValue;
|
||||
function Invoke(const aClass: TClass; const Args: array of TValue): TValue;
|
||||
|
||||
property IsAsyncCall: Boolean read GetIsAsyncCall;
|
||||
property IsClassMethod: Boolean read GetIsClassMethod;
|
||||
@ -1894,6 +1896,26 @@ begin
|
||||
Result.SetData(TJSFunction(TJSObject(Instance.AsJSValue)[Name]).apply(TJSObject(Instance.AsJSValue), AArgs));
|
||||
end;
|
||||
|
||||
function TRttiMethod.Invoke(const Instance: TObject; const Args: array of TValue): TValue;
|
||||
|
||||
var
|
||||
v : TValue;
|
||||
|
||||
begin
|
||||
TValue.make(Instance,Instance.ClassInfo,v);
|
||||
Result:=Invoke(v,Args);
|
||||
end;
|
||||
|
||||
function TRttiMethod.Invoke(const aClass: TClass; const Args: array of TValue
|
||||
): TValue;
|
||||
var
|
||||
v : TValue;
|
||||
|
||||
begin
|
||||
TValue.make(aClass,aClass.ClassInfo,v);
|
||||
Result:=Invoke(V,Args);
|
||||
end;
|
||||
|
||||
{ TRttiProperty }
|
||||
|
||||
constructor TRttiProperty.Create(AParent: TRttiType; ATypeInfo: TTypeMember);
|
||||
|
Loading…
Reference in New Issue
Block a user