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,19 +5882,24 @@ var
C: TClass; C: TClass;
begin begin
Result:=inherited; Result:=inherited;
Params:=TParamsExpr(Expr);
Param:=Params.Params[1]; if CheckBuiltInMinParamCount(Proc, Expr, 3, RaiseOnError) then
ComputeElement(Param,ParamResolved,[]); begin
Result:=cIncompatible; Params:=TParamsExpr(Expr);
bt:=ParamResolved.BaseType; Param:=Params.Params[1];
if bt=btRange then ComputeElement(Param,ParamResolved,[]);
bt:=ParamResolved.SubType; Result:=cIncompatible;
if bt=btContext then bt:=ParamResolved.BaseType;
begin if bt=btRange then
C:=ParamResolved.LoTypeEl.ClassType; bt:=ParamResolved.SubType;
if (C=TPasEnumType) or (C=TPasRangeType) then if bt=btContext then
Result:=cExact begin
end; C:=ParamResolved.LoTypeEl.ClassType;
if (C=TPasEnumType) or (C=TPasRangeType) then
Result:=cExact
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));