Optimization: Unneeded collection creation eliminated
This commit is contained in:
+5
-7
@@ -102,20 +102,18 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
|
|||||||
// We saw only positioned arguments so far
|
// We saw only positioned arguments so far
|
||||||
private final ProcessorState positionedOnly = new ProcessorState() {
|
private final ProcessorState positionedOnly = new ProcessorState() {
|
||||||
|
|
||||||
private Queue<ValueParameterDescriptor> valueParameterQueue;
|
private int currentParameter = 0;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ValueParameterDescriptor nextValueParameter() {
|
public ValueParameterDescriptor nextValueParameter() {
|
||||||
if (valueParameterQueue == null) {
|
List<ValueParameterDescriptor> parameters = candidateCall.getCandidateDescriptor().getValueParameters();
|
||||||
valueParameterQueue = new LinkedList<ValueParameterDescriptor>(candidateCall.getCandidateDescriptor().getValueParameters());
|
if (currentParameter >= parameters.size()) return null;
|
||||||
}
|
|
||||||
|
|
||||||
ValueParameterDescriptor head = valueParameterQueue.peek();
|
ValueParameterDescriptor head = parameters.get(currentParameter);
|
||||||
if (head == null) return null;
|
|
||||||
|
|
||||||
// If we found a vararg parameter, we are stuck with it forever
|
// If we found a vararg parameter, we are stuck with it forever
|
||||||
if (head.getVarargElementType() == null) {
|
if (head.getVarargElementType() == null) {
|
||||||
valueParameterQueue.remove();
|
currentParameter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
|
|||||||
Reference in New Issue
Block a user