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

scope_provider: Simplify parent resolution #1013

Merged
merged 1 commit into from
Sep 16, 2023
Merged

scope_provider: Simplify parent resolution #1013

merged 1 commit into from
Sep 16, 2023

Conversation

zsol
Copy link
Member

@zsol zsol commented Sep 9, 2023

scope_provider: Simplify parent resolution

This PR introduces Scope._next_visible_parent which deduplicates much of the logic between _contains_in_self_or_parent, _find_assignment_target_parent, and _getitem_from_self_or_parent.

This will be helpful when implementing scope resolution for the future AnnotationScope.

There should be no functionality change.


Stack created with Sapling. Best reviewed with ReviewStack.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (94dd20e) 91.04% compared to head (7406106) 91.04%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1013   +/-   ##
=======================================
  Coverage   91.04%   91.04%           
=======================================
  Files         255      255           
  Lines       26366    26366           
=======================================
  Hits        24004    24004           
  Misses       2362     2362           
Files Changed Coverage Δ
libcst/metadata/scope_provider.py 95.64% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This PR introduces `Scope._next_visible_parent` which deduplicates much of the logic between `_contains_in_self_or_parent`, `_find_assignment_target_parent`, and `_getitem_from_self_or_parent`.

This will be helpful when implementing scope resolution for the future `AnnotationScope`.

There should be no functionality change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants