1
0
mirror of synced 2024-11-23 22:13:49 +00:00

Empty check only simple types

This commit is contained in:
Mark van Renswoude 2017-07-21 09:47:14 +02:00
parent e8ef5ff1bc
commit 3c9f47f80e

View File

@ -1144,7 +1144,6 @@ var
writeStream: Boolean;
typeMapping: TTypeMapping;
nodeType: TDelphiNodeType;
elementType: TDelphiElementType;
begin
Result := False;
@ -1298,12 +1297,20 @@ begin
WriteNewLine;
if writeOptional then
if AProperty.IsAttribute then
sourceCode.Add(IfThen(HasChecksEmpty, PropertyImplMethodGetOptionalAttrEmpty, PropertyImplMethodGetOptionalAttr))
else
begin
elementType := GetDelphiElementType(nodeType);
sourceCode.Add(IfThen(HasChecksEmpty, PropertyImplMethodGetOptionalEmpty[elementType], PropertyImplMethodGetOptional[elementType]));
if HasChecksEmpty and (AProperty.PropertyType = ptSimple) and (not Assigned(AProperty.Collection)) then
begin
if AProperty.IsAttribute then
sourceCode.Add(PropertyImplMethodGetOptionalAttrEmpty)
else
sourceCode.Add(PropertyImplMethodGetOptionalEmpty[GetDelphiElementType(nodeType)]);
end else
begin
if AProperty.IsAttribute then
sourceCode.Add(PropertyImplMethodGetOptionalAttr)
else
sourceCode.Add(PropertyImplMethodGetOptional[GetDelphiElementType(nodeType)]);
end;
end;
if writeNil then