* Do not generate code for types that are used in a ignored definiton

This commit is contained in:
Michaël Van Canneyt 2024-04-11 11:51:48 +02:00
parent 2a9eccec65
commit 70b2f29b92
2 changed files with 43 additions and 0 deletions

View File

@ -2022,6 +2022,8 @@ var
FD: TIDLFunctionDefinition;
begin
if D=nil then exit;
if not ConvertDef(D) then
exit;
//writeln('TBaseWebIDLToPas.ResolveTypeDef START ',D.Name,':',D.ClassName,' at ',GetDefPos(D),' D=',hexstr(ptruint(D),sizeof(ptruint)*2));
if D Is TIDLInterfaceDefinition then
ResolveTypeDefs(TIDLInterfaceDefinition(D).Members)

View File

@ -61,6 +61,7 @@ type
procedure TestWJ_IntfFunction_SequenceResult;
procedure TestWJ_IntfFunction_GlobalSequenceResult;
procedure TestWJ_IntfFunction_ChromeOnly;
procedure TestWJ_IntfFunction_ChromeOnlyNewObject;
// Namespace attribute
procedure TestWJ_NamespaceAttribute_Boolean;
// maplike
@ -1306,6 +1307,46 @@ begin
]);
end;
procedure TTestWebIDL2WasmJob.TestWJ_IntfFunction_ChromeOnlyNewObject;
begin
TestWebIDL([
'interface Attr {',
' [ChromeOnly, NewObject] ',
' ConsoleInstance createInstance(optional ConsoleInstanceOptions options = {});',
'};'
],
[
'Type',
' // Forward class definitions',
' IJSAttr = interface;',
' TJSAttr = class;',
' { --------------------------------------------------------------------',
' TJSAttr',
' --------------------------------------------------------------------}',
'',
' IJSAttr = interface(IJSObject)',
' [''{AA94F48A-9540-32B7-B05B-E99EB8B2AF2A}'']',
' end;',
'',
' TJSAttr = class(TJSObject,IJSAttr)',
' Private',
' Public',
' class function Cast(const Intf: IJSObject): IJSAttr;',
' end;',
'',
'implementation',
'',
'class function TJSAttr.Cast(const Intf: IJSObject): IJSAttr;',
'begin',
' Result:=TJSAttr.JOBCast(Intf);',
'end;',
'',
'end.',
''
]);
end;
procedure TTestWebIDL2WasmJob.TestWJ_NamespaceAttribute_Boolean;
begin