Skip to content

Python: Use _one_ parameter position for normal parameters #12468

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RasmusWL
Copy link
Member

@RasmusWL RasmusWL commented Mar 9, 2023

That can be used with both positional and keyword arguments. Before we provided BOTH a positional and keyword parameter position, which broke some assumptions in the dataflow library.

(Created as draft to see effect before requesting review)

That can be used with both positional and keyword arguments. Before we
provided BOTH a positional and keyword parameter position, which broke
some assumptions in the dataflow library.
@github-actions github-actions bot added the Python label Mar 9, 2023
Having these tests show all the synthetic nodes from flow-summaries
seems like it will become very annoying once we start expanding the
amount of flow summaries.
@RasmusWL RasmusWL added the no-change-note-required This PR does not need a change note label Mar 13, 2023
Comment on lines +45 to +54
TNormalParameterPosition(int index, string name) {
exists(Function f, Parameter p, int indexOffset |
p = f.getArg(index + indexOffset) and
p = f.getArgByName(name) and
indexOffset = any(DataFlowFunction dff | dff.getScope() = f).positionalOffset() and
// for things that will be considered a self parameter, we do not need to create a
// parameter position
index >= 0
)
} or
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I should have explained better that for the method definition below, we need to take care for the self parameter, so want to have TNormalParameterPosition(0, "arg").

class Foo:
    def meth(self, arg): pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant