Change 20091029-ptw-1 by [email protected] on 2009-10-29 15:18:26 EDT
in /Users/ptw/OpenLaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Remodularize the AST walkers
Bugs Fixed: LPP-7184 Binary libraries don't work in swf9 (substrate)
Technical Reviewer: max (pending)
QA Reviewer: hminsky (pending)
Details:
Overview
Create a generic abstract syntax tree walker that knows how to
visit every node and (possibly) rewrite it. Subclass that for
each of the possible code generators. Use that to untangle the
compressor from the code generator. In the future, it can be used
to create other compiler phases, like to pre-analyze global
declarations and class models, to do inlining, and to
post-optimize, compress, and obfuscate.
There is more cleanup that could be done to create a class that is
for JS1 platforms separate from JS2 platforms, but that is not
required for LPP-7184, so I have not attempted that here.
JavascriptGenerator, CommonGenerator: Remove methods that
duplicate GenericVisitor or are only required in CodeGenerator
(swf8).
JavascriptGenerator: Customize translateFunctionInternal for
Javascript (new name because it requires a different signature for
now).
VariableAnalyzer: Only requires ASTVisitor interface.
CommonGenerator: Extend GenericVisitor. Move include parsing up
to GenericVisitor.
TranslationContext: Remove methods only needed for swf8.
ASTVisitor: Move options here from Translator. Complete
signature for all AST's.
Compiler: Remove ACTIVATION_OBJECT default (not needed since
swf5!). Continue to kludge interface to CodeGenerator.
CodeGenerator: Create SWFTranslationContext that extends
TranslationContext with the features only needed for swf8. Move
swf8 overrides from CommonGenerator here.
JavascriptCompressor: Extend GenericVisitor, overriding just
enough visitors to analyze and rename function locals.
Translator: Move options to ASTVisitor and swf8-specific
interfaces to CodeGenerator.
GenericVisitor: (new) Knows how to expand includes and walk all
nodes of the parse tree, possibly rewriting. What we should have
done when we started the DHTML project, but did not have time
for...
ParseTreePrinter: Debug and name tweaks.
Tests:
Smokecheck on all platforms, diff of LFCdhtml.js before and after.
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/VariableAnalyzer.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/ASTVisitor.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.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
A WEB-INF/lps/server/src/org/openlaszlo/sc/GenericVisitor.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20091029-ptw-1.tar
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews