I think this is a more straightforward way to make this check:

Index: SWF9Generator.java
===================================================================
--- SWF9Generator.java  (revision 16354)
+++ SWF9Generator.java  (working copy)
@@ -503,18 +503,7 @@
       if (mixin == null) {
         throw new CompilerError("Missing definition for mixin: " + 
ref.mixinname);
       }
-      // We need the actual super class because we need
-      // a trampoline to any constructor that it has.
-      SimpleNode superClassConst = null;
-
-      if (ref.realsuper != null) {
-        superClassConst = (SimpleNode)classConstructors.get(ref.realsuper);
-
-        // If superClass is null, then we don't know anything about
-        // it: it may be in an included library, etc.  For that case,
-        // we currently require the caller to provide a constructor.
-      }
-      result.set(result.size(), createInterstitial(mixin, isname, ref, 
superClassConst));
+      result.set(result.size(), createInterstitial(mixin, isname, ref));
     }
     return result;
   }
@@ -644,10 +633,9 @@
    * @param mixin mixin that this interstitial implements
    * @param isname name for the interstitial
    * @param mixref the reference that caused this class to be created
-   * @param supernode the 'real' superclass, or null if none
    * @return the new interstitial class AST
    */
-  SimpleNode createInterstitial(SimpleNode mixin, String isname, 
MixinReference mixref, SimpleNode supernode)
+  SimpleNode createInterstitial(SimpleNode mixin, String isname, 
MixinReference mixref)
   {
     // At this point, the mixin has already been visited.
     // We just need to grab its contents and make a fresh class
@@ -667,22 +655,22 @@
     assert mixinchildren[3] instanceof ASTEmptyExpression;
     assert mixinchildren[4] instanceof ASTEmptyExpression;
     // The interstitial has no mixins, but does implement the mixin
-      ischildren[3] = new ASTEmptyExpression(0);
+    ischildren[3] = new ASTEmptyExpression(0);
     ischildren[4] = newIdentifier(mixref.mixinname);
     System.arraycopy(mixinchildren, 5, ischildren, 5, origlen - 5);
     if (mixinconstructor == null) {
-      if (supernode == null && mixref.realsuper != null) {
-
+      // We need the actual super class because we need
+      // a trampoline to any constructor that it has.
+      if (!classConstructors.containsKey(mixref.realsuper)) {
         // For an unknown superclass, we require the mixin programmer
         // to provide a constructor that handles all the cases it
         // might be used.  This is a temporary measure - we currently
         // have no knowledge of superclasses that live in other libraries.
-
         throw new CompilerError("Superclass " + mixref.realsuper + " used by 
mixin not defined, and no constructor supplied for mixin: " + mixref.mixinname);
       }
-      ischildren[origlen] = createInterstitialConstructor(isname, supernode);
+      ischildren[origlen] = createInterstitialConstructor(isname, 
classConstructors.get(mixref.realsuper));
     }
-    
+
     isnode.setChildren(ischildren);
 
     return isnode;

On 2010-05-14, at 15:58, Henry Minsky wrote:

> Change 20100514-hqm-R by [email protected] on 2010-05-14 15:53:55 EDT
>    in /Users/hqm/openlaszlo/trunk
>    for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: fix for mixins in swf10 script backend
> 
> New Features:
> 
> Bugs Fixed: LPP-8999
> 
> Technical Reviewer: ptw
> QA Reviewer: andre
> Doc Reviewer: (pending)
> 
> Documentation:
> 
> Release Notes:
> 
> Overview:
> 
> 
> Details:
> 
> In the new memory-saving changes, SWF9Generator.createInterstitials is being 
> passed only the AST for the  superclass constructor method
> itself, if it exists, or null if there is no explicitly defined constructor. 
> It is
> not being passed the entire superclass AST tree like it used to be.
> 
> Since we don't actually have a pointer to the superclass def anymore,
> the check for the existence of the superclass can now done by checking
> if the classConstructors table contains an entry (possibly null) for
> the classname or not.
> 
> Tests:
> 
> in swf10 these compile without error
> test case from bug report
> smokecheck
> test/drawing/drawing.lzx
> 
> Files:
> M       WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
> 
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100514-hqm-R.tar
> 


Reply via email to