mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 04:29:10 +02:00
* Sequence result support
This commit is contained in:
parent
05118c077f
commit
dc7130d078
@ -1876,7 +1876,10 @@ begin
|
||||
CN:=GetTypeName(TIDLSequenceTypeDefDefinition(D));
|
||||
sDef:=FindGlobalDef(CN);
|
||||
if (SDef=Nil) or (sDef.Data=Nil) then
|
||||
Result:=CreatePasData(EscapeKeyWord(CN),D,true)
|
||||
begin
|
||||
Result:=CreatePasData(EscapeKeyWord(CN),D,true);
|
||||
AddJSIdentifier(D);
|
||||
end
|
||||
else
|
||||
Result:=ClonePasData(TPasData(sDef.Data),D);
|
||||
D.Data:=Result;
|
||||
|
@ -58,6 +58,7 @@ type
|
||||
procedure TestWJ_IntfFunction_ArrayBufferArg;
|
||||
procedure TestWJ_IntfFunction_ArrayBufferViewArg;
|
||||
procedure TestWJ_IntfFunction_SequenceResult;
|
||||
procedure TestWJ_IntfFunction_GlobalSequenceResult;
|
||||
// Namespace attribute
|
||||
procedure TestWJ_NamespaceAttribute_Boolean;
|
||||
// maplike
|
||||
@ -1177,6 +1178,55 @@ begin
|
||||
]);
|
||||
end;
|
||||
|
||||
procedure TTestWebIDL2WasmJob.TestWJ_IntfFunction_GlobalSequenceResult;
|
||||
begin
|
||||
TestWebIDL([
|
||||
'typedef sequence <long> LongSeq;',
|
||||
'interface Attr {',
|
||||
' LongSeq vibrate();',
|
||||
'};',
|
||||
''],
|
||||
[
|
||||
'Type',
|
||||
'',
|
||||
' // Forward class definitions',
|
||||
' IJSAttr = interface;',
|
||||
' TJSAttr = class;',
|
||||
' TIntegerDynArray = IJSArray; // array of Integer',
|
||||
'',
|
||||
' { --------------------------------------------------------------------',
|
||||
' TJSAttr',
|
||||
' --------------------------------------------------------------------}',
|
||||
'',
|
||||
' IJSAttr = interface(IJSObject)',
|
||||
' [''{AA94F48A-2BFB-3877-82A6-208CA4B2AF2A}'']',
|
||||
' function vibrate: TIntegerDynArray;',
|
||||
' end;',
|
||||
'',
|
||||
' TJSAttr = class(TJSObject,IJSAttr)',
|
||||
' Private',
|
||||
' Public',
|
||||
' function vibrate: TIntegerDynArray;',
|
||||
' class function Cast(const Intf: IJSObject): IJSAttr;',
|
||||
' end;',
|
||||
'',
|
||||
'implementation',
|
||||
'',
|
||||
'function TJSAttr.vibrate: TIntegerDynArray;',
|
||||
'begin',
|
||||
' Result:=InvokeJSObjectResult(''vibrate'',[],TJSArray) as TIntegerDynArray;',
|
||||
'end;',
|
||||
'',
|
||||
'class function TJSAttr.Cast(const Intf: IJSObject): IJSAttr;',
|
||||
'begin',
|
||||
' Result:=TJSAttr.JOBCast(Intf);',
|
||||
'end;',
|
||||
'',
|
||||
'end.'
|
||||
]);
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TTestWebIDL2WasmJob.TestWJ_NamespaceAttribute_Boolean;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user