Ok, I fixed that (these are distinct AST's that the Parser uses for state, but
they are treated the same as the non-class ones as far as the compiler goes.
I checked in the change after verifying that it compiles your test case
correctly. Let me know how it goes on a real compile!
On 2010-05-07, at 17:36, Henry Minsky wrote:
> The first test case in the file below fails,within a ' <script
> "when=immediate"> ' fails when
> building an lzo, with an unparse errror.
>
> The other test cases work, for a vanilla #passthrough,
> and the <passthrough> tag in lzx code.
>
> Exception in thread "main" org.openlaszlo.utils.ChainedException:
> org.openlaszlo.sc.CompilerError: Don't know how to unparse:
> ÇASTClassDirectiveBlock(
> import flash.geom.Matrix;
> import flash.geom.Rectangle;
> import flash.display.Bitmap;
> import flash.display.BitmapData;
> import flash.display.Graphics;
> import flash.display.Sprite;
> ;)È
> at org.openlaszlo.compiler.LibraryWriter.close(LibraryWriter.java:244)
> at org.openlaszlo.compiler.Compiler.compile(Compiler.java:441)
> at org.openlaszlo.compiler.Compiler.compile(Compiler.java:196)
> at org.openlaszlo.compiler.Main.compile(Main.java:432)
> at org.openlaszlo.compiler.Main.lzc(Main.java:369)
> at org.openlaszlo.compiler.Main.main(Main.java:101)
> Caused by: org.openlaszlo.sc.CompilerError: Don't know how to unparse:
> ÇASTClassDirectiveBlock(
> import flash.geom.Matrix;
> import flash.geom.Rectangle;
> import flash.display.Bitmap;
> import flash.display.BitmapData;
> import flash.display.Graphics;
> import flash.display.Sprite;
> ;)È
> at
> org.openlaszlo.sc.ParseTreePrinter.defaultVisitor(ParseTreePrinter.java:485)
> at org.openlaszlo.sc.ParseTreePrinter.visit(ParseTreePrinter.java:481)
> at org.openlaszlo.sc.ParseTreePrinter.visit(ParseTreePrinter.java:266)
> at org.openlaszlo.sc.ParseTreePrinter.text(ParseTreePrinter.java:1092)
> at
> org.openlaszlo.sc.GenericVisitor.visitExpression(GenericVisitor.java:628)
> at
> org.openlaszlo.sc.GenericVisitor.visitStatement(GenericVisitor.java:270)
> at
> org.openlaszlo.sc.GenericVisitor.visitStatement(GenericVisitor.java:195)
> at
> org.openlaszlo.sc.GenericVisitor.visitClassDefinition(GenericVisitor.java:964)
> at
> org.openlaszlo.sc.JavascriptCompressor.visitClassDefinition(JavascriptCompressor.java:349)
> at
> org.openlaszlo.sc.GenericVisitor.visitStatement(GenericVisitor.java:202)
> at
> org.openlaszlo.sc.GenericVisitor.visitStatement(GenericVisitor.java:195)
> at
> org.openlaszlo.sc.GenericVisitor.visitModifiedDefinition(GenericVisitor.java:971)
> at
> org.openlaszlo.sc.GenericVisitor.visitStatement(GenericVisitor.java:254)
>
>
>
>
>
> <library>
> <!-- gets error in compile to lzo -->
>
> <script when="immediate"><![CDATA[
> dynamic class blah {
> if ($as3) {
> #passthrough (toplevel:true) {
> import flash.geom.Matrix;
> import flash.geom.Rectangle;
> import flash.display.Bitmap;
> import flash.display.BitmapData;
> import flash.display.Graphics;
> import flash.display.Sprite;
> }#
> }
> function foo (a,b) { return a+b; }
> }
> ]]>
> </script>
>
> <!-- works when compile to lzo -->
> <class name="blahbah" >
> <passthrough>
> import flash.media.*;
> </passthrough>
>
>
> <!--- If true, show camera on immediateparent videoview. -->
> <attribute name="show" value="false" />
>
> <!-- works when compile to lzo -->
>
> <method name="blargh">
> <![CDATA[
>
> #passthrough {
> var re = /^\s*$/;
> var re2 = /\s/g;
> }#
>
> ]]>
> </method>
>
> </class>
>
> </library>
>
>
> On Fri, May 7, 2010 at 2:29 PM, P T Withington <[email protected]> wrote:
>
>> Change 20100507-ptw-7 by [email protected] on 2010-05-07 14:23:15 EDT
>> in /Users/ptw/OpenLaszlo/trunk-test
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: Preserve #passthrough{}# in library compiler
>>
>> Bugs Fixed: LPP-8952 lzc -c corrupts <passthrough> block
>>
>> Technical Reviewer: [email protected] (pending)
>> QA Reviewer: [email protected] (pending)
>>
>> Overview:
>> Same solution as previous tries, but in the right back-end this time
>>
>> Tests:
>> smokecheck, built and tried embed.js
>>
>> Files:
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptCompressor.java
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100507-ptw-7.tar
>>
>
>
>
> --
> Henry Minsky
> Software Architect
> [email protected]