[Laszlo-dev] For Review: Change 20080722-dda-J Summary: linenumber fixes for nexb [RESEND]

Donald Anderson dda at ddanderson.com
Wed Jul 23 09:35:34 PDT 2008


Tucker - did you get a chance to review this change?
Thanks.

Change 20080722-dda-J by dda at lester.local on 2008-07-22 17:57:08 EDT
     in /Users/dda/laszlo/src/svn/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: linenumber fixes for nexb

New Features:

Bugs Fixed: LPP-6706 (Script Compiler: missing line number information)

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

Documentation:

Release Notes:

Details:
     There are two basic troubles fixed with this change set and some  
smaller issues:

   - First - internally generated ASTs (e.g. via
     Compiler.substitute() or JavascriptGenerator.VariableReference)  
are missing any
     line number information.  This is fixed by using related nodes or  
even nearby
     nodes to prime any newly created nodes with appropriate line  
info.   This has
     been done for many, but probably not all, cases of  hand crafted  
nodes.  It
     is uncertain how many of these cases are necessary to show  
accurate line number
     information.

     A significant upshot of this change is that line information that  
used to be
     marked as coming from the line: [Compiler.substitute] will now  
appear to come
     from the original input file.  This is probably better for user  
error reporting,
     and only slightly worse for development.

   - Second - sometimes function closures are emitted as part of  
bigger expressions:
      Class.make(..., ["dbg_filename", void 0, ....., function  
name(args){
          // content of function
      }], ["tagname", ....
     The end of the function occurs in the middle of a line, so no  
line information
     is shown when a transition is made from the function to the next  
property
     (line information changes are not generally shown within lines).   
This confuses
     any debugging systems that need to relate generated lines to  
source lines
     found in <handler> tags.  To solve this, we force a newline and a  
line locator
     to be emitted at the end of the function.

   - Improved SimpleNode.dump() so that line information is shown.

   - Added a static ParseTreePrinter.unparse() for convenience in  
debugging.

   - Fixed an error in Compiler.PassThroughNode.copyFields()

   - Added a utility method (SimpleNode.setLocation) and documented  
some other utility methods.


Tests:
    Regression: smokecheck swf8/dhtml, weather swf8/9/dhtml, lzpix  
swf8/9/dhtml

    Compiled test case from LPP-6706 using:
    $ lzc --debug --script -DdumpASTInput=astin.txt - 
DdumpASTOutput=astout.txt --runtime=dhtml nexb619.lzx
    and observed the correct (but slightly verbose):

       Class.make("$lzc$class_button_$nexb619$2Elzx_2_29", $lzc 
$class_button, ["_dbg_filename", void 0, "_dbg_lineno", void 0, "$lzc 
$handle_onclick$$nexb619$2Elzx_3_29_$m256", function $lzc 
$handle_onclick$$nexb619$2Elzx_3_29_$m256 ($1_$lzc$ignore) {
       /* -*- file: -*- */
       /* -*- file: nexb619.lzx#4.5 -*- */
       var $2_a = 14;
       $2_a = 114;
       var $3_c = 100
       }
       /* -*- file:  -*- */
       ], ["tagname", "button_$nexb619$2Elzx_2_29", "children",  
LzNode.mergeChildren([], $lzc$class_button["children"]), "attributes",  
new LzInheritedHash($lzc$class_button.attributes)]);


Files:
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
M      WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/ 
SimpleNode.java

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080722-dda-J.tar



--

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

voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080728/3c32b426/attachment-0001.html


More information about the Laszlo-dev mailing list