mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 20:49:09 +02:00
Fix for function Val to validate the parameter count of the function.
This commit is contained in:
parent
34ae77bd3b
commit
8a8699ab6a
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user