Skip to content

optimizer: Refactor out redundant nargs parameter#41699

Merged
vtjnash merged 2 commits intomasterfrom
kf/optrenargs
Jul 26, 2021
Merged

optimizer: Refactor out redundant nargs parameter#41699
vtjnash merged 2 commits intomasterfrom
kf/optrenargs

Conversation

@Keno
Copy link
Copy Markdown
Member

@Keno Keno commented Jul 25, 2021

These functions have taken nargs parameters for a long time
and through many refactors. However, at this point, having this
parameter makes little sense. In fact, we were passing it in three
different places here:

  1. As an explicit argument
  2. As a field of the OptimizationState
  3. Implicitly via the Method def of the MethodInstance in the
    OptimizationState.

Worse, we were inconsistent about whether the first argument counted
as an argument, so there was +/- 1 between these values. Clean that
all up by standardizing on the inclusive definition of nargs,
deleting cases 1 and 2 where the OptimizationState is passed and
retrieving nargs directly from the MethodInstance in the two places that need it.

These functions have taken `nargs` parameters for a long time
and through many refactors. However, at this point, having this
parameter makes little sense. In fact, we were passing it in three
different places here:
 1. As an explicit argument
 2. As a field of the OptimizationState
 3. Implicitly via the Method def of the MethodInstance in the
    OptimizationState.

Worse, we were inconsistent about whether the first argument counted
as an argument, so there was +/- 1 between these values. Clean that
all up by deleting cases 1 and 2 and retriving it directly from the
MethodInstance in the two places that need it.
@Keno Keno requested a review from aviatesk July 25, 2021 05:41
Co-authored-by: Jonas Schulze <jonas.schulze@st.ovgu.de>
@vtjnash vtjnash merged commit 4d7f886 into master Jul 26, 2021
@vtjnash vtjnash deleted the kf/optrenargs branch July 26, 2021 21:41
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.

3 participants