• adamk's avatar
    Centralize and standardize logic for ExpressionClassifier accumulation · 51c186dd
    adamk authored
    Previously the calls to ExpressionClassifier::Accumulate() each chose
    slightly different sets of productions to accumulate, and it turned
    out that these were in some cases broader than needed and in some
    cases less broad.
    
    The existence of some grab-bag production bitmasks like
    ExpressionClassifier::ExpressionProductions made this situation more
    error-prone (for example, that production was missing AsyncArrowFormalParametersProduction).
    
    This patch removes all "grab-bags" besides AllProductions. In some of
    the places where code was using those grab-bags for convenience, it
    switches them to use negation of AllProductions. In other, specifically
    those having to do with expressions that are disallowed anywhere in
    a sub-expression of a parameter list, I've added a new method on
    ExpressionClassifier to centralize the logic.
    
    The aforementioned centralization/addition of
    AsyncArrowFormalParametersProduction fixes several cases where we were
    failing to report an error for 'await' in some contexts; I've added
    those test cases.
    
    The patch also narrows all cases to exactly the set or productions
    necessary, with a comment on each explaining the choice.
    
    BUG=v8:4483
    
    Review-Url: https://codereview.chromium.org/2271063002
    Cr-Commit-Position: refs/heads/master@{#38918}
    51c186dd
preparser.cc 42 KB