Well, I've given it a once over, but I don't  grok what's happening in that
part of the compiler well enough to make any useful comments. So go ahead
and check it in and let's see what happens.




On Wed, Nov 4, 2009 at 6:27 PM, P T Withington <[email protected]> wrote:

> [UPDATE:  Holy smokes.  André's little test cases revealed that labeled
> statements didn't actually work in _any_ runtime, and this little 'tweak'
> that was supposed to be a 1-day weekend hack turned into 3-days of
> parser/walker surgery.  I think the parser is stitched back together and
> able to digest solids once again.
>
> Max/Henry:  I'd appreciate it if you'd also give this a once-over, since it
> is such a deep change.]
>
> Change 20091031-ptw-3 by [email protected] on 2009-10-31 12:20:07 EDT
>    in /Users/ptw/OpenLaszlo/trunk
>    for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Work around Adobe bug ASC-3852 (but wait, there's more!)
>
> Bugs Fixed: LPP-8534 SWF10: return from for-in inside try/finally causes
> verifier error
>
> Technical Reviewer: [email protected] (pending)
> QA Reviewer: [email protected] (pending)
>
> Overview:
>
>    Transform a return out of a for-in that is inside a try block into
>    recording the return value and a flag, breaking from the loop, and
>    a conditional return of that value when you leave the loop (as
>    described in the bug comments).  Except that labeled statements
>    didn't actually work in any runtime, so fix that.  Except that the
>    parser makes such a hash of statements vs. blocks, you need to
>    fix that first.
>
>    Also, some more modularization cleanups to move some of the
>    swf8-specific code generation out of the generic/common paths.
>
> Details:
>
>    test/smoke/compiler:  Add [email protected]'s test cases.
>
>    JavascriptGenerator, CodeGenerator, CommonGenerator,
>    SWF9Generator, JavascriptCompressor, Translator, Compiler: Use a
>    factory for making the translation context so subclasses can use
>    custom contexts.  Remove all references to `cpass` -- we haven't
>    had multiple passes for years...
>
>    JavascriptGenerator: Add visitForVarIn that was missed in the
>    remodularization.  Instead of replacing id's with registers, just
>    note register in id (for output by the
>    JavascriptParseTreePrinter).  This makes the register assignment
>    idempotent.  Remove the kludge that added compiler constants to
>    globals directly because the ASTWalker failed to walk them.
>    Simplify visitSwitchStatement, it just wraps a context around the
>    super method.
>
>    JavascriptGenerator, CodeGenerator: Break visitDirective out from
>    visitProgram because the parser can return directives that are not
>    children of a program.  Similarly for visitIfDirective.
>
>    SWF9Generator:  Override visitForInStatement,
>    visitForVarInStatement, visitTryStatement, visitReturnStatement to
>    detect nested try/for-in contexts and rewrite the for-in and
>    return, being careful to deal with function return type and empty
>    return cases.  Make sure visitVariableStatement runs the super
>    method first so compile-time conditionals are crushed out.  Record
>    source locations for globals (for better warnings).
>
>    CommonGenerator: parseFragment now uses a function body rather
>    than a program for its wrapper, so the statements don't come back
>    as directives.  Add visitLabeledStatement that will actually emit
>    branch targets for the label!
>
>    CommonGenerator, GenericVisitor: Rewrite visitSwitchStatement to
>    understand that case and default clauses can have multiple
>    statements.
>
>    TranslationContext, CodeGenerator: isEnumeration, HashMap,
>    set/getTarget are all only used in CodeGenerator.  clone is
>    unused.
>
>    TranslationContext:  Make lookup of a label actually work.
>
>    lzsc: Update to understand --backtrace
>
>    GenericVisitor:  Add/tighten some assertions.
>
>    ParseTreePrinter:  Correct unparsing of "blocks" (which the parser
>    calls ASTStatementList).  Crush out unnecessary nested blocks.
>    Tune whitespace and eliminate single-statement blocks.  [This
>    saves about 1% of the uncompressed DHTML LFC size.]
>
>    Paser:  Eliminate some of the unnecessary nested Statement and
>    StatementList nodes.
>
>    ASTIdentifier:  Add a slot to remember the 'register' assignment for
>    an id.
>
> Tests:
>    Smokecheck on all platforms.
>
> Files:
> M      test/smoke/compiler.lzl
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.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/TranslationContext.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/lzsc.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptCompressor.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/Translator.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/sc/src/org/openlaszlo/sc/Parser.jjt
> M
>  WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/ASTIdentifier.java
>
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20091031-ptw-3.tar
>



-- 
Henry Minsky
Software Architect
[email protected]
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to