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

Add ast.find_vars utility function #69

Merged
merged 1 commit into from
Apr 3, 2023
Merged

Add ast.find_vars utility function #69

merged 1 commit into from
Apr 3, 2023

Conversation

anderseknert
Copy link
Member

And update some policies to make use of it

Fixes #68

Copy link
Member

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a feat!

}

# single var declared via `some in`, i.e. `some x in y`
_find_some_in_decl_vars(path, value) := var {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would miss some cases -- like

p := x if some {"x": x} in [{"x": 12}]

which also declares x.

(every cannot do this.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment about that for now, and will look into fixing later. Thanks!

And update some policies to make use of it

Fixes #68

Signed-off-by: Anders Eknert <anders@styra.com>
@anderseknert anderseknert merged commit 596eace into main Apr 3, 2023
@anderseknert anderseknert deleted the find_vars branch April 3, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

References in function body must allow vars declared in same body
2 participants