mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:09:42 +02:00
* Handle "object" as argument type
This commit is contained in:
parent
51ffa2220e
commit
e044aae4dc
@ -1029,6 +1029,7 @@ begin
|
||||
'UnicodeString': GetFunc:='GetString';
|
||||
'Variant': GetFunc:='GetVariant';
|
||||
'TJOB_JSValue': GetFunc:='GetValue';
|
||||
'IJSObject': GetFunc:='GetObject';
|
||||
else
|
||||
if (ArgType is TIDLInterfaceDefinition) or (ArgType is TIDLDictionaryDefinition) then
|
||||
GetFunc:='GetObject('+GetName(ArgType)+') as '+ArgTypeName
|
||||
@ -1088,6 +1089,7 @@ begin
|
||||
'UnicodeString': GetFunc:='Result:=H.AllocString('+Call+');';
|
||||
'Variant': GetFunc:='Result:=H.AllocVariant('+Call+');';
|
||||
'TJOB_JSValue': GetFunc:='Result:=H.AllocJSValue('+Call+');';
|
||||
'IJSObject' : GetFunc:='Result:=H.AllocIntf('+Call+');'
|
||||
else
|
||||
if ReturnDef is TIDLInterfaceDefinition then
|
||||
GetFunc:='Result:=H.AllocIntf('+Call+');'
|
||||
|
@ -45,6 +45,8 @@ type
|
||||
procedure TestWJ_IntfAttribute_ArrayBufferView;
|
||||
procedure TestWJ_IntfAttribute_ChromeOnly;
|
||||
|
||||
procedure TestWJ_CallBackObject;
|
||||
|
||||
// todo procedure TestWJ_IntfAttribute_Any;
|
||||
|
||||
// functions
|
||||
@ -684,6 +686,33 @@ begin
|
||||
]);
|
||||
end;
|
||||
|
||||
procedure TTestWebIDL2WasmJob.TestWJ_CallBackObject;
|
||||
|
||||
begin
|
||||
WebIDLToPas.TypeAliases.Add('AudioWorkletProcessor=IJSObject');
|
||||
TestWebIDL([
|
||||
' callback constructor AudioWorkletProcessorConstructor = AudioWorkletProcessor (object options);'
|
||||
],
|
||||
[
|
||||
'Type',
|
||||
' // Forward class definitions',
|
||||
' TAudioWorkletProcessorConstructor = function (options: IJSObject): IJSObject of object;',
|
||||
'',
|
||||
'implementation',
|
||||
'',
|
||||
'function JOBCallTAudioWorkletProcessorConstructor(const aMethod: TMethod; var H: TJOBCallbackHelper): PByte;',
|
||||
' var',
|
||||
' options: IJSObject;',
|
||||
'begin',
|
||||
' options:=H.GetObject;',
|
||||
' Result:=H.AllocIntf(TAudioWorkletProcessorConstructor(aMethod)(options));',
|
||||
'end;',
|
||||
'',
|
||||
'end.'
|
||||
]);
|
||||
|
||||
end;
|
||||
|
||||
procedure TTestWebIDL2WasmJob.TestWJ_IntfFunction_Void;
|
||||
begin
|
||||
TestWebIDL([
|
||||
|
Loading…
Reference in New Issue
Block a user