FpDebug: Conditionals (?IF or Try/N) must flag variant returns in slices

This commit is contained in:
Martin 2024-07-24 12:59:32 +02:00
parent 0c424bf0be
commit c4deaeadcf

View File

@ -519,6 +519,8 @@ type
): TFpPascalExpressionPart; override;
function IsValidAfterPartWithPrecedence(APrevPart: TFpPascalExpressionPart): Boolean; override;
procedure DoHandleEndOfExpression; override;
public
function ReturnsVariant: boolean; override;
end;
{ TFpPascalExpressionPartOperatorColon }
@ -3433,7 +3435,8 @@ end;
function TFpPascalExpressionPartIntrinsic.ReturnsVariant: boolean;
begin
Result := (inherited ReturnsVariant) or
(FIntrinsic = ifChildClass);
(FIntrinsic in [ifChildClass, ifTry, ifTryN]);
// TODO: compare types of each argument for ifTry/N
end;
procedure TFpPascalExpressionPartIntrinsic.HandleNewParam(AParamPart: TFpPascalExpressionPart;
@ -5117,6 +5120,11 @@ begin
SetError('Missing ":"');
end;
function TFpPascalExpressionPartOperatorQuestionMark.ReturnsVariant: boolean;
begin
Result := True; // TODO: compare types of each argument
end;
{ TFpPascalExpressionPartOperatorColon }
procedure TFpPascalExpressionPartOperatorColon.Init;