From 16236f570016be60ad24b78bf6780378497909a8 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 30 Sep 2011 16:05:26 +0400 Subject: [PATCH] Standard Ref<> used --- .../jet/lang/resolve/calls/CallResolver.java | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index d37dfa72ee0..6089c27edd1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -6,6 +6,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.intellij.lang.ASTNode; +import com.intellij.openapi.util.Ref; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.JetSemanticServices; @@ -184,7 +185,6 @@ public class CallResolver { return null; } - private D resolveCallToDescriptor( @NotNull BindingTrace trace, @NotNull JetScope scope, @@ -306,7 +306,7 @@ public class CallResolver { Map successfulCandidates = Maps.newLinkedHashMap(); Set failedCandidates = Sets.newLinkedHashSet(); Set dirtyCandidates = Sets.newLinkedHashSet(); - Map solutions = Maps.newHashMap(); +// Map solutions = Maps.newHashMap(); Map traces = Maps.newHashMap(); for (D candidate : task.getCandidates()) { @@ -322,7 +322,7 @@ public class CallResolver { continue; } - Flag dirty = new Flag(false); + Ref dirty = new Ref(false); Map argumentsToParameters = Maps.newHashMap(); boolean error = ValueArgumentsToParametersMapper.mapValueArgumentsToParameters(task, tracing, candidate, temporaryTrace, argumentsToParameters); @@ -362,7 +362,7 @@ public class CallResolver { constraintSystem.addSubtypingConstraint(type, valueParameterDescriptor.getOutType()); } else { - dirty.setValue(true); + dirty.set(true); } } @@ -379,7 +379,7 @@ public class CallResolver { } ConstraintSystem.Solution solution = constraintSystem.solve(); - solutions.put(candidate, solution); +// solutions.put(candidate, solution); if (solution.isSuccessful()) { D substitute = (D) candidate.substitute(solution.getSubstitutor()); assert substitute != null; @@ -435,7 +435,7 @@ public class CallResolver { } } - if (dirty.getValue()) { + if (dirty.get()) { dirtyCandidates.add(candidate); } task.performAdvancedChecks(candidate, temporaryTrace, tracing); @@ -573,7 +573,7 @@ public class CallResolver { } } - private boolean checkValueArgumentTypes(JetScope scope, JetTypeInferrer.Services temporaryServices, Map argumentsToParameters, Flag dirty, Function parameterMap) { + private boolean checkValueArgumentTypes(JetScope scope, JetTypeInferrer.Services temporaryServices, Map argumentsToParameters, Ref dirty, Function parameterMap) { boolean result = true; for (Map.Entry entry : argumentsToParameters.entrySet()) { ValueArgument valueArgument = entry.getKey(); @@ -588,7 +588,7 @@ public class CallResolver { if (argumentExpression != null) { JetType type = temporaryServices.getType(scope, argumentExpression, parameterType); if (type == null) { - dirty.setValue(true); + dirty.set(true); } else if (!semanticServices.getTypeChecker().isSubtypeOf(type, parameterType)) { result = false; @@ -804,20 +804,4 @@ public class CallResolver { return new ResolutionTask(candidates, receiver, call); } }; - - private static class Flag { - private boolean flag; - - public Flag(boolean flag) { - this.flag = flag; - } - - public boolean getValue() { - return flag; - } - - public void setValue(boolean flag) { - this.flag = flag; - } - } }