• adamk's avatar
    Don't reflect ES2015 Function name inference in Function.prototype.toString · cc2ea257
    adamk authored
    Various syntactic forms now cause functions to have names where they
    didn't before. Per the upcoming changes to the toString spec, only
    a name that was literally part of a function's expression or declaration
    is meant to be reflected in toString. This also happens to be the same
    set of names that V8 currently outputs (without the --harmony-function-name
    flag).
    
    This required distinguishing anonymous FunctionExpressions from other sorts
    of function definitions (like methods and getters/setters) in the AST, parser,
    and at runtime.
    
    The patch also takes the opportunity to remove one more argument (and enum)
    from FunctionLiteral, as well as adding a special factory method for the
    case of a FunctionLiteral representing toplevel or eval'd code.
    
    BUG=v8:4760
    LOG=n
    
    Review URL: https://codereview.chromium.org/1712833002
    
    Cr-Commit-Position: refs/heads/master@{#34132}
    cc2ea257
ast.cc 27.8 KB