• mstarzinger@chromium.org's avatar
    Add parser support for generators. · 2816f196
    mstarzinger@chromium.org authored
    This patchset begins by adding support for "yield", which is unlike other tokens
    in JS. In a generator, whether strict or classic, it is a syntactic keyword.
    In classic mode it is an identifier. In strict mode it is reserved.
    
    This patch adds YIELD as a token to the scanner, and adapts the preparser and
    parser appropriately. It also parses "function*", indicating that a function is
    actually a generator, for both eagerly and lazily parsed functions.
    
    Currently "yield" just compiles as "return".
    
    BUG=v8:2355
    TEST=mjsunit/harmony/generators-parsing
    
    Review URL: https://codereview.chromium.org/12646003
    Patch from Andy Wingo <wingo@igalia.com>.
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14116 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    2816f196
ast.cc 33.6 KB