• dslomov's avatar
    [destructuring] Grand for statement parsing unification. · 7ffdb519
    dslomov authored
    Also support patterns in ``for (var p in/of ...)``
    
    This CL extends the rewriting we used to do for ``for (let p in/of...)`` to
    ``for (var p in/of ...)``. For all for..in/of loop declaring variable,
    we rewrite
       for (var/let/const pattern in/of e) b
    into
       for (x' in/of e) { var/let/const pattern = e; b }
    
    This adds a small complication for debugger: for a statement
       for (var v in/of e) ...
    we used to have
       var v;
       for (v in/of e) ...
    and there was a separate breakpoint on ``var v`` line.
    This breakpoint is actually useless since it is immediately followed by
    a breakpoint on evaluation of ``e``, so this CL removes that breakpoint
    location.
    
    Similiraly, for let, it used to be that
      for (let v in/of e) ...
    became
      for (x' in/of e) { let v; v  = x'; ... }
    ``let v``generetaed a useless breakpoint (with the location at the
    loop's head. This CL removes that breakpoint as well.
    
    R=arv@chromium.org,rossberg@chromium.org
    BUG=v8:811
    LOG=N
    
    Review URL: https://codereview.chromium.org/1149043005
    
    Cr-Commit-Position: refs/heads/master@{#28565}
    7ffdb519
parser.h 46.8 KB