Error formatting macro: pagetree: java.lang.NullPointerException

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • Write a simple AST rewriter for the specific case
    • Benefits - easy to implement
    • Tradeoffs 
      • with few improvements to the 2 years old AST design, the cruft is growing and this will only add to it
      • no other forms that generate immediate called JS functions will be optimized
  • Design a pluggable AST pass system
    • Benefits
      • force us to make some basic improvements/standardization around the AST
      • allow any future optimizations to be handled in a modular fashion
      • no longer depend on Closure Compiler for language optimizations that may be ignored because less applicable to mainstream JS practice
    • Tradeoffs
      • More design, more work
        • Needs to consider the AST
        • Need a future looking optimization design
        • Lots of room for potential breakage and unforeseen edges cases
  • Combine the two solutions above
    • Write standalone AST -> ANF library
    • Abstract the complier enough to make it straightforward to plugin a select pass
    • Restrict the pass to the `if` AST nodes where the test expr is a `let` AST node