Author: ptw
Date: 2008-03-18 13:06:32 -0700 (Tue, 18 Mar 2008)
New Revision: 8311
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzBacktrace.lzs
Log:
Change 20080318-ptw-i by [EMAIL PROTECTED] on 2008-03-18 15:55:21 EDT
in /Users/ptw/OpenLaszlo/ringding
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix behaviour of attributes with setter _and_ intial value
Bugs Fixed:
LPP-5613 'examples/animation/animation.lzx broken by class compiler
change' (partial)
Technical Reviewer: hqm (pending)
QA Reviewer: max (pending)
Details:
By reverse-engineering, I determined that an attribute with a
setter _and_ and initial value expects to be initially initialized
to `null` (as opposed to `undefined`), and then the setter called
with the actual initial value. This is the source of the
remaining "reference to undefined property" warnings: some
setters expect to be able to _read_ the value of the state
variable, even before it has been given its initial value. <barf />
Also checking in simplification to LzBactrace that takes advantage
of the AS2 back-end implementing try/catch (thanks Don!).
Tests:
animation.lzx no longer gives "reference to undefined property"
errors.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-18 20:06:07 UTC
(rev 8310)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-18 20:06:32 UTC
(rev 8311)
@@ -81,8 +81,8 @@
// Debug.debug("%w.%s: merging %s (%w)", this,
arguments.callee, k, attrk);
dattrs[ k ] = attrk.concat( dattrk );
continue;
- } else if ((attrk.constructor == Object || attrk is
LzInheritedHash) &&
- (dattrk.constructor == Object || dattrk is
LzInheritedHash)) {
+ } else if ((attrk.constructor === Object || attrk is
LzInheritedHash) &&
+ (dattrk.constructor === Object || dattrk is
LzInheritedHash)) {
// Debug.debug("%w.%s: merging %s (%w)", this,
arguments.callee, k, attrk);
var tmp = new LzInheritedHash(dattrk);
for (var j in attrk) {
@@ -176,6 +176,14 @@
}
this.addProperty(key, val);
delete iargs[key];
+ } else {
+ // NOTE: [2008-03-18 ptw] this is for
+ // back-compatibility: it appears that an
+ // attribute with a setter is expected to be
+ // initially `null` not undefined
+ if (this[key] === void 0) {
+ this.addProperty(key, null);
+ }
}
}
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzBacktrace.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzBacktrace.lzs 2008-03-18
20:06:07 UTC (rev 8310)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzBacktrace.lzs 2008-03-18
20:06:32 UTC (rev 8311)
@@ -2,7 +2,7 @@
/**
*
- * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @affects lzbacktrace
@@ -20,27 +20,15 @@
#pragma "debugBacktrace=false"
/** @access private */
Debug.stackOverflow = function () {
-#pragma "passThrough=true"
var bs = this.backtraceStack;
- if ($js1) {
- try {
- var old = bs.maxDepth;
- // Auto grow the stack. If error handling does not work,
- // eventually the runtime will blow you away...
- bs.maxDepth *= 1.25;
- throw new Error(Debug.error("Stack overflow"));
- } finally {
- bs.maxDepth = old;
- }
- } else if ($as2) {
- // FIXME: [2006-06-06 ptw] When the swf compiler understands try
- // and throw.
+ try {
var old = bs.maxDepth;
+ // Auto grow the stack. If error handling does not work,
+ // eventually the runtime will blow you away...
bs.maxDepth *= 1.25;
- (Debug.error("Stack overflow"));
+ throw new Error(Debug.error("Stack overflow: %s",
Debug.backtrace(bs.length - 50)));
+ } finally {
bs.maxDepth = old;
- } else {
- Debug.error('LzBacktrace, unsupported runtime %s', $runtime);
}
};
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins