[Laszlo-dev] For Review: Change 20071211-dda-Y Summary: lztest-node fixes for SWF9

Donald Anderson dda at ddanderson.com
Tue Dec 11 08:29:59 PST 2007


Change 20071211-dda-Y by dda at freddie.local on 2007-12-11 10:58:29 EST
     in /Users/dda/laszlo/src/svn/openlaszlo/branches/devildog
     for http://svn.openlaszlo.org/openlaszlo/branches/devildog

Summary: lztest-node fixes for SWF9

New Features: none

Bugs Fixed: LPP-5234

Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation: none

Release Notes: none

Details:
     This change addresses several issues related to building lztest- 
node in SWF9.

   + lztestmanager was written using 'old style' class definition.
     We could have found a way to make this work, but it seemed much  
better to
     take advantage of the new capabilities of defining classes via  
'class' keywords, etc.

   + Many methods reference global variables.  These variables either  
appear
     as part of the default application class, or become true  
'globals'.  In the
     former case, we need to potentially emit 'with (this)' or 'with  
(lzDefaultAppliation)',
     apparently depending on whether the method is within the default  
application or not.
     In the latter case, the users of the global variable are fine,  
but the variable needs
     to be emitted in its own source file.  This seems to be the only  
way to create a standalone
     global variable in SWF9.
        package {
         public var global = null;
        }

   + Normally the JavascriptGenerator remaps local variables to names  
like $1, $2, etc.
     This was even happening for 'class variables' in explicitly  
declared classes:
       class foo {
          var x = 1;
          function bar() {
             x++;
          }
       }
     x would be renamed to $1, and the references to it (from bar)  
were not remapped.
     Even if we could remap all, this would not be appropriate if x  
were public
     (really only private should be remapped for this case).  In  
SWF9, we simply
     disable this remapping for now.  Undoubtedly, we'll need this  
conditionally
     (I left in a TODO) but it's easiest to make progress by  
deferring this.

   + Fixed some small problems related to string manipulation of  
generated code.
     For SWF9, generated code contains 'annotations', that is line  
and classname information
     embedded in the generated Strings.  These annotations are  
stripped out when writing
     the text to a file, but is also used to build line number tables  
and direct output
     to the proper filename.  When making simple manipulations, like  
'remove a semicolon
     from the last character of a string', care must be taken to not  
remove any part of
     the annotation.  Fortunately, very little string manipulation  
occurs after code
     is generated.

Tests:

Files:
M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ 
SWF9ParseTreePrinter.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
M      lps/components/lztest/lztestmanager.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071211-dda- 
Y.tar



--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

Voice:  617-547-7881
Email:  dda at ddanderson.com
WWW:    http://www.ddanderson.com



More information about the Laszlo-dev mailing list