@@ -30,7 +30,6 @@ public final class Arity {
30
30
private final int optional ;
31
31
private final boolean hasRest ;
32
32
private final int postRequired ;
33
- private final boolean allKeywordsOptional ;
34
33
private final boolean hasKeywordsRest ;
35
34
private final String [] keywordArguments ;
36
35
private final int requiredKeywordArgumentsCount ;
@@ -60,7 +59,6 @@ public Arity(
60
59
// So we can specify them with only one `int` field (`requiredKeywordArgumentsCount`).
61
60
this .keywordArguments = keywordArguments ;
62
61
this .requiredKeywordArgumentsCount = requiredKeywordArgumentsCount ;
63
- this .allKeywordsOptional = requiredKeywordArgumentsCount == 0 ;
64
62
this .hasKeywordsRest = hasKeywordsRest ;
65
63
this .arityNumber = computeArityNumber (false );
66
64
this .procArityNumber = computeArityNumber (true );
@@ -121,22 +119,22 @@ public boolean hasKeywords() {
121
119
return keywordArguments .length != 0 ;
122
120
}
123
121
124
- public boolean hasRequiredKeywords () {
125
- return !allKeywordsOptional ;
126
- }
127
-
128
122
public boolean hasKeywordsRest () {
129
123
return hasKeywordsRest ;
130
124
}
131
125
126
+ public boolean allKeywordsOptional () {
127
+ return requiredKeywordArgumentsCount == 0 ;
128
+ }
129
+
132
130
private int computeArityNumber (boolean isProc ) {
133
131
int count = getRequired ();
134
132
135
- if (acceptsKeywords () && !allKeywordsOptional ) {
133
+ if (acceptsKeywords () && !allKeywordsOptional () ) {
136
134
count ++;
137
135
}
138
136
139
- if (hasRest || (!isProc && (optional > 0 || (acceptsKeywords () && allKeywordsOptional )))) {
137
+ if (hasRest || (!isProc && (optional > 0 || (acceptsKeywords () && allKeywordsOptional () )))) {
140
138
count = -count - 1 ;
141
139
}
142
140
0 commit comments