Fix for function Val to validate the parameter count of the function.

This commit is contained in:
Henrique Gottardi Werlang 2023-12-01 16:24:06 -03:00 committed by Michael Van Canneyt
parent 34ae77bd3b
commit 8a8699ab6a

View File

@ -5882,6 +5882,9 @@ var
C: TClass; C: TClass;
begin begin
Result:=inherited; Result:=inherited;
if CheckBuiltInMinParamCount(Proc, Expr, 3, RaiseOnError) then
begin
Params:=TParamsExpr(Expr); Params:=TParamsExpr(Expr);
Param:=Params.Params[1]; Param:=Params.Params[1];
ComputeElement(Param,ParamResolved,[]); ComputeElement(Param,ParamResolved,[]);
@ -5895,6 +5898,8 @@ begin
if (C=TPasEnumType) or (C=TPasRangeType) then if (C=TPasEnumType) or (C=TPasRangeType) then
Result:=cExact Result:=cExact
end; end;
end;
if Result=cIncompatible then if Result=cIncompatible then
exit(CheckRaiseTypeArgNo(20181214142349,2,Param,ParamResolved, exit(CheckRaiseTypeArgNo(20181214142349,2,Param,ParamResolved,
'enum variable',RaiseOnError)); 'enum variable',RaiseOnError));