I've attached an alternative solution which uses getQualifiedClassName() instead of getDefinitionByName() in $lzsc$issubclassof(). This solution works without changing the compiler and should also provide better runtime performance.


On 4/28/2010 4:00 AM, André Bargull wrote:
Change 20100428-bargull-zlC by barg...@bargull02 on 2010-04-28 03:48:54
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: make all class definitions public

New Features:

Bugs Fixed: LPP-8942 ($lzc$issubclassof does not work for mixins in as3 non-debug)

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

Documentation:

Release Notes:

Overview:


Details:
flash.utils.getDefinitionByName() does only work for public definitions, otherwise a ReferenceError is thrown. Therefore all classes are now defined as public. This makes subclassof work in non-debug, because $lzc$issubclassof uses getDefinitionByName().


Tests:
smokecheck, metasuite in swf10 (non-debug, debug)

Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100428-bargull-zlC.tar

--- LzRuntime-0.3.lzs   Wed Apr 28 04:42:54 2010
+++ trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs        Wed Apr 28 04:40:31 2010
@@ -122,22 +122,18 @@
   if ($as3) {
     #passthrough {
       import flash.utils.describeType;
-      import flash.utils.getDefinitionByName;
+      import flash.utils.getQualifiedClassName;
     }#
     if (one === other) return true;
     // The hard way
     var factory:XML = describeType(one).elements('factory')[0];
+    var qname:String = getQualifiedClassName(other);
     // Look at superclasses and interfaces
     var elements = ['extendsClass', 'implementsInterface'];
     for (var i in elements) {
       var superclassnames:XMLList = 
factory.elements(elements[i]).attribute('type');
       for (var j in superclassnames) {
-        try {
-          var superclass = getDefinitionByName(superclassnames[j]);
-          if (superclass === other) return true;
-        } catch (e:ReferenceError) {
-          // interstitials may not be present
-        }
+        if (superclassnames[j] == qname) return true;
       }
     }
     return false;

Reply via email to