mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 18:49:27 +02:00
* Merging revisions 45223 from trunk:
------------------------------------------------------------------------ r45223 | michael | 2020-05-02 17:56:30 +0200 (Sat, 02 May 2020) | 1 line * Explicitly raise EDivError (bug ID 36839) ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_2@45224 -
This commit is contained in:
parent
10a00c023b
commit
76effcf10d
@ -896,6 +896,7 @@ Resourcestring
|
|||||||
SErrCaseLabelNotAConst = 'Case label %d "%s" is not a constant expression';
|
SErrCaseLabelNotAConst = 'Case label %d "%s" is not a constant expression';
|
||||||
SErrCaseLabelType = 'Case label %d "%s" needs type %s, but has type %s';
|
SErrCaseLabelType = 'Case label %d "%s" needs type %s, but has type %s';
|
||||||
SErrCaseValueType = 'Case value %d "%s" needs type %s, but has type %s';
|
SErrCaseValueType = 'Case value %d "%s" needs type %s, but has type %s';
|
||||||
|
SErrDivisionByZero = '%d division by zero';
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Auxiliary functions
|
Auxiliary functions
|
||||||
@ -3564,13 +3565,27 @@ begin
|
|||||||
Left.GetNodeValue(Result);
|
Left.GetNodeValue(Result);
|
||||||
Right.GetNodeValue(RRes);
|
Right.GetNodeValue(RRes);
|
||||||
case Result.ResultType of
|
case Result.ResultType of
|
||||||
rtInteger : Result.ResFloat:=Result.ResInteger/RRes.ResInteger;
|
rtInteger :
|
||||||
rtFloat : Result.ResFloat:=Result.ResFloat/RRes.ResFloat;
|
if RRes.ResInteger<>0 then
|
||||||
|
Result.ResFloat:=Result.ResInteger/RRes.ResInteger
|
||||||
|
else
|
||||||
|
RaiseParserError(SErrDivisionByZero, [ResultTypeName(rtInteger)]);
|
||||||
|
rtFloat :
|
||||||
|
if RRes.ResFloat<>0 then
|
||||||
|
Result.ResFloat:=Result.ResFloat/RRes.ResFloat
|
||||||
|
else
|
||||||
|
RaiseParserError(SErrDivisionByZero, [ResultTypeName(rtInteger)]);
|
||||||
rtCurrency :
|
rtCurrency :
|
||||||
if NodeType=rtCurrency then
|
if NodeType=rtCurrency then
|
||||||
Result.ResCurrency:=Result.ResCurrency/RRes.ResCurrency
|
if RRes.ResCurrency <> 0 then
|
||||||
|
Result.ResCurrency:=Result.ResCurrency/RRes.ResCurrency
|
||||||
|
else
|
||||||
|
RaiseParserError(SErrDivisionByZero, [ResultTypeName(rtCurrency)])
|
||||||
else
|
else
|
||||||
Result.ResFloat:=Result.ResFloat/RRes.ResFloat;
|
if RRes.ResFloat<> 0 then
|
||||||
|
Result.ResFloat:=Result.ResFloat/RRes.ResFloat
|
||||||
|
else
|
||||||
|
RaiseParserError(SErrDivisionByZero, [ResultTypeName(rtFloat)]);
|
||||||
end;
|
end;
|
||||||
Result.ResultType:=NodeType;
|
Result.ResultType:=NodeType;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user