Icon View Incident Report

Serious Serious
Reported By: Michael Dreher
Reported On: 8/13/2015
For: Version 2.00 Build 2
# 4211 Using Enumeration Members without Using the Enumeration Type Can Cause Incorrect Emitted JavaScript

When I use enumeration names as an expression in the case statement, the application starts blank.

The code compiles without errors. Because the case statement (a) is in there, the browser application
starts (IDE or direct in a browser with an external server) with a blank page, meaning the TLable and the TButton are not visible.

If I comment out (a), the applicartion starts normal, and (b) is an alternative (working) case statement. Of course I want to use symbolic names instead of integer literals.

type
 TTestInstructionDataType = (
   TIDT_INT,
   TIDT_FLOAT,
   TIDT_BOOL
 );
  TForm1 = class(TForm)
     Label1: TLabel;
     Button1: TButton;
     procedure Button1Click(Sender: TObject);
  private
  public
  end;
var
  Form1: TForm1;
implementation

procedure TForm1.Button1Click(Sender: TObject);      
var i : integer;
begin           
 i := 1;

//(a)
 case i of
   TIDT_INT : Label1.Caption := '1' ;
   TIDT_FLOAT : Label1.Caption := '2' ;
   TIDT_BOOL : Label1.Caption := '3' ;
 end;  

//(b)
 case i of
   0 : Label1.Caption := '1' ;
   1 : Label1.Caption := '2' ;
   2 : Label1.Caption := '3' ;
 end;
end;

end.



Comments Comments and Workarounds
The core issue was: if one doesn't declare a variable of type TTestInstructionDataType, then the compiler treated the enumerated type as "not being referenced", and didn't generate emitted identifiers for the enumerated type's members.

The workaround was to make sure to declare the I variable as being of type TTestInstructionDataType instead of Integer.


Resolution Resolution
Fixed Problem on 8/15/2015 in version 2.01 build 1


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image