webidl: array arg pass as const

This commit is contained in:
mattias 2022-07-08 10:25:40 +02:00
parent f6b5c513bb
commit bcb5365cca
2 changed files with 4 additions and 5 deletions

View File

@ -720,7 +720,7 @@ end;
function TBaseWebIDLToPas.GetSequenceTypeName(
Seq: TIDLSequenceTypeDefDefinition; ForTypeDef: Boolean): string;
begin
writeln('TBaseWebIDLToPas.GetSequenceTypeName ',Seq.ElementType.Name,' ',Seq.ElementType.TypeName);
//writeln('TBaseWebIDLToPas.GetSequenceTypeName ',Seq.ElementType.Name,' ',Seq.ElementType.TypeName);
Result:=GetTypeName(Seq.ElementType,ForTypeDef);
if Result='' then
raise EConvertError.Create('sequence without name at '+GetDefPos(Seq));
@ -806,7 +806,6 @@ begin
if ForTypeDef then ;
Result:=aTypeName;
writeln('BBB1 TBaseWebIDLToPas.GetTypeName ',Result);
D:=FContext.FindDefinition(Result);
if D<>Nil then
Result:=GetName(D)
@ -984,8 +983,10 @@ begin
aTypeName:=GetTypeName(A.ArgumentType);
Arg:=Arg+': '+aTypeName;
Def:=FindGlobalDef(A.ArgumentType.TypeName);
//writeln('TBaseWebIDLToPas.GetArguments Arg="',Arg,'" A.ArgumentType.TypeName=',A.ArgumentType.TypeName,' ',Def<>nil);
if (Def is TIDLFunctionDefinition)
or (Def is TIDLDictionaryDefinition)
or (A.ArgumentType.TypeName='sequence')
or SameText(aTypeName,'UnicodeString') then
Arg:='const '+Arg;
if Result<>'' then

View File

@ -237,20 +237,18 @@ begin
'void': Result:=aTypeName;
else
Def:=FindGlobalDef(aTypeName);
writeln('TWebIDLToPasWasmJob.GetTypeName ',aTypeName,' ',Def<>nil);
//writeln('TWebIDLToPasWasmJob.GetTypeName ',aTypeName,' ',Def<>nil);
if Def is TIDLSequenceTypeDefDefinition then
Result:=GetSequenceTypeName(TIDLSequenceTypeDefDefinition(Def))
else
begin
Result:=inherited GetTypeName(aTypeName,ForTypeDef);
writeln('AAA1 TWebIDLToPasWasmJob.GetTypeName Result=',Result);
if (Result=aTypeName)
and (LeftStr(Result,length(PasInterfacePrefix))<>PasInterfacePrefix)
and (RightStr(Result,length(PasInterfaceSuffix))<>PasInterfaceSuffix)
then
Result:=PasInterfacePrefix+Result+PasInterfaceSuffix;
end;
writeln('AAA2 TWebIDLToPasWasmJob.GetTypeName Result=',Result);
end;
end;