[Laszlo-dev] For Review: Change 20071128-ptw-S Summary: Don't try to be so cute about using implicit semicolons in

P T Withington ptw at pobox.com
Wed Nov 28 10:49:59 PST 2007


Change 20071128-ptw-S by ptw at dueling-banjos.local on 2007-11-28  
13:17:43 EST
     in /Users/ptw/OpenLaszlo/ringding-2
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Don't try to be so cute about using implicit semicolons in
     Javascript compiler

Bugs Fixed:
LPP-5130 'resources in DHTML fail with "is not a function'" error'

Technical Reviewer: dda at ddanderson.com (pending)
QA Reviewer: enw (pending)

Details:
     We used to try to be clever and use newlines in place of
     semicolons in our 'compressed' code so that the code was a little
     more human-readable (and debuggable, using the native browser
     debugger).  But this cuteness was just broken and caused some
     expressions to not be interpreted as statements (and often to be
     interpreted as function calls).  Without a huge amount of work, it
     is difficult to correctly compute where an implicit semicolon can
     be used.

     Instead, we now always end a statement with a semicolon and only
     elide them before the close brace of a block (which is easily
     computable).  And, we output blocks a little more compactly,
     actually improving the 'compression' of our Javascript output.

     The primary change is to remove the old heuristic that inserted
     semicolons in between statements in a statement list, and to
     explicitly append one to each statement.  Put all the block
     building in one method instead of inlining it all over the place.

Tests:
     smokecheck, test case in bug, lzmail in DHTML now gets past the
     reported error

Files:
M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java


Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071128-ptw-S.tar


More information about the Laszlo-dev mailing list