Replaced Predicate<WritableSlice> with TraceEntryFilter, which accepts key and slice.
This commit is contained in:
@@ -108,15 +108,17 @@ public class DelegatingBindingTrace implements BindingTrace {
|
||||
addAllMyDataTo(trace, null, true);
|
||||
}
|
||||
|
||||
public void addAllMyDataTo(@NotNull BindingTrace trace, @Nullable Predicate<WritableSlice> filter, boolean commitDiagnostics) {
|
||||
public void addAllMyDataTo(@NotNull BindingTrace trace, @Nullable TraceEntryFilter filter, boolean commitDiagnostics) {
|
||||
for (Map.Entry<SlicedMapKey<?, ?>, ?> entry : map) {
|
||||
SlicedMapKey slicedMapKey = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
WritableSlice slice = slicedMapKey.getSlice();
|
||||
if (filter == null || filter.apply(slice)) {
|
||||
Object key = slicedMapKey.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
if (filter == null || filter.accept(slice, key)) {
|
||||
//noinspection unchecked
|
||||
trace.record(slice, slicedMapKey.getKey(), value);
|
||||
trace.record(slice, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TemporaryBindingTrace extends DelegatingBindingTrace {
|
||||
clear();
|
||||
}
|
||||
|
||||
public void commit(@NotNull Predicate<WritableSlice> filter, boolean commitDiagnostics) {
|
||||
public void commit(@NotNull TraceEntryFilter filter, boolean commitDiagnostics) {
|
||||
addAllMyDataTo(trace, filter, commitDiagnostics);
|
||||
clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
|
||||
public interface TraceEntryFilter {
|
||||
boolean accept(@NotNull WritableSlice<?, ?> slice, Object key);
|
||||
}
|
||||
@@ -569,9 +569,9 @@ public class CallResolver {
|
||||
task.getResolvedCalls().add(call);
|
||||
}
|
||||
|
||||
context.candidateCall.getTrace().addAllMyDataTo(traceForResolutionCache, new Predicate<WritableSlice>() {
|
||||
context.candidateCall.getTrace().addAllMyDataTo(traceForResolutionCache, new TraceEntryFilter() {
|
||||
@Override
|
||||
public boolean apply(@Nullable WritableSlice slice) {
|
||||
public boolean accept(@NotNull WritableSlice<?, ?> slice, Object key) {
|
||||
return slice == BindingContext.RESOLUTION_RESULTS_FOR_FUNCTION || slice == BindingContext.RESOLUTION_RESULTS_FOR_PROPERTY ||
|
||||
slice == BindingContext.TRACE_DELTAS_CACHE;
|
||||
}
|
||||
|
||||
+2
-2
@@ -125,9 +125,9 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
returnType = context.expressionTypingServices.getBlockReturnedType(functionInnerScope, bodyExpression, CoercionStrategy.COERCION_TO_UNIT,
|
||||
context.replaceExpectedType(returnType).replaceBindingTrace(temporaryTrace), temporaryTrace).getType();
|
||||
}
|
||||
temporaryTrace.commit(new Predicate<WritableSlice>() {
|
||||
temporaryTrace.commit(new TraceEntryFilter() {
|
||||
@Override
|
||||
public boolean apply(@Nullable WritableSlice slice) {
|
||||
public boolean accept(@NotNull WritableSlice<?, ?> slice, Object key) {
|
||||
return (slice != BindingContext.RESOLUTION_RESULTS_FOR_FUNCTION && slice != BindingContext.RESOLUTION_RESULTS_FOR_PROPERTY &&
|
||||
slice != BindingContext.TRACE_DELTAS_CACHE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user