Reported By: ooptimum Reported On: 10/16/2018 For: Version 2.06 Build 18
# 4689Using Non-Idempotent Function Calls in Case Statements Can Cause Incorrect Results Wrong JS code generation of case statement if case expression is a function call.
The compiler generates:
if (random(0, 2) == 0)
s = "zero";
else if (random(0, 2) == 1)
s = "one";
else if (random(0, 2) == 2)
s = "two";
while it should be:
var temp$ = random(0, 2);
if (temp$ == 0)
s = "zero";
else if (temp$ == 1)
s = "one";
else if (temp$ == 2)
s = "two";
for the code below.
var
s: string;
begin
case Random(0, 2) of
0: s := 'zero';
1: s := 'one';
2: s := 'two';
end;
// 's' could be empty here
ResolutionFixed Problem on 10/28/2018 in version 2.06 build 19
Products AffectedElevate Web Builder Elevate Web Builder Trial