mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 13:49:40 +02:00
webidl: add typedef
This commit is contained in:
parent
7a1f617194
commit
2076f200de
@ -23,8 +23,6 @@ uses
|
||||
|
||||
Type
|
||||
|
||||
{ TBaseWebIDLToPas }
|
||||
|
||||
{ TPasData }
|
||||
|
||||
TPasData = Class(TObject)
|
||||
@ -55,6 +53,9 @@ const
|
||||
);
|
||||
|
||||
type
|
||||
|
||||
{ TBaseWebIDLToPas }
|
||||
|
||||
TBaseWebIDLToPas = Class(TPascalCodeGenerator)
|
||||
private
|
||||
FArrayPrefix: String;
|
||||
@ -66,7 +67,7 @@ type
|
||||
FContext: TWebIDLContext;
|
||||
FDictionaryClassParent: String;
|
||||
FFieldPrefix: String;
|
||||
FFuncTypePrefix: String;
|
||||
FTypePrefix: String;
|
||||
FGetterPrefix: String;
|
||||
FIncludeImplementationCode: TStrings;
|
||||
FIncludeInterfaceCode: TStrings;
|
||||
@ -176,7 +177,7 @@ type
|
||||
Property ArraySuffix: String Read FArraySuffix Write FArraySuffix;
|
||||
Property GetterPrefix: String read FGetterPrefix write FGetterPrefix;
|
||||
Property SetterPrefix: String read FSetterPrefix write FSetterPrefix;
|
||||
Property FuncTypePrefix: String read FFuncTypePrefix write FFuncTypePrefix;
|
||||
Property TypePrefix: String read FTypePrefix write FTypePrefix;
|
||||
Property WebIDLVersion: TWebIDLVersion Read FWebIDLVersion Write FWebIDLVersion;
|
||||
Property TypeAliases: TStrings Read FTypeAliases Write SetTypeAliases;
|
||||
Property IncludeInterfaceCode: TStrings Read FIncludeInterfaceCode Write SetIncludeInterfaceCode;
|
||||
@ -669,7 +670,7 @@ begin
|
||||
ArraySuffix:='DynArray';
|
||||
GetterPrefix:='Get';
|
||||
SetterPrefix:='Set';
|
||||
FuncTypePrefix:='T';
|
||||
TypePrefix:='T';
|
||||
FTypeAliases:=TStringList.Create;
|
||||
FPasNameList:=TFPObjectList.Create(True);
|
||||
FPasDataClass:=TPasData;
|
||||
@ -1400,6 +1401,7 @@ Var
|
||||
aData: TPasData;
|
||||
|
||||
begin
|
||||
writeln('BBB1 TBaseWebIDLToPas.AllocatePasName ',ParentName,'.',D.Name,':',D.ClassName);
|
||||
CN:=D.Name;
|
||||
if D Is TIDLInterfaceDefinition then
|
||||
begin
|
||||
@ -1422,9 +1424,10 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (D Is TIDLFunctionDefinition) and (foCallBack in TIDLFunctionDefinition(D).Options) then
|
||||
if (D is TIDLTypeDefDefinition)
|
||||
or ((D Is TIDLFunctionDefinition) and (foCallBack in TIDLFunctionDefinition(D).Options)) then
|
||||
begin
|
||||
CN:=FuncTypePrefix+CN;
|
||||
CN:=TypePrefix+CN;
|
||||
AddJSIdentifier(D);
|
||||
end;
|
||||
Result:=CreatePasName(CN,D);
|
||||
@ -1445,6 +1448,7 @@ procedure TBaseWebIDLToPas.AddJSIdentifier(D: TIDLDefinition);
|
||||
var
|
||||
Old: TIDLDefinition;
|
||||
begin
|
||||
//writeln('TBaseWebIDLToPas.AddJSIdentifier ',D.Name,':',D.ClassName);
|
||||
if (D.Parent=nil)
|
||||
or ((D is TIDLInterfaceDefinition) and TIDLInterfaceDefinition(D).IsMixin) then
|
||||
begin
|
||||
|
@ -622,7 +622,11 @@ begin
|
||||
if CurDef is TIDLInterfaceDefinition then
|
||||
GetFunc:='GetObject('+IntfToPasClassName(ArgTypeName)+') as '+ArgTypeName
|
||||
else
|
||||
begin
|
||||
if CurDef<>nil then
|
||||
writeln('TWebIDLToPasWasmJob.WriteFunctionTypeDefinition CurDef=',CurDef.ClassName);
|
||||
raise EWebIDLParser.Create('not yet supported: function type arg['+IntToStr(I)+'] type '+ArgDef.ArgumentType.TypeName+' at '+GetDefPos(ArgDef));
|
||||
end;
|
||||
end;
|
||||
|
||||
// declare: var ArgName: ArgTypeName;
|
||||
@ -663,7 +667,11 @@ begin
|
||||
if ReturnDef is TIDLInterfaceDefinition then
|
||||
GetFunc:='Result:=H.AllocIntf('+Call+');'
|
||||
else
|
||||
raise EWebIDLParser.Create('not yet supported: function type result type "'+RT+'" at '+GetDefPos(ArgDef));
|
||||
begin
|
||||
if ReturnDef<>nil then
|
||||
writeln('TWebIDLToPasWasmJob.WriteFunctionTypeDefinition ReturnDef=',ReturnDef.ClassName);
|
||||
raise EWebIDLParser.Create('not yet supported: function type result type "'+RT+'" at '+GetDefPos(aDef));
|
||||
end;
|
||||
end;
|
||||
Code:=Code+' '+GetFunc+sLineBreak;
|
||||
Code:=Code+'end;'+sLineBreak;
|
||||
|
Loading…
Reference in New Issue
Block a user