Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Nov 19, 2010
  1. @laverdet

    Add convenience casting for NodeWalker

    laverdet authored
    Summary:
    It can be a pain to have to cast subclasses of NodeWalker all the time using static_cast and dynamic_cast, especially with auto_ptr's. This adds an overloaded template cast() function for use in subclasses of NodeWalker; so you can do `cast(MyNodeWalkerClass).some_var` to cast your class. It will throw if you pass an invalid class so you can just all NodeWalker* instances without error-checking.
    
    Test Plan:
    Compiles
    
    Reviewed By: epriestley
  2. @laverdet

    E4X parsing support

    laverdet authored
    Summary:
    This adds optional support for E4X as specified by ECMA-357. By default this is off, but you can enable it at run-time with PARSER_E4X.
    
    Test Plan:
    Basically nothing at all.
    
    Reviewed By: epriestley
  3. @laverdet

    Support for typehints and object literal elisons

    laverdet authored
    Summary:
    Included in this diff is support for type declarations as made popular by ActionScript. While not part of ECMAScript, if typing ever does make it into the language it will most likely look similar to this. By default type declarations will still yield a syntax error, however you may elect to tell the parser to allow these declarations by passing PARSE_TYPEHINT to the second parameter of NodeProgram.
    
    Additionally this adds support for trailing commas in object literals. While expressly allowed by ECMA-262, trailing commas in object literals have become defacto forbidden in most client-side JavaScript applications due to poor browser option.
    
    Test Plan:
    Compiles
    
    Reviewed By: epriestley
  4. @laverdet

    NodeWalker and removal of reduce()

    laverdet authored
    Summary:
    A general solution is needed for walking these AST's and applying a transformation to them. This implements a typical visitor class from which you can extend to subscribe to nodes you want to handle. There's built-in methods for manipulating the tree as you go, and getting data from your children.
    
    Test Plan:
    Built a few walkers for another application, adapting this API as I found use cases.
    
    Reviewed By: epriestley
Something went wrong with that request. Please try again.