[Laszlo-checkins] r8959 - in openlaszlo/trunk/WEB-INF/lps: lfc/events lfc/helpers lfc/kernel/dhtml lfc/kernel/swf lfc/services/platform/swf server/src/org/openlaszlo/sc

ptw@openlaszlo.org ptw at openlaszlo.org
Thu May 1 11:36:50 PDT 2008


Author: ptw
Date: 2008-05-01 11:36:43 -0700 (Thu, 01 May 2008)
New Revision: 8959

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSoundMC.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzModeManager.as
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
Log:
Change 20080501-ptw-y by ptw at dueling-banjos.home on 2008-05-01 13:10:22 EDT
    in /Users/ptw/OpenLaszlo/ringding-2
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make Delegate argument check work in swf8

Bugs Fixed:
LPP-5818 'Warn when methods registered for events aren't expecting exactly one argument from sendEvent()'

Technical Reviewer: hminsky (Message-ID: <8c61fad60805011114w2bccf235n2f2c737d63ca23cd at mail.gmail.com>)
QA Reviewer: promanik (pending)

Details:
    The compiler notes the number of arguments on swf8 now.

    LaszloEvents: Remove exclusion of as2

    CodeGenerator: Annotate function with length (number of
    parameters) in debug mode.

    *: Update delegate methods in LFC to not warn

Tests:
    This test case should give a warning in swf8 and DHTML now,
    because handleMe does not specify any args.

    <canvas>
      <simplelayout />
      <text name="output" clickable="true" text="Click Me!"/>
      <method name="handleMe">
        output.format("Clicked!");
      </method>
      <handler name="onclick" reference="output" method="handleMe" />
    </canvas>




Modified: openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs	2008-05-01 18:36:43 UTC (rev 8959)
@@ -183,9 +183,7 @@
     var anEvent = eventSender[ eventName ];
 
     var m = this.m;
-    if ($as2) {
-      // AS2 does not support the length property of Function
-    } else if (m && m.length != 1) {
+    if (m && m.length != 1) {
       if ($debug) {
         Debug.warn("Invalid delegate: %#w (must accept one argument to handle %w.%s)",
                    m, eventSender, eventName);

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs	2008-05-01 18:36:43 UTC (rev 8959)
@@ -186,7 +186,7 @@
 
     if ( doapply ){
         if ( this.isinited ){
-            this.apply();
+            this.apply(null);
         } else {
             new LzDelegate( this , "apply" , this , "oninit" );
         }
@@ -201,7 +201,7 @@
   * Applies the state to the state's parent. If the state is already applied,
   * has no effect
   */
-function apply ( ){
+function apply (ignore){
     //@field Boolean isapplied: true if the state is currently applied
     if ( this.isapplied ){
         return;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2008-05-01 18:36:43 UTC (rev 8959)
@@ -154,7 +154,7 @@
     }
 }
 
-LzInputTextSprite.prototype.__hide = function() {
+LzInputTextSprite.prototype.__hide = function(ignore) {
     if (this.__shown != true || this.disabled == true) return;
     LzInputTextSprite.prototype.__lastshown = null;
     this.__shown = false;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -257,7 +257,7 @@
   * cleared, the button doesn't send mouse events.
   * @access private
   */
-TextField.prototype.__handlelostFocus = function ( ){
+TextField.prototype.__handlelostFocus = function ( ignore ){
     //Debug.write('lostfocus', this.__lzview.hasFocus, LzFocus.lastfocus, this, LzFocus.getFocus(), this.__lzview, this.__lzview.inputtextevent);
     if (this.__lzview == LzFocus.getFocus()) {
         LzFocus.clearFocus();

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs	2008-05-01 18:36:43 UTC (rev 8959)
@@ -477,7 +477,7 @@
 /**
   * @access private
   */
-function copyFlashData () {
+function copyFlashData ( ignore ) {
     //    Debug.write("copyFlashData [1]", this.copyQueue.ptr);
     if (this.copyQueue != null) {
         //Debug.write("copyFlashData [2]");

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -174,7 +174,7 @@
   * Updates movieclip properties after the resource has loaded
   * @access private
   */
-LzMakeLoadSprite.updateAfterLoad = function (){
+LzMakeLoadSprite.updateAfterLoad = function (ignore){
 
     this.isloaded = true;
     var mc = this.getMCRef();

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs	2008-05-01 18:36:43 UTC (rev 8959)
@@ -47,7 +47,7 @@
 /**
   * @access private
   */
-function removeLoadChecker() {
+function removeLoadChecker(ignore) {
     // Remove loadChecker delegate
     this.loadChecker.unregisterAll();
     this.removeLoadCheckerDel.unregisterAll();
@@ -201,7 +201,7 @@
 /**
   * @access private
   */
-function testLoad (){
+function testLoad (ignore){
     //skip first check because this can get called before load starts, in 
     //which case load info is wrong
     //getBytesTotal is wrong before the header of the movie has loaded

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSoundMC.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSoundMC.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSoundMC.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -114,7 +114,7 @@
 /**
   * @access private
   */
-SoundMC.prototype.testPlay = function() {
+SoundMC.prototype.testPlay = function(ignore) {
     this._totalframes = Math.floor(this._sound.duration * .001 * this._fps);
     this._currentframe = Math.floor(this._sound.position * .001 * this._fps);
     this._framesloaded = Math.floor((this._sound.getBytesLoaded() / this._sound.getBytesTotal()) * this._totalframes)

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -1375,7 +1375,7 @@
 }
 
 /** @access private */
-LzSprite.prototype._cursorGotMouseover = function() {
+LzSprite.prototype._cursorGotMouseover = function(ignore) {
     LzMouseKernel.setCursorGlobal(this._cures);
 }
 
@@ -1416,7 +1416,7 @@
   * Updates the play percentage
   * @access private
   */
-LzSprite.prototype.updatePlayStatus = function (){
+LzSprite.prototype.updatePlayStatus = function (ignore){
     var c = this.getMCRef()._currentframe;
     //Debug.write('updatePlayStatus', c);
 
@@ -1472,7 +1472,7 @@
   * Called after one frame by checkPlayStatus2 to see the frame number has 
   * changed.  May call itself
   */
-LzSprite.prototype.checkPlayStatus2 = function (){
+LzSprite.prototype.checkPlayStatus2 = function (ignore){
     //Debug.write('checkPlayStatus2 ', this);
     this.updatePlayStatus();
     this.__lzskipplaycheck++;
@@ -1569,7 +1569,7 @@
 /**
   * @access private
   */
-LzSprite.prototype.doQueuedPlayAction = function (){
+LzSprite.prototype.doQueuedPlayAction = function (ignore){
     for (var i=0; i < this.queuedplayaction.length; i++) {
         var qa = this.queuedplayaction[i];
         //Debug.write('doQueuedPlayAction', qa);

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -753,7 +753,7 @@
 /**
   * @access private
   */
-LzTextSprite.prototype.__LZforceScrollAttrs = function () {
+LzTextSprite.prototype.__LZforceScrollAttrs = function ( ignore ) {
     this.__LZtextclip.onScroller();
 }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzModeManager.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzModeManager.as	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzModeManager.as	2008-05-01 18:36:43 UTC (rev 8959)
@@ -66,7 +66,7 @@
     * Cleanup method for raw mouseup
     * @access private
     */
-    function checkClickStream (){
+    function checkClickStream (ignore){
         this.willCall = false;
 
         //clickstream that looks like this

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java	2008-05-01 17:12:50 UTC (rev 8958)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java	2008-05-01 18:36:43 UTC (rev 8959)
@@ -2191,29 +2191,27 @@
         // Function expression leaves function on stack
         collector.emit(Instructions.DUP);
       }
+      // Save that so we can set function length in debug mode..
+      collector.emit(Instructions.DUP);
+      if (options.getBoolean(Compiler.DEBUG_BACKTRACE)) {
+        // Save for filename and line
+        collector.emit(Instructions.DUP);
+        collector.emit(Instructions.DUP);
+      }
       collector.push("name");
       collector.push(userFunctionName);
       collector.emit(Instructions.SetMember);
+      collector.push("length");
+      collector.push(parameters.size());
+      collector.emit(Instructions.SetMember);
       if (options.getBoolean(Compiler.DEBUG_BACKTRACE)) {
         // TODO: [2007-09-04 ptw] Come up with a better way to
         // distinguish LFC from user stack frames.  See
         // lfc/debugger/LzBactrace
         String fn = (options.getBoolean(Compiler.FLASH_COMPILER_COMPATABILITY) ? "lfc/" : "") + filename;
-        if (functionName != null) {
-          collector.push(functionName);
-          collector.emit(Instructions.GetVariable);
-        } else {
-          collector.emit(Instructions.DUP);
-        }
         collector.push("_dbg_filename");
         collector.push(fn);
         collector.emit(Instructions.SetMember);
-        if (functionName != null) {
-          collector.push(functionName);
-          collector.emit(Instructions.GetVariable);
-        } else {
-          collector.emit(Instructions.DUP);
-        }
         collector.push("_dbg_lineno");
         collector.push(lineno);
         collector.emit(Instructions.SetMember);



More information about the Laszlo-checkins mailing list