mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 09:59:17 +02:00
* Fix writing of union types
This commit is contained in:
parent
b0d61558e3
commit
4cdabbb4c6
@ -1225,7 +1225,7 @@ end;
|
|||||||
procedure TBaseWebIDLToPas.WriteUnionDef(aDef: TIDLUnionTypeDefDefinition);
|
procedure TBaseWebIDLToPas.WriteUnionDef(aDef: TIDLUnionTypeDefDefinition);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
S: UTF8String;
|
aLine,S: UTF8String;
|
||||||
D: TIDLDefinition;
|
D: TIDLDefinition;
|
||||||
begin
|
begin
|
||||||
S:='';
|
S:='';
|
||||||
@ -1236,7 +1236,10 @@ begin
|
|||||||
S:=S+(D as TIDLTypeDefDefinition).TypeName;
|
S:=S+(D as TIDLTypeDefDefinition).TypeName;
|
||||||
end;
|
end;
|
||||||
Comment('Union of '+S);
|
Comment('Union of '+S);
|
||||||
AddLn(GetName(aDef)+' = '+GetPascalTypeName('any')+';');
|
aLine:=GetName(aDef)+' = '+GetPascalTypeName('any')+';';
|
||||||
|
if aLine = 'Variant = Variant;' then
|
||||||
|
Writeln('Oh-oh');
|
||||||
|
AddLn(aLine);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1917,6 +1920,14 @@ begin
|
|||||||
Result:=CreatePasData(EscapeKeyWord(CN),D,true);
|
Result:=CreatePasData(EscapeKeyWord(CN),D,true);
|
||||||
D.Data:=Result;
|
D.Data:=Result;
|
||||||
AllocatePasNames((D as TIDLDictionaryDefinition).Members,D.Name);
|
AllocatePasNames((D as TIDLDictionaryDefinition).Members,D.Name);
|
||||||
|
end
|
||||||
|
else if D Is TIDLDictionaryMemberDefinition then
|
||||||
|
begin
|
||||||
|
CN:=StringReplace(CN,'-','_',[rfReplaceAll]);
|
||||||
|
Result:=CreatePasData(EscapeKeyWord(CN),D,true);
|
||||||
|
D.Data:=Result;
|
||||||
|
AllocatePasName((D as TIDLDictionaryMemberDefinition).MemberType,ParentName+'_'+D.Name);
|
||||||
|
|
||||||
end
|
end
|
||||||
else if D Is TIDLSequenceTypeDefDefinition then
|
else if D Is TIDLSequenceTypeDefDefinition then
|
||||||
begin
|
begin
|
||||||
@ -1939,7 +1950,11 @@ begin
|
|||||||
end
|
end
|
||||||
else if D Is TIDLUnionTypeDefDefinition then
|
else if D Is TIDLUnionTypeDefDefinition then
|
||||||
begin
|
begin
|
||||||
CN:=GetTypeName(TIDLUnionTypeDefDefinition(D));
|
// This happens when there is an inline type declaration in a function definition.
|
||||||
|
if CN='' then
|
||||||
|
CN:=TypePrefix+ParentName+'_Type'
|
||||||
|
else
|
||||||
|
CN:=TypePrefix+CN;
|
||||||
sDef:=FindGlobalDef(CN);
|
sDef:=FindGlobalDef(CN);
|
||||||
if (SDef=Nil) or (sDef.Data=Nil) then
|
if (SDef=Nil) or (sDef.Data=Nil) then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user