Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing davidhalter/parso#89 #90

Merged
merged 4 commits into from
Dec 14, 2019
Merged

Fixing davidhalter/parso#89 #90

merged 4 commits into from
Dec 14, 2019

Commits on Dec 1, 2019

  1. Fixing #89

    [all changes are in parso/python/errors.py]
    
    * utility function (`_get_namedexpr`) extracting all assignment expression (`namedexpr_test`) nodes
    * add `is_namedexpr` parameter to `_CheckAssignmentRule._check_assignment` and special error message for assignment expression related assignment issues (*cannot use named assignment with xxx*)
    * add assignment expression check to `_CompForRule` (*assignment expression cannot be used in a comprehension iterable expression*)
    * add `_NamedExprRule` for special assignment expression checks
      - *cannot use named assignment with lambda*
      - *cannot use named assignment with subscript*
      - *cannot use named assignment with attribute*
      - and fallback general checks in `_CheckAssignmentRule._check_assignment`
    * add `_ComprehensionRule` for special checks on assignment expression in a comprehension
      - *assignment expression within a comprehension cannot be used in a class body*
      - *assignment expression cannot rebind comprehension iteration variable 'xxx'*
    JarryShaw committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    8cae7ed View commit details
    Browse the repository at this point in the history
  2. Deal with nested comprehension

    e.g. `[i for i, j in range(5) for k in range (10) if True or (i := 1)]`
    JarryShaw committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    76fe479 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2019

  1. Revised implementation

     * search ancestors of namedexpr_test directly for comprehensions
     * added test samples for invalid namedexpr_test syntax
    JarryShaw committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    776e151 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2019

  1. * moved all namedexpr_test related rules to _NamedExprRule

     * added valid examples
    JarryShaw committed Dec 14, 2019
    Configuration menu
    Copy the full SHA
    89c4d95 View commit details
    Browse the repository at this point in the history