Author: ptw
Date: 2008-03-17 19:34:17 -0700 (Mon, 17 Mar 2008)
New Revision: 8302
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/compiler/Class.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
Log:
Change 20080317-ptw-d by [EMAIL PROTECTED] on 2008-03-17 20:01:31 EDT
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Don't let a re-declared attribute clobber an inherited one
Bugs Fixed:
LPP-5614 'compiler must not redeclare instance variables in
subclasses' (partial: for JS1)
Technical Reviewer: hqm (pending)
QA Reviewer: max (pending)
Details:
LzMessage: Be more careful testing for node filenames
LzNode: Don't merge instances in the attr list!
LzText: Be more careful computing toString.
LazszloEvents: Better test for declared events. Move debug name
earlier so it shows up in the constructor.
Class: Don't clobber an inherited attribute with a declared attribute.
Tests:
I see fewer undefined property warnings in the animation example.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/Class.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/Class.lzs 2008-03-18 02:32:02 UTC
(rev 8301)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/Class.lzs 2008-03-18 02:34:17 UTC
(rev 8302)
@@ -51,7 +51,14 @@
*/
(function () {
var addProperty = function AddProperty (name, value) {
- this[name] = value;
+ if ((value !== void 0) || (! (name in this))) {
+ this[name] = value;
+// } else if ($debug) {
+// for (var s = this.constructor; s !== Instance; s =
s.prototype.constructor) {
+// if (s.prototype.hasOwnProperty(name)) { break; }
+// }
+// Debug.debug("Attempt to override %w.%s, already defined in %w", this,
name, s);
+ }
if (value instanceof Function) {
var xtor = this.constructor;
if (value.hasOwnProperty('superclasses')) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-18 02:32:02 UTC
(rev 8301)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-18 02:34:17 UTC
(rev 8302)
@@ -68,14 +68,21 @@
// NOTE: [2008-01-22 ptw] This is just whacky, but it
// is required for back-compatibility. IWBNI this
// were handled at compile-time
- if ( attrk is Object ) {
+ //
+ // NOTE: [2008-03-17 ptw] We have to make sure the
+ // 'objects' we merge are just hash tables. We should
+ // _use_ hash tables, not Objects and then there would
+ // not be any confusion! Hence the check for the
+ // constructor.
+ if (attrk is Object) {
var dattrk = dattrs[ k ];
- if ( dattrk is Object && (! (dattrk is LzInitExpr))) {
- if ( attrk is Array ) {
+ if (dattrk is Object) {
+ if ( attrk is Array && dattrk is Array) {
// Debug.debug("%w.%s: merging %s (%w)", this,
arguments.callee, k, attrk);
dattrs[ k ] = attrk.concat( dattrk );
continue;
- } else {
+ } 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) {
@@ -167,8 +174,15 @@
if (val is Function) {
Debug.debug("%s[%w] = %s", this, key, val);
}
- this.addProperty(key, val);
- delete iargs[key];
+ // TODO: [2008-03-17 ptw] The compiler needs
+ // to filter out redeclarations that do not
+ // specify an init value
+ if ((val !== void 0) || (! (key in this))) {
+ this.addProperty(key, val);
+ delete iargs[key];
+ } else if ($debug) {
+ Debug.debug("Useless init arg: %w.%s = %w",
this, key, val);
+ }
}
}
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs 2008-03-18
02:32:02 UTC (rev 8301)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs 2008-03-18
02:34:17 UTC (rev 8302)
@@ -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.
*
* @access public
@@ -359,7 +359,7 @@
if (file == null) {
for (var i = 3; i < arguments.length; i++) {
var arg = arguments[i];
- if (arg instanceof lz.node && '_dbg_filename' in arg) {
+ if (global['lz'] && arg is lz['node'] && '_dbg_filename' in arg) {
file = arg._dbg_filename;
line = arg._dbg_lineno;
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs 2008-03-18
02:32:02 UTC (rev 8301)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs 2008-03-18
02:34:17 UTC (rev 8302)
@@ -116,7 +116,12 @@
var anEvent = eventSender[ eventName ];
- if ( anEvent == LzDeclaredEvent || !anEvent ){
+ if (! (anEvent is LzEvent)){
+ if ($debug) {
+ if (anEvent && (! (anEvent is LzDeclaredEventClass))) {
+ Debug.debug("Bad event: %w.%s => %w", eventSender, eventName,
anEvent);
+ }
+ }
// The call used to be unrolled here for swf. I removed it since it
// was done during the swf5 days
anEvent = new LzEvent( eventSender, eventName , this );
@@ -357,6 +362,11 @@
*/
function LzEvent ( eventSender , eventName , d ){
super();
+ // If debugging, add an informative name
+ if ($debug) {
+ this._dbg_eventSender = eventSender;
+ this._dbg_eventName = eventName;
+ }
var _evs = eventSender._events;
if (_evs == null ){
@@ -372,11 +382,6 @@
this.delegateList = [];
}
- // If debugging, add an informative name
- if ($debug) {
- this._dbg_eventSender = eventSender;
- this._dbg_eventName = eventName;
- }
if ($profile) {
this._dbg_profileName = eventName;
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs 2008-03-18 02:32:02 UTC
(rev 8301)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs 2008-03-18 02:34:17 UTC
(rev 8302)
@@ -524,7 +524,10 @@
if (id != this.toString()) {
return id;
} else {
- return Debug.stringEscape(this.getText(), true);
+ var contents = this.getText();
+ if (contents) {
+ return Debug.stringEscape(contents, true);
+ }
}
}
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins