[Laszlo-dev] For Review: Change 20081204-hqm-K Summary: allow classes in <import> libraries to extend classes from main app

Henry Minsky henry.minsky at gmail.com
Thu Dec 4 20:35:02 PST 2008


Change 20081204-hqm-K by hqm at badtzmaru.home on 2008-12-04 23:20:15 EST
     in /Users/hqm/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: allow classes in <import> libraries to extend classes from  
main app

New Features:

Bugs Fixed: LPP-740

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

Documentation:

Release Notes:

Details:

+ In order to allow classes in an <import> (loadable library) to  
subclass
classes in the main app, the flex compiler must be given a pointer to  
the main
app's as3 working dir, so it can resolve links with the superclasses.

This change addresses this issue:

1) Main app defines class A, library defines "class B extends A"

This change reorders the compilations in the tag compiler, so the main
app is compiled first, and any <import> libraries are compiled
afterwards. A pointer to the main application's as3 tmp working dir is
passed to any compilations of <import> libraries.  The flex compiler
is given these extra args

         cmd.add("-compiler.source-path+="+mInfo.mainAppWorkDir);
         cmd.add("-external-library-path+="+mInfo.mainAppWorkDir);

which tells it to check links against the main app dir, but not to  
include
any of those classes into the library it is compiling.

+ Note, this change does not addresss these cases:

2) Library defines class A, main app defines "class B extends A"

3) Main app defines class A, library defines "class B extends A", main  
app defines "class C extends B"

Cases 2) and 3) actually happen to produce running code, but the code
for the subclasses all gets put into the main app, not the library (I
think the tag compiler is doing that automatically).

Tests:

+ test case from bug, with slight variants, are in
test/snippets/case1.lzx
test/snippets/case2.lzx

Both examples should display two buttons, one titles "Main" and the  
other titled "Library"

Files:
A      test/snippets/case1.lzx
A      test/snippets/case2.lzx
A      test/snippets/case1-lib.lzx
A      test/snippets/case2-lib.lzx
A      WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptCompilerInfo.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
CompilationEnvironment.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
ImportCompiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java


Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20081204-hqm-K.tar


More information about the Laszlo-dev mailing list