mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:49:26 +02:00
* Use interfaces everywhere
This commit is contained in:
parent
478a227aa4
commit
a4c03016fc
@ -78,6 +78,7 @@ Type
|
||||
Constructor Create(APasName: String; D: TIDLBaseObject);
|
||||
Destructor Destroy; override;
|
||||
Property PasName: String read FPasName write FPasName;
|
||||
function ToString : RTLString; override;
|
||||
end;
|
||||
TPasDataClass = class of TPasData;
|
||||
|
||||
@ -379,6 +380,17 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TPasData.ToString: RTLString;
|
||||
|
||||
var
|
||||
S : String;
|
||||
|
||||
begin
|
||||
Result:=inherited ToString;
|
||||
WriteStr(S,NativeType);
|
||||
Result:=Result+Format(': NativeType: %s, Name: %s, location: [%s: %d:%d], used: %b',[S,PasName,SrcFile,Line,Column,Used]);
|
||||
end;
|
||||
|
||||
{ TBaseWebIDLToPas }
|
||||
|
||||
function TBaseWebIDLToPas.CreateContext: TWebIDLContext;
|
||||
@ -2284,6 +2296,7 @@ begin
|
||||
Result:=PasDataClass.Create(Data.PasName,OwnerDef);
|
||||
Result.Resolved:=Data.Resolved;
|
||||
Result.NativeType:=Data.NativeType;
|
||||
Result.Used:=Data.Used;
|
||||
FPasNameList.Add(Result);
|
||||
end;
|
||||
|
||||
|
@ -28,6 +28,14 @@ uses
|
||||
Classes, SysUtils, webidldefs, webidltopas, webidlscanner, webidlparser, Contnrs;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
{
|
||||
Todo:
|
||||
- Allocate Aliased types (TIDLUserTypeDefinition) and simple types (TIDLSimpleTypeDefinition) as TIDLTypeDefinition descendants.
|
||||
(so no more special cases are needed)
|
||||
- Allocate Interface names so no more pasintfname etc. is needed
|
||||
}
|
||||
|
||||
|
||||
type
|
||||
TJOB_JSValueKind = (
|
||||
jjvkUndefined,
|
||||
@ -417,7 +425,9 @@ function TWebIDLToPasWasmJob.GetResolvedType(aDef: TIDLTypeDefDefinition; out Pa
|
||||
begin
|
||||
Result:=inherited GetResolvedType(aDef, PascalNativeType, aTypeName, aResolvedTypename);
|
||||
if Result is TIDLInterfaceDefinition then
|
||||
aTypeName:=GetPasClassName(aTypeName)
|
||||
aTypeName:=GetPasIntfName(Result)
|
||||
else if Result is TIDLDictionaryDefinition then
|
||||
aTypeName:=GetPasIntfName(Result)
|
||||
else if Result is TIDLPromiseTypeDefDefinition then
|
||||
aTypeName:=PasInterfacePrefix+'Promise'+PasInterfaceSuffix;
|
||||
end;
|
||||
@ -1227,6 +1237,8 @@ begin
|
||||
if FGeneratingInterface and (([foConstructor, foStatic] * aDef.Options)<>[]) then
|
||||
exit;
|
||||
Suff:='';
|
||||
if (ADef.Name='createImageBitmap') then
|
||||
Writeln('Name');
|
||||
GetMethodInfo(aParent,aDef,MethodInfo);
|
||||
Overloads:=GetOverloads(ADef);
|
||||
try
|
||||
@ -1611,6 +1623,8 @@ begin
|
||||
aAccessInfo.PropType:=aType;
|
||||
if aType is TIDLInterfaceDefinition then
|
||||
aAccessInfo.NativeTypeName:=GetPasIntfName(aType)
|
||||
else if aType is TIDLDictionaryDefinition then
|
||||
aAccessInfo.NativeTypeName:=GetPasIntfName(aType)
|
||||
else if aType is TIDLFunctionDefinition then
|
||||
// exit // not supported yet
|
||||
else if aType is TIDLEnumDefinition then
|
||||
@ -1691,6 +1705,8 @@ begin
|
||||
aAccessInfo.PropType:=aType;
|
||||
if aType is TIDLInterfaceDefinition then
|
||||
aAccessInfo.NativeTypeName:=GetPasIntfName(aType)
|
||||
else if aType is TIDLDictionaryDefinition then
|
||||
aAccessInfo.NativeTypeName:=GetPasIntfName(aType)
|
||||
else if aType is TIDLFunctionDefinition then
|
||||
// exit // not supported yet
|
||||
else if aType is TIDLEnumDefinition then
|
||||
@ -1819,6 +1835,8 @@ begin
|
||||
PropName:=GetPasName(aProp);
|
||||
aType:=GetResolvedType(aProp.PropertyType,ANT,aTypeName,aResolvedTypeName);
|
||||
if aType is TIDLInterfaceDefinition then
|
||||
aTypeName:=GetPasIntfName(aType)
|
||||
else if aType is TIDLDictionaryDefinition then
|
||||
aTypeName:=GetPasIntfName(aType);
|
||||
GetAccessorNames(aProp,GetterName,SetterName);
|
||||
Code:='property '+PropName+': '+aTypeName+' read '+GetterName;
|
||||
|
Loading…
Reference in New Issue
Block a user