|
@@ -51,6 +51,7 @@ type
|
|
|
procedure TestWJ_Typedef_Sequence;
|
|
|
procedure TestWJ_Typedef_Aliased;
|
|
|
procedure TestWJ_Typedef_Dictionary;
|
|
|
+ procedure TestWJ_Typedef_DictionaryWithParent;
|
|
|
|
|
|
// attributes
|
|
|
procedure TestWJ_IntfAttribute_Boolean;
|
|
@@ -552,6 +553,120 @@ begin
|
|
|
'']);
|
|
|
end;
|
|
|
|
|
|
+procedure TTestWebIDL2WasmJob.TestWJ_Typedef_DictionaryWithParent;
|
|
|
+begin
|
|
|
+ TestWebIDL([
|
|
|
+ 'dictionary Attr {',
|
|
|
+ ' boolean aBoolean;',
|
|
|
+ '};',
|
|
|
+ 'dictionary Attr2 : Attr {',
|
|
|
+ ' long aLong;',
|
|
|
+ '};',
|
|
|
+ ''],
|
|
|
+ ['Type',
|
|
|
+ ' // Forward class definitions',
|
|
|
+ ' IJSAttr = interface;',
|
|
|
+ ' TJSAttr = class;',
|
|
|
+ ' IJSAttr2 = interface;',
|
|
|
+ ' TJSAttr2 = class;',
|
|
|
+ ' { --------------------------------------------------------------------',
|
|
|
+ ' TJSAttr',
|
|
|
+ ' --------------------------------------------------------------------}',
|
|
|
+ '',
|
|
|
+ ' TJSAttrRec = record',
|
|
|
+ ' aBoolean: Boolean;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ ' IJSAttr = interface(IJSObject)',
|
|
|
+ ' ['''+FixedGUID+''']',
|
|
|
+ ' function _GetaBoolean: Boolean;',
|
|
|
+ ' procedure _SetaBoolean(const aValue: Boolean);',
|
|
|
+ ' property aBoolean: Boolean read _GetaBoolean write _SetaBoolean;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ ' TJSAttr = class(TJSObject,IJSAttr)',
|
|
|
+ ' Private',
|
|
|
+ ' function _GetaBoolean: Boolean;',
|
|
|
+ ' procedure _SetaBoolean(const aValue: Boolean);',
|
|
|
+ ' Public',
|
|
|
+ ' class function JSClassName: UnicodeString; override;',
|
|
|
+ ' class function Cast(const Intf: IJSObject): IJSAttr;',
|
|
|
+ ' property aBoolean: Boolean read _GetaBoolean write _SetaBoolean;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ ' { --------------------------------------------------------------------',
|
|
|
+ ' TJSAttr2',
|
|
|
+ ' --------------------------------------------------------------------}',
|
|
|
+ '',
|
|
|
+ ' TJSAttr2Rec = record',
|
|
|
+ ' aLong: LongInt;',
|
|
|
+ ' aBoolean: Boolean;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ ' IJSAttr2 = interface(IJSAttr)',
|
|
|
+ ' ['''+FixedGUID+''']',
|
|
|
+ ' function _GetaLong: LongInt;',
|
|
|
+ ' procedure _SetaLong(const aValue: LongInt);',
|
|
|
+ ' property aLong: LongInt read _GetaLong write _SetaLong;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ ' TJSAttr2 = class(TJSAttr,IJSAttr2)',
|
|
|
+ ' Private',
|
|
|
+ ' function _GetaLong: LongInt;',
|
|
|
+ ' procedure _SetaLong(const aValue: LongInt);',
|
|
|
+ ' Public',
|
|
|
+ ' class function JSClassName: UnicodeString; override;',
|
|
|
+ ' class function Cast(const Intf: IJSObject): IJSAttr2;',
|
|
|
+ ' property aLong: LongInt read _GetaLong write _SetaLong;',
|
|
|
+ ' end;',
|
|
|
+ '',
|
|
|
+ 'implementation',
|
|
|
+ '',
|
|
|
+ 'function TJSAttr._GetaBoolean: Boolean;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=ReadJSPropertyBoolean(''aBoolean'');',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'procedure TJSAttr._SetaBoolean(const aValue: Boolean);',
|
|
|
+ 'begin',
|
|
|
+ ' WriteJSPropertyBoolean(''aBoolean'',aValue);',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'class function TJSAttr.JSClassName: UnicodeString;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=''Object'';',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'class function TJSAttr.Cast(const Intf: IJSObject): IJSAttr;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=TJSAttr.JOBCast(Intf);',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'function TJSAttr2._GetaLong: LongInt;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=ReadJSPropertyLongInt(''aLong'');',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'procedure TJSAttr2._SetaLong(const aValue: LongInt);',
|
|
|
+ 'begin',
|
|
|
+ ' WriteJSPropertyLongInt(''aLong'',aValue);',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'class function TJSAttr2.JSClassName: UnicodeString;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=''Object'';',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'class function TJSAttr2.Cast(const Intf: IJSObject): IJSAttr2;',
|
|
|
+ 'begin',
|
|
|
+ ' Result:=TJSAttr2.JOBCast(Intf);',
|
|
|
+ 'end;',
|
|
|
+ '',
|
|
|
+ 'end.',
|
|
|
+ '']);
|
|
|
+
|
|
|
+end;
|
|
|
+
|
|
|
procedure TTestWebIDL2WasmJob.TestWJ_IntfAttribute_Boolean;
|
|
|
begin
|
|
|
TestWebIDL([
|