mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-30 15:40:10 +02:00
* Add convenience methods for TrttiMethod.invoke()
This commit is contained in:
parent
57e4a2e281
commit
6099074969
@ -216,6 +216,8 @@ type
|
|||||||
public
|
public
|
||||||
function GetParameters: TRttiParameterArray;
|
function GetParameters: TRttiParameterArray;
|
||||||
function Invoke(const Instance: TValue; const Args: array of TValue): TValue;
|
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 IsAsyncCall: Boolean read GetIsAsyncCall;
|
||||||
property IsClassMethod: Boolean read GetIsClassMethod;
|
property IsClassMethod: Boolean read GetIsClassMethod;
|
||||||
@ -1894,6 +1896,26 @@ begin
|
|||||||
Result.SetData(TJSFunction(TJSObject(Instance.AsJSValue)[Name]).apply(TJSObject(Instance.AsJSValue), AArgs));
|
Result.SetData(TJSFunction(TJSObject(Instance.AsJSValue)[Name]).apply(TJSObject(Instance.AsJSValue), AArgs));
|
||||||
end;
|
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 }
|
{ TRttiProperty }
|
||||||
|
|
||||||
constructor TRttiProperty.Create(AParent: TRttiType; ATypeInfo: TTypeMember);
|
constructor TRttiProperty.Create(AParent: TRttiType; ATypeInfo: TTypeMember);
|
||||||
|
Loading…
Reference in New Issue
Block a user