'isVisible' strategy added to Visibility interface
This commit is contained in:
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
|
||||
@NotNull
|
||||
@Override
|
||||
public Visibility getVisibility() {
|
||||
return Visibility.PUBLIC;
|
||||
return Visibilities.PUBLIC;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
-3
@@ -17,12 +17,9 @@
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class FunctionDescriptorUtil {
|
||||
Collections.<TypeParameterDescriptor>emptyList(),
|
||||
JetStandardClasses.getValueParameters(functionDescriptor, functionType),
|
||||
JetStandardClasses.getReturnTypeFromFunctionType(functionType),
|
||||
Modality.FINAL, Visibility.LOCAL);
|
||||
Modality.FINAL, Visibilities.LOCAL);
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor> D alphaConvertTypeParameters(D candidate) {
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.descriptors;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author svtk
|
||||
*/
|
||||
public class Visibilities {
|
||||
public static final Visibility PRIVATE = new Visibility(false) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
DeclarationDescriptor parent = what;
|
||||
while (parent != null) {
|
||||
parent = parent.getContainingDeclaration();
|
||||
if ((parent instanceof ClassDescriptor && ((ClassDescriptor)parent).getKind() != ClassKind.OBJECT) ||
|
||||
parent instanceof NamespaceDescriptor) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DeclarationDescriptor fromParent = from;
|
||||
while (fromParent != null) {
|
||||
if (parent == fromParent) {
|
||||
return true;
|
||||
}
|
||||
fromParent = fromParent.getContainingDeclaration();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Visibility PROTECTED = new Visibility(true) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
ClassDescriptor classDescriptor = DescriptorUtils.getParentOfType(what, ClassDescriptor.class);
|
||||
if (classDescriptor == null) return false;
|
||||
|
||||
ClassDescriptor fromClass = DescriptorUtils.getParentOfType(from, ClassDescriptor.class);
|
||||
if (fromClass == null) return false;
|
||||
if (DescriptorUtils.isSubclass(fromClass, classDescriptor)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Visibility INTERNAL = new Visibility(false) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
ModuleDescriptor parentModule = DescriptorUtils.getParentOfType(what, ModuleDescriptor.class, false);
|
||||
ModuleDescriptor fromModule = DescriptorUtils.getParentOfType(from, ModuleDescriptor.class, false);
|
||||
return parentModule == fromModule;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Visibility PUBLIC = new Visibility(true) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Visibility INTERNAL_PROTECTED = new Visibility(false) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
return PROTECTED.isVisible(what, from) && INTERNAL.isVisible(what, from);
|
||||
}
|
||||
};
|
||||
|
||||
public static final Visibility LOCAL = new Visibility(false) {
|
||||
@Override
|
||||
public boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Set<Visibility> INTERNAL_VISIBILITIES = Sets.newHashSet(PRIVATE, INTERNAL, INTERNAL_PROTECTED, LOCAL);
|
||||
}
|
||||
@@ -16,28 +16,19 @@
|
||||
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author svtk
|
||||
*/
|
||||
public enum Visibility {
|
||||
PRIVATE(false),
|
||||
PROTECTED(true),
|
||||
INTERNAL(false),
|
||||
PUBLIC(true),
|
||||
INTERNAL_PROTECTED(false),
|
||||
LOCAL(false);
|
||||
public abstract class Visibility {
|
||||
private final boolean isPublicAPI;
|
||||
|
||||
public static final EnumSet<Visibility> INTERNAL_VISIBILITIES = EnumSet.of(PRIVATE, INTERNAL, INTERNAL_PROTECTED, LOCAL);
|
||||
|
||||
private final boolean isAPI;
|
||||
|
||||
private Visibility(boolean visibleOutside) {
|
||||
isAPI = visibleOutside;
|
||||
protected Visibility(boolean api) {
|
||||
isPublicAPI = api;
|
||||
}
|
||||
|
||||
public boolean isAPI() {
|
||||
return isAPI;
|
||||
public boolean isPublicAPI() {
|
||||
return isPublicAPI;
|
||||
}
|
||||
|
||||
public abstract boolean isVisible(DeclarationDescriptorWithVisibility what, DeclarationDescriptor from);
|
||||
}
|
||||
|
||||
@@ -216,8 +216,7 @@ public class DescriptorResolver {
|
||||
}
|
||||
}
|
||||
boolean hasBody = function.getBodyExpression() != null;
|
||||
Modality defaultModality = getDefaultModality(containingDescriptor, hasBody);
|
||||
Modality modality = resolveModalityFromModifiers(function.getModifierList(), defaultModality);
|
||||
Modality modality = resolveModalityFromModifiers(function.getModifierList(), getDefaultModality(containingDescriptor, hasBody));
|
||||
Visibility visibility = resolveVisibilityFromModifiers(function.getModifierList());
|
||||
JetModifierList modifierList = function.getModifierList();
|
||||
boolean isInline = (modifierList != null) && modifierList.hasModifier(JetTokens.INLINE_KEYWORD);
|
||||
|
||||
@@ -190,7 +190,7 @@ public class TypeHierarchyResolver {
|
||||
private void createPrimaryConstructorForObject(@Nullable JetDeclaration object, MutableClassDescriptor mutableClassDescriptor) {
|
||||
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(mutableClassDescriptor, Collections.<AnnotationDescriptor>emptyList(), true);
|
||||
constructorDescriptor.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
||||
Visibility.INTERNAL);//TODO check set mutableClassDescriptor.getVisibility()
|
||||
Visibilities.INTERNAL);//TODO check set mutableClassDescriptor.getVisibility()
|
||||
// TODO : make the constructor private?
|
||||
mutableClassDescriptor.setPrimaryConstructor(constructorDescriptor, trace);
|
||||
if (object != null) {
|
||||
|
||||
@@ -89,140 +89,140 @@ public class ResolutionTask<D extends CallableDescriptor> extends ResolutionCont
|
||||
public interface DescriptorCheckStrategy {
|
||||
<D extends CallableDescriptor> boolean performAdvancedChecks(D descriptor, BindingTrace trace, TracingStrategy tracing);
|
||||
}
|
||||
|
||||
|
||||
public final TracingStrategy tracing = new TracingStrategy() {
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void bindReference(@NotNull BindingTrace trace, @NotNull ResolvedCallImpl<D> resolvedCall) {
|
||||
D descriptor = resolvedCall.getCandidateDescriptor();
|
||||
// if (descriptor instanceof VariableAsFunctionDescriptor) {
|
||||
// VariableAsFunctionDescriptor variableAsFunctionDescriptor = (VariableAsFunctionDescriptor) descriptor;
|
||||
// trace.record(REFERENCE_TARGET, reference, variableAsFunctionDescriptor.getVariableDescriptor());
|
||||
// }
|
||||
// else {
|
||||
// }
|
||||
trace.record(RESOLVED_CALL, call.getCalleeExpression(), resolvedCall);
|
||||
trace.record(REFERENCE_TARGET, reference, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void recordAmbiguity(BindingTrace trace, Collection<ResolvedCallImpl<D>> candidates) {
|
||||
Collection<D> descriptors = Sets.newHashSet();
|
||||
for (ResolvedCallImpl<D> candidate : candidates) {
|
||||
descriptors.add(candidate.getCandidateDescriptor());
|
||||
}
|
||||
trace.record(AMBIGUOUS_REFERENCE_TARGET, reference, descriptors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unresolvedReference(@NotNull BindingTrace trace) {
|
||||
trace.report(UNRESOLVED_REFERENCE.on(reference));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noValueForParameter(@NotNull BindingTrace trace, @NotNull ValueParameterDescriptor valueParameter) {
|
||||
PsiElement reportOn;
|
||||
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
|
||||
if (valueArgumentList != null) {
|
||||
reportOn = valueArgumentList;
|
||||
}
|
||||
else {
|
||||
reportOn = reference;
|
||||
}
|
||||
trace.report(NO_VALUE_FOR_PARAMETER.on(reportOn, valueParameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void missingReceiver(@NotNull BindingTrace trace, @NotNull ReceiverDescriptor expectedReceiver) {
|
||||
trace.report(MISSING_RECEIVER.on(reference, expectedReceiver.getType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrongReceiverType(@NotNull BindingTrace trace, @NotNull ReceiverDescriptor receiverParameter, @NotNull ReceiverDescriptor receiverArgument) {
|
||||
if (receiverArgument instanceof ExpressionReceiver) {
|
||||
ExpressionReceiver expressionReceiver = (ExpressionReceiver) receiverArgument;
|
||||
trace.report(TYPE_MISMATCH.on(expressionReceiver.getExpression(), receiverParameter.getType(), receiverArgument.getType()));
|
||||
}
|
||||
else {
|
||||
trace.report(TYPE_MISMATCH.on(reference, receiverParameter.getType(), receiverArgument.getType()));
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void bindReference(@NotNull BindingTrace trace, @NotNull ResolvedCallImpl<D> resolvedCall) {
|
||||
D descriptor = resolvedCall.getCandidateDescriptor();
|
||||
// if (descriptor instanceof VariableAsFunctionDescriptor) {
|
||||
// VariableAsFunctionDescriptor variableAsFunctionDescriptor = (VariableAsFunctionDescriptor) descriptor;
|
||||
// trace.record(REFERENCE_TARGET, reference, variableAsFunctionDescriptor.getVariableDescriptor());
|
||||
// }
|
||||
// else {
|
||||
// }
|
||||
trace.record(RESOLVED_CALL, call.getCalleeExpression(), resolvedCall);
|
||||
trace.record(REFERENCE_TARGET, reference, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void recordAmbiguity(BindingTrace trace, Collection<ResolvedCallImpl<D>> candidates) {
|
||||
Collection<D> descriptors = Sets.newHashSet();
|
||||
for (ResolvedCallImpl<D> candidate : candidates) {
|
||||
descriptors.add(candidate.getCandidateDescriptor());
|
||||
}
|
||||
trace.record(AMBIGUOUS_REFERENCE_TARGET, reference, descriptors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unresolvedReference(@NotNull BindingTrace trace) {
|
||||
trace.report(UNRESOLVED_REFERENCE.on(reference));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noValueForParameter(@NotNull BindingTrace trace, @NotNull ValueParameterDescriptor valueParameter) {
|
||||
PsiElement reportOn;
|
||||
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
|
||||
if (valueArgumentList != null) {
|
||||
reportOn = valueArgumentList;
|
||||
}
|
||||
else {
|
||||
reportOn = reference;
|
||||
}
|
||||
trace.report(NO_VALUE_FOR_PARAMETER.on(reportOn, valueParameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void missingReceiver(@NotNull BindingTrace trace, @NotNull ReceiverDescriptor expectedReceiver) {
|
||||
trace.report(MISSING_RECEIVER.on(reference, expectedReceiver.getType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrongReceiverType(@NotNull BindingTrace trace, @NotNull ReceiverDescriptor receiverParameter, @NotNull ReceiverDescriptor receiverArgument) {
|
||||
if (receiverArgument instanceof ExpressionReceiver) {
|
||||
ExpressionReceiver expressionReceiver = (ExpressionReceiver)receiverArgument;
|
||||
trace.report(TYPE_MISMATCH.on(expressionReceiver.getExpression(), receiverParameter.getType(), receiverArgument.getType()));
|
||||
}
|
||||
else {
|
||||
trace.report(TYPE_MISMATCH.on(reference, receiverParameter.getType(), receiverArgument.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noReceiverAllowed(@NotNull BindingTrace trace) {
|
||||
trace.report(NO_RECEIVER_ADMITTED.on(reference));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrongNumberOfTypeArguments(@NotNull BindingTrace trace, int expectedTypeArgumentCount) {
|
||||
JetTypeArgumentList typeArgumentList = call.getTypeArgumentList();
|
||||
if (typeArgumentList != null) {
|
||||
trace.report(WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(typeArgumentList, expectedTypeArgumentCount));
|
||||
}
|
||||
else {
|
||||
trace.report(WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(reference, expectedTypeArgumentCount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void ambiguity(@NotNull BindingTrace trace, @NotNull Collection<ResolvedCallImpl<D>> descriptors) {
|
||||
trace.report(OVERLOAD_RESOLUTION_AMBIGUITY.on(call.getCallElement(), descriptors));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void noneApplicable(@NotNull BindingTrace trace, @NotNull Collection<ResolvedCallImpl<D>> descriptors) {
|
||||
trace.report(NONE_APPLICABLE.on(reference, descriptors));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instantiationOfAbstractClass(@NotNull BindingTrace trace) {
|
||||
trace.report(CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS.on(call.getCallElement()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void typeInferenceFailed(@NotNull BindingTrace trace, SolutionStatus status) {
|
||||
assert !status.isSuccessful();
|
||||
trace.report(TYPE_INFERENCE_FAILED.on(call.getCallElement(), status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsafeCall(@NotNull BindingTrace trace, @NotNull JetType type) {
|
||||
ASTNode callOperationNode = call.getCallOperationNode();
|
||||
if (callOperationNode != null) {
|
||||
trace.report(UNSAFE_CALL.on(callOperationNode.getPsi(), type));
|
||||
}
|
||||
else {
|
||||
PsiElement callElement = call.getCallElement();
|
||||
if (callElement instanceof JetBinaryExpression) {
|
||||
JetBinaryExpression binaryExpression = (JetBinaryExpression)callElement;
|
||||
JetSimpleNameExpression operationReference = binaryExpression.getOperationReference();
|
||||
|
||||
String operationString = operationReference.getReferencedNameElementType() == JetTokens.IDENTIFIER ?
|
||||
operationReference.getText() :
|
||||
OperatorConventions.getNameForOperationSymbol((JetToken)operationReference.getReferencedNameElementType());
|
||||
|
||||
JetExpression right = binaryExpression.getRight();
|
||||
if (right != null) {
|
||||
trace.report(UNSAFE_INFIX_CALL.on(reference, binaryExpression.getLeft().getText(), operationString, right.getText()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noReceiverAllowed(@NotNull BindingTrace trace) {
|
||||
trace.report(NO_RECEIVER_ADMITTED.on(reference));
|
||||
else {
|
||||
trace.report(UNSAFE_CALL.on(reference, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrongNumberOfTypeArguments(@NotNull BindingTrace trace, int expectedTypeArgumentCount) {
|
||||
JetTypeArgumentList typeArgumentList = call.getTypeArgumentList();
|
||||
if (typeArgumentList != null) {
|
||||
trace.report(WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(typeArgumentList, expectedTypeArgumentCount));
|
||||
}
|
||||
else {
|
||||
trace.report(WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(reference, expectedTypeArgumentCount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void ambiguity(@NotNull BindingTrace trace, @NotNull Collection<ResolvedCallImpl<D>> descriptors) {
|
||||
trace.report(OVERLOAD_RESOLUTION_AMBIGUITY.on(call.getCallElement(), descriptors));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void noneApplicable(@NotNull BindingTrace trace, @NotNull Collection<ResolvedCallImpl<D>> descriptors) {
|
||||
trace.report(NONE_APPLICABLE.on(reference, descriptors));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instantiationOfAbstractClass(@NotNull BindingTrace trace) {
|
||||
trace.report(CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS.on(call.getCallElement()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void typeInferenceFailed(@NotNull BindingTrace trace, SolutionStatus status) {
|
||||
assert !status.isSuccessful();
|
||||
trace.report(TYPE_INFERENCE_FAILED.on(call.getCallElement(), status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsafeCall(@NotNull BindingTrace trace, @NotNull JetType type) {
|
||||
ASTNode callOperationNode = call.getCallOperationNode();
|
||||
if (callOperationNode != null) {
|
||||
trace.report(UNSAFE_CALL.on(callOperationNode.getPsi(), type));
|
||||
}
|
||||
else {
|
||||
PsiElement callElement = call.getCallElement();
|
||||
if (callElement instanceof JetBinaryExpression) {
|
||||
JetBinaryExpression binaryExpression = (JetBinaryExpression) callElement;
|
||||
JetSimpleNameExpression operationReference = binaryExpression.getOperationReference();
|
||||
|
||||
String operationString = operationReference.getReferencedNameElementType() == JetTokens.IDENTIFIER ?
|
||||
operationReference.getText() :
|
||||
OperatorConventions.getNameForOperationSymbol((JetToken) operationReference.getReferencedNameElementType());
|
||||
|
||||
JetExpression right = binaryExpression.getRight();
|
||||
if (right != null) {
|
||||
trace.report(UNSAFE_INFIX_CALL.on(reference, binaryExpression.getLeft().getText(), operationString, right.getText()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
trace.report(UNSAFE_CALL.on(reference, type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unnecessarySafeCall(@NotNull BindingTrace trace, @NotNull JetType type) {
|
||||
ASTNode callOperationNode = call.getCallOperationNode();
|
||||
assert callOperationNode != null;
|
||||
trace.report(UNNECESSARY_SAFE_CALL.on(callOperationNode.getPsi(), type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void danglingFunctionLiteralArgumentSuspected(@NotNull BindingTrace trace, @NotNull List<JetExpression> functionLiteralArguments) {
|
||||
for (JetExpression functionLiteralArgument : functionLiteralArguments) {
|
||||
trace.report(DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED.on(functionLiteralArgument));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unnecessarySafeCall(@NotNull BindingTrace trace, @NotNull JetType type) {
|
||||
ASTNode callOperationNode = call.getCallOperationNode();
|
||||
assert callOperationNode != null;
|
||||
trace.report(UNNECESSARY_SAFE_CALL.on(callOperationNode.getPsi(), type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void danglingFunctionLiteralArgumentSuspected(@NotNull BindingTrace trace, @NotNull List<JetExpression> functionLiteralArguments) {
|
||||
for (JetExpression functionLiteralArgument : functionLiteralArguments) {
|
||||
trace.report(DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED.on(functionLiteralArgument));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ public class DataFlowValueFactory {
|
||||
}
|
||||
|
||||
private static boolean isInternal(@NotNull DeclarationDescriptorWithVisibility descriptor) {
|
||||
if (Visibility.INTERNAL_VISIBILITIES.contains(descriptor.getVisibility())) return true;
|
||||
if (Visibilities.INTERNAL_VISIBILITIES.contains(descriptor.getVisibility())) return true;
|
||||
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
if (!(containingDeclaration instanceof DeclarationDescriptorWithVisibility)) {
|
||||
|
||||
@@ -153,7 +153,7 @@ public class ErrorUtils {
|
||||
ERROR_CLASS,
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
Modality.OPEN,
|
||||
Visibility.INTERNAL,
|
||||
Visibilities.INTERNAL,
|
||||
true,
|
||||
false,
|
||||
null,
|
||||
@@ -172,7 +172,7 @@ public class ErrorUtils {
|
||||
Collections.<ValueParameterDescriptor>emptyList(), // TODO
|
||||
createErrorType("<ERROR FUNCTION RETURN TYPE>"),
|
||||
Modality.OPEN,
|
||||
Visibility.INTERNAL,
|
||||
Visibilities.INTERNAL,
|
||||
/*isInline = */ false
|
||||
);
|
||||
return function;
|
||||
@@ -183,7 +183,7 @@ public class ErrorUtils {
|
||||
r.initialize(
|
||||
Collections.<TypeParameterDescriptor>emptyList(), // TODO
|
||||
Collections.<ValueParameterDescriptor>emptyList(), // TODO
|
||||
Visibility.INTERNAL
|
||||
Visibilities.INTERNAL
|
||||
);
|
||||
r.setReturnType(createErrorType("<ERROR RETURN TYPE>"));
|
||||
return r;
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
valueParameterDescriptors,
|
||||
/*unsubstitutedReturnType = */ null,
|
||||
Modality.FINAL,
|
||||
Visibility.LOCAL,
|
||||
Visibilities.LOCAL,
|
||||
/*isInline = */ false
|
||||
);
|
||||
context.trace.record(BindingContext.FUNCTION, expression, functionDescriptor);
|
||||
|
||||
@@ -155,9 +155,9 @@ public class JetStandardClasses {
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
true, Variance.OUT_VARIANCE, "T" + (j + 1), j);
|
||||
parameters.add(typeParameterDescriptor);
|
||||
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(classDescriptor, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibility.PUBLIC, false, false, "_" + (j + 1), CallableMemberDescriptor.Kind.DECLARATION);
|
||||
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(classDescriptor, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC, false, false, "_" + (j + 1), CallableMemberDescriptor.Kind.DECLARATION);
|
||||
propertyDescriptor.setType(typeParameterDescriptor.getDefaultType(), Collections.<TypeParameterDescriptor>emptyList(), classDescriptor.getImplicitReceiver(), ReceiverDescriptor.NO_RECEIVER);
|
||||
PropertyGetterDescriptor getterDescriptor = new PropertyGetterDescriptor(propertyDescriptor, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibility.PUBLIC, false, true, CallableMemberDescriptor.Kind.DECLARATION);
|
||||
PropertyGetterDescriptor getterDescriptor = new PropertyGetterDescriptor(propertyDescriptor, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC, false, true, CallableMemberDescriptor.Kind.DECLARATION);
|
||||
getterDescriptor.initialize(typeParameterDescriptor.getDefaultType());
|
||||
propertyDescriptor.initialize(getterDescriptor, null);
|
||||
writableScope.addPropertyDescriptor(propertyDescriptor);
|
||||
|
||||
Reference in New Issue
Block a user