webidl: wasmjob: prefix callbacks with T

This commit is contained in:
mattias 2022-06-27 11:30:31 +02:00
parent b9dc428e20
commit fb5456da79

View File

@ -61,6 +61,7 @@ type
FContext: TWebIDLContext; FContext: TWebIDLContext;
FDictionaryClassParent: String; FDictionaryClassParent: String;
FFieldPrefix: String; FFieldPrefix: String;
FFuncTypePrefix: String;
FGetterPrefix: String; FGetterPrefix: String;
FIncludeImplementationCode: TStrings; FIncludeImplementationCode: TStrings;
FIncludeInterfaceCode: TStrings; FIncludeInterfaceCode: TStrings;
@ -161,6 +162,7 @@ type
Property ClassSuffix: String Read FClassSuffix Write FClassSuffix; Property ClassSuffix: String Read FClassSuffix Write FClassSuffix;
Property GetterPrefix: String read FGetterPrefix write FGetterPrefix; Property GetterPrefix: String read FGetterPrefix write FGetterPrefix;
Property SetterPrefix: String read FSetterPrefix write FSetterPrefix; Property SetterPrefix: String read FSetterPrefix write FSetterPrefix;
Property FuncTypePrefix: String read FFuncTypePrefix write FFuncTypePrefix;
Property WebIDLVersion: TWebIDLVersion Read FWebIDLVersion Write FWebIDLVersion; Property WebIDLVersion: TWebIDLVersion Read FWebIDLVersion Write FWebIDLVersion;
Property TypeAliases: TStrings Read FTypeAliases Write SetTypeAliases; Property TypeAliases: TStrings Read FTypeAliases Write SetTypeAliases;
Property IncludeInterfaceCode: TStrings Read FIncludeInterfaceCode Write SetIncludeInterfaceCode; Property IncludeInterfaceCode: TStrings Read FIncludeInterfaceCode Write SetIncludeInterfaceCode;
@ -649,6 +651,7 @@ begin
ClassSuffix:=''; ClassSuffix:='';
GetterPrefix:='Get'; GetterPrefix:='Get';
SetterPrefix:='Set'; SetterPrefix:='Set';
FuncTypePrefix:='T';
FTypeAliases:=TStringList.Create; FTypeAliases:=TStringList.Create;
FPasNameList:=TFPObjectList.Create(True); FPasNameList:=TFPObjectList.Create(True);
FPasDataClass:=TPasData; FPasDataClass:=TPasData;
@ -1355,16 +1358,17 @@ Var
aData: TPasData; aData: TPasData;
begin begin
writeln('AAA1 TBaseWebIDLToPas.AllocatePasName ',D.Name,':',D.ClassName);
CN:=D.Name;
if D Is TIDLInterfaceDefinition then if D Is TIDLInterfaceDefinition then
begin begin
CN:=ClassPrefix+D.Name+ClassSuffix; CN:=ClassPrefix+CN+ClassSuffix;
Result:=CreatePasName(CN,D); Result:=CreatePasName(CN,D);
D.Data:=Result; D.Data:=Result;
AllocatePasNames((D as TIDLInterfaceDefinition).Members,D.Name); AllocatePasNames((D as TIDLInterfaceDefinition).Members,D.Name);
end end
else if D Is TIDLDictionaryDefinition then else if D Is TIDLDictionaryDefinition then
begin begin
CN:=D.Name;
if coDictionaryAsClass in BaseOptions then if coDictionaryAsClass in BaseOptions then
CN:=ClassPrefix+CN+ClassSuffix; CN:=ClassPrefix+CN+ClassSuffix;
Result:=CreatePasName(EscapeKeyWord(CN),D); Result:=CreatePasName(EscapeKeyWord(CN),D);
@ -1373,7 +1377,9 @@ begin
end end
else else
begin begin
Result:=CreatePasName(D.Name,D); if (D Is TIDLFunctionDefinition) and (foCallBack in TIDLFunctionDefinition(D).Options) then
CN:=FuncTypePrefix+CN;;
Result:=CreatePasName(CN,D);
D.Data:=Result; D.Data:=Result;
if D Is TIDLFunctionDefinition then if D Is TIDLFunctionDefinition then
AllocatePasNames((D as TIDLFunctionDefinition).Arguments,D.Name); AllocatePasNames((D as TIDLFunctionDefinition).Arguments,D.Name);