Change 20100320-ptw-j by [email protected] on 2010-03-20 09:03:52 EDT
   in /Users/ptw/OpenLaszlo/trunk-2
   for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make instance tests work for LZX mixins

Bugs Fixed: LPP-8828 LZX mixins cannot be tested for with `is`

Technical Reviewer: hminsky (pending)
QA Reviewer: max (pending)

Overview:

   The LZX compiler expands LZX mixins into 'interstitial' classes
   (because it needs to override/accumulate attributes and children
   according to the node model, so it cannot translate them directly
   into lzs mixins).  The expansion was not annotating these classes
   with `implements` so type tests against the base mixin would fail.
   This change causes the interstitial classes to have the correct
   type.

Details:

   compiler.lzl:  Add a unit test to verify that an LZX instance with
   a mixin `is` that mixin.

   LzCSSStyle: (Noticed in passing) use more accurate `subclassof`
   operator in place of prototype-based approximation.

   contextmenu.*:  Rebuild this using .lzo technology so that it is
   independent of internal back-end API's (In particular, the changes
   to the class runtime support in this change broke the previous
   implementation.  By using a platform-independent translation, this
   should be more robust to future compiler changes.)  The only
   source changes were to make explicit some implicit this references
   to silence compiler warnings.

   Class.lzs: reordered arguments to allow more compact code through
   omitting defaults.  Added a new argument `implements` to support
   interface type tests.

   ClassModel:  When expanding LZX mixins to interstitials, note the
   mixin they implement.

   The remainder of the change adds support for `implements` on lzs
   class declarations and passes that information through to the
   runtime so it can be used for type tests.  This meant updating the
   Parser to accept the keyword, updating all the AST walkers to
   understand the new structure of ASTClassDefinition, and updating
   the generators to pass that new information to the runtime in the
   appropriate format.

Tests:
   smokecheck on all 3 runtimes with newly added mixin subtype test.

Files:
M       test/smoke/compiler.lzl
M       WEB-INF/lps/lfc/services/LzCSSStyle.lzs
M       WEB-INF/lps/lfc/contextmenu.js
M       WEB-INF/lps/lfc/contextmenu.lzx
M       WEB-INF/lps/lfc/compiler/Class.lzs
M       WEB-INF/lps/server/src/org/openlaszlo/js2doc/JS2Doc.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/GenericVisitor.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
M       WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt


Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100320-ptw-j.tar

Reply via email to