[Laszlo-dev] For Review: Change 20090311-dda-g Summary: Fix catcherrors problems, including getting file/line numbers when errors are thrown
Donald Anderson
dda at ddanderson.com
Wed Mar 11 12:31:08 PDT 2009
Tucker, let me know if you cannot review. This changeset is against
trunk, but it's destined for 4.2.0.x.
Change 20090311-dda-g by dda at lester-2.local on 2009-03-11 14:44:05 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-h
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix catcherrors problems, including getting file/line numbers
when errors are thrown
New Features:
Bugs Fixed: LPP-7900 SWF9 catcherrors=true exposes problem in return
types
LPP-7895 Make try/catch error messages give accurate line
numbers
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
JavascriptGenerator.java:
As a result of the fix for LPP-7789, 'void' is set as a return
type, but when that happens,
catcherrors cannot emit a 'return' instruction. This fixes
LPP-7900.
Function.java:
The tag compiler was creating code like this:
function x(
#file x.lzx
#line 3
} {
#file x.lzx
#line 3
stuff();
#file
}
function y( // <--- This node has no file/line
#file x.lzx
#line 3
etc.
It's careful to set the the #file to nothing for its
boilerplate code, but that means that the
function node may not have any file/line information. The
function node is used to derive
file/line for the catcherrors error call, so it must be set.
At the risk of being a little wasteful, this inserts another
#file/#line pair just in front of
each function declaration.
At the risk of being a little wasteful, this inserts another
#file/#line pair just in front of
each function declaration.
Tests:
The usual smoke/weather/lzpix tests on swf8/swf9/dhmtl
Running test case to illustrate the originals problems:
<canvas debug="true">
<simplelayout spacing="10" axis="y" />
<class name="mywindow" width="300">
<button onclick="this.parent.parent.canvas_f()" >BaseClass
mywindow</button>
</class>
<method name="canvas_f">
Debug.info("1 zebra");
Debug.info("2");
t1.setText("Before exception");
Debug.info("3...?");
throwexcept(7,0);
Debug.info("4!!");
t2.setText("After exception");
</method>
<method name="returnnull">
return null;
</method>
<method name="throwexcept" args="w, x">
// divide by zero doesn't give an exception, but
// an array reference of a non array will.
//return w[x]/x;
return w + x + returnnull().foo;
</method>
<button name="b1" onclick="this.parent.canvas_f()" width="100"
height="30" y="10">Press me</button>
<text name="t1" bgcolor="#ccffcc" width="100" height="30" y="50"/>
<text name="t2" bgcolor="#ccffcc" width="100" height="30" y="100"/>
<mywindow bgcolor="#cc8c8c"/>
<script>
</script>
</canvas>
Now compiles, and when it hits the exception, we now get a proper
file/line:
ERROR @LPP-7270f.lzx#19: TypeError: Error #1009
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/Function.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090311-dda-g.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-306-2057
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/20090311/5e76b894/attachment.html
More information about the Laszlo-dev
mailing list