fpspreadsheet: Fix formula parser ignoring errors in binary nodes (see https://forum.lazarus.freepascal.org/index.php/topic,44426.0.html)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6819 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-02-26 09:03:12 +00:00
parent 748fea48a1
commit 8e86543dde

View File

@ -3531,9 +3531,10 @@ var
LRes, RRes: TsExpressionResult; LRes, RRes: TsExpressionResult;
fL, fR: TsExprFloat; fL, fR: TsExprFloat;
begin begin
{
if HasError(AResult) then if HasError(AResult) then
exit; exit;
}
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
@ -3567,9 +3568,10 @@ var
lRes, RRes: TsExpressionResult; lRes, RRes: TsExpressionResult;
fL, fR: TsExprFloat; fL, fR: TsExprFloat;
begin begin
{
if HasError(AResult) then if HasError(AResult) then
exit; exit;
}
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
@ -3603,9 +3605,10 @@ var
LRes, RRes: TsExpressionResult; LRes, RRes: TsExpressionResult;
fL, fR: TsExprFloat; fL, fR: TsExprFloat;
begin begin
{
if HasError(AResult) then if HasError(AResult) then
exit; exit;
}
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
fL := ArgToFloat(LRes); fL := ArgToFloat(LRes);
@ -3642,9 +3645,10 @@ var
LRes, RRes: TsExpressionResult; LRes, RRes: TsExpressionResult;
fL, fR: TsExprFloat; fL, fR: TsExprFloat;
begin begin
{
if HasError(AResult) then if HasError(AResult) then
exit; exit;
}
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
@ -3690,9 +3694,10 @@ var
LRes, RRes: TsExpressionResult; LRes, RRes: TsExpressionResult;
fL, fR: TsExprFloat; fL, fR: TsExprFloat;
begin begin
{
if HasError(AResult) then if HasError(AResult) then
exit; exit;
}
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
fL := ArgToFloat(LRes); fL := ArgToFloat(LRes);
@ -4469,6 +4474,7 @@ begin
rtBoolean : if Arg.ResBoolean then Result := 1.0; rtBoolean : if Arg.ResBoolean then Result := 1.0;
rtString, rtString,
rtHyperlink : TryStrToFloat(ArgToString(Arg), Result); rtHyperlink : TryStrToFloat(ArgToString(Arg), Result);
rtError : Result := NaN;
rtCell : begin rtCell : begin
cell := ArgToCell(Arg); cell := ArgToCell(Arg);
if Assigned(cell) then if Assigned(cell) then
@ -4486,8 +4492,10 @@ begin
if not TryStrToFloat(s, Result, fs) then if not TryStrToFloat(s, Result, fs) then
Result := NaN; Result := NaN;
end; end;
cctError:
Result := NaN;
end; end;
end; end;
end; end;
end; end;