js/src/jsapi-tests/binast/invalid/tests/identifier-null.py
author Tooru Fujisawa <arai_a@mac.com>
Thu, 14 Mar 2019 06:48:43 +0000
changeset 521854 8014816b11ed14f3483b12c42e6785b02a414614
permissions -rw-r--r--
Bug 1535175 - Throw error for empty string in readIdentifierName. r=Yoric Differential Revision: https://phabricator.services.mozilla.com/D23439

def filter_ast(ast):
    # AssignmentTargetIdentifier with null string.
    import filter_utils as utils

    utils.wrap(ast) \
        .assert_interface('Script') \
        .field('statements') \
        .elem(0) \
        .assert_interface('ExpressionStatement') \
        .field('expression') \
        .assert_interface('AssignmentExpression') \
        .field('binding') \
        .assert_interface('AssignmentTargetIdentifier') \
        .field('name') \
        .set_null_identifier_name()

    return ast