View Issue Details

IDProjectCategoryView StatusLast Update
0035860pas2jstranspilerpublic2019-07-19 22:13
ReporterSimon AmeisAssigned ToMattias Gaertner 
Status assignedResolutionopen 
PlatformDesktop PCOSWindows 7, 64 bitOS Version6.1 SP 1
Product VersionProduct Buildtrunk 
Target VersionFixed in Version 
Summary0035860: [Optimization] Unreachable code with exit(result); expression
DescriptionThe following code produces javascript code which is not optimal:

function TLoginPage.btnLogin_Click(Event: TJSMouseEvent): Boolean;
  if myvar = '' then
  // do something else

results in

 this.btnLogin_Click = function (Event) {
      var Result = false;
      if (myvar === "") {
        return false;
     // do something else
      return true;
      return Result;

the variable Result is never used by user code and thus could be removed.
Also the return true; leads to unreachable code: return Result;
Additional InformationThis could lead to performance issues if the function is called very often. Otherwise this is only a minor optimization.
TagsNo tags attached.
Fixed in Revision
Attached Files


Mattias Gaertner

2019-07-19 22:13

developer   ~0117324

I added it to the list
omit implicit "return Result" if last statement is return. issue 35860

Issue History

Date Modified Username Field Change
2019-07-18 18:45 Simon Ameis New Issue
2019-07-19 22:12 Mattias Gaertner Assigned To => Mattias Gaertner
2019-07-19 22:12 Mattias Gaertner Status new => assigned
2019-07-19 22:13 Mattias Gaertner Note Added: 0117324