Remove the annoying misconcetion in the naming.
This commit is contained in:
+3
-4
@@ -22,7 +22,6 @@ import org.jetbrains.jet.lang.psi.JetParameter;
|
||||
import org.jetbrains.jet.lang.resolve.AbstractScopeAdapter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.TraceBasedRedeclarationHandler;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
@@ -39,7 +38,7 @@ import java.util.Set;
|
||||
public class MutableClassDescriptor extends MutableClassDescriptorLite {
|
||||
private final Set<CallableMemberDescriptor> callableMembers = Sets.newHashSet();
|
||||
private final Set<PropertyDescriptor> properties = Sets.newHashSet();
|
||||
private final Set<NamedFunctionDescriptor> functions = Sets.newHashSet();
|
||||
private final Set<SimpleFunctionDescriptor> functions = Sets.newHashSet();
|
||||
|
||||
private final WritableScope scopeForMemberResolution;
|
||||
// This scope contains type parameters but does not contain inner classes
|
||||
@@ -119,7 +118,7 @@ public class MutableClassDescriptor extends MutableClassDescriptorLite {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
super.addFunctionDescriptor(functionDescriptor);
|
||||
functions.add(functionDescriptor);
|
||||
callableMembers.add(functionDescriptor);
|
||||
@@ -127,7 +126,7 @@ public class MutableClassDescriptor extends MutableClassDescriptorLite {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<NamedFunctionDescriptor> getFunctions() {
|
||||
public Set<SimpleFunctionDescriptor> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -252,7 +252,7 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
getScopeForMemberLookupAsWritableScope().addFunctionDescriptor(functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
memberScope.addFunctionDescriptor(functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public interface NamespaceLike extends DeclarationDescriptor {
|
||||
|
||||
void addObjectDescriptor(@NotNull MutableClassDescriptorLite objectDescriptor);
|
||||
|
||||
void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor);
|
||||
void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor);
|
||||
|
||||
void addPropertyDescriptor(@NotNull PropertyDescriptor propertyDescriptor);
|
||||
|
||||
|
||||
+4
-4
@@ -19,17 +19,17 @@ package org.jetbrains.jet.lang.descriptors;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* ... and also a closure
|
||||
* Simple functions are the ones with 'fun' keyword and function literals
|
||||
*
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public interface NamedFunctionDescriptor extends FunctionDescriptor {
|
||||
public interface SimpleFunctionDescriptor extends FunctionDescriptor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
NamedFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides);
|
||||
SimpleFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
NamedFunctionDescriptor getOriginal();
|
||||
SimpleFunctionDescriptor getOriginal();
|
||||
}
|
||||
+10
-10
@@ -29,9 +29,9 @@ import java.util.List;
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implements NamedFunctionDescriptor {
|
||||
public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl implements SimpleFunctionDescriptor {
|
||||
|
||||
public NamedFunctionDescriptorImpl(
|
||||
public SimpleFunctionDescriptorImpl(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull String name,
|
||||
@@ -39,9 +39,9 @@ public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implemen
|
||||
super(containingDeclaration, annotations, name, kind);
|
||||
}
|
||||
|
||||
private NamedFunctionDescriptorImpl(
|
||||
private SimpleFunctionDescriptorImpl(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull NamedFunctionDescriptor original,
|
||||
@NotNull SimpleFunctionDescriptor original,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull String name,
|
||||
Kind kind) {
|
||||
@@ -55,14 +55,14 @@ public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implemen
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamedFunctionDescriptor getOriginal() {
|
||||
return (NamedFunctionDescriptor) super.getOriginal();
|
||||
public SimpleFunctionDescriptor getOriginal() {
|
||||
return (SimpleFunctionDescriptor) super.getOriginal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy(DeclarationDescriptor newOwner, boolean preserveOriginal, Kind kind) {
|
||||
if (preserveOriginal) {
|
||||
return new NamedFunctionDescriptorImpl(
|
||||
return new SimpleFunctionDescriptorImpl(
|
||||
newOwner,
|
||||
getOriginal(),
|
||||
// TODO : safeSubstitute
|
||||
@@ -70,7 +70,7 @@ public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implemen
|
||||
getName(),
|
||||
kind);
|
||||
} else {
|
||||
return new NamedFunctionDescriptorImpl(
|
||||
return new SimpleFunctionDescriptorImpl(
|
||||
newOwner,
|
||||
// TODO : safeSubstitute
|
||||
getAnnotations(),
|
||||
@@ -81,7 +81,7 @@ public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implemen
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamedFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides) {
|
||||
return (NamedFunctionDescriptor) doSubstitute(TypeSubstitutor.EMPTY, newOwner, DescriptorUtils.convertModality(modality, makeNonAbstract), false, copyOverrides, kind);
|
||||
public SimpleFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides) {
|
||||
return (SimpleFunctionDescriptor) doSubstitute(TypeSubstitutor.EMPTY, newOwner, DescriptorUtils.convertModality(modality, makeNonAbstract), false, copyOverrides, kind);
|
||||
}
|
||||
}
|
||||
@@ -146,11 +146,11 @@ public interface Errors {
|
||||
return super.on(elementToBlame, nodeToMark, s, classDescriptor, modifierListOwner).add(DiagnosticParameters.CLASS, modifierListOwner);
|
||||
}
|
||||
};
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "A function {0} with body cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Method {0} without a body must be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetModifierListOwner, NamedFunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} is not a class or trait member and cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "A function {0} with body cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Method {0} without a body must be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetModifierListOwner, SimpleFunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} is not a class or trait member and cannot be abstract");
|
||||
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} must have a body");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} must have a body");
|
||||
|
||||
DiagnosticWithParameterFactory<JetNamedDeclaration, JetClass> NON_FINAL_MEMBER_IN_FINAL_CLASS = DiagnosticWithParameterFactory.create(ERROR, "Non final member in a final class", DiagnosticParameters.CLASS);
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class AnalyzingUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
scope.addFunctionDescriptor(functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public interface BindingContext {
|
||||
WritableSlice<PsiElement, NamespaceDescriptor> NAMESPACE = Slices.<PsiElement, NamespaceDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ClassDescriptor> CLASS = Slices.<PsiElement, ClassDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetTypeParameter, TypeParameterDescriptor> TYPE_PARAMETER = Slices.<JetTypeParameter, TypeParameterDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, NamedFunctionDescriptor> FUNCTION = Slices.<PsiElement, NamedFunctionDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, SimpleFunctionDescriptor> FUNCTION = Slices.<PsiElement, SimpleFunctionDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ConstructorDescriptor> CONSTRUCTOR = Slices.<PsiElement, ConstructorDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, VariableDescriptor> VARIABLE = Slices.<PsiElement, VariableDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetParameter, VariableDescriptor> VALUE_PARAMETER = Slices.<JetParameter, VariableDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
|
||||
@@ -482,9 +482,9 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
private void resolveFunctionBodies() {
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : this.context.getFunctions().entrySet()) {
|
||||
for (Map.Entry<JetNamedFunction, SimpleFunctionDescriptor> entry : this.context.getFunctions().entrySet()) {
|
||||
JetNamedFunction declaration = entry.getKey();
|
||||
NamedFunctionDescriptor descriptor = entry.getValue();
|
||||
SimpleFunctionDescriptor descriptor = entry.getValue();
|
||||
|
||||
computeDeferredType(descriptor.getReturnType());
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.jet.lang.resolve;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.cfg.JetFlowInformationProvider;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyAccessorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
@@ -51,9 +51,9 @@ public class ControlFlowAnalyzer {
|
||||
if (!context.completeAnalysisNeeded(objectDeclaration)) continue;
|
||||
checkClassOrObject(objectDeclaration);
|
||||
}
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : context.getFunctions().entrySet()) {
|
||||
for (Map.Entry<JetNamedFunction, SimpleFunctionDescriptor> entry : context.getFunctions().entrySet()) {
|
||||
JetNamedFunction function = entry.getKey();
|
||||
NamedFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
SimpleFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
if (!context.completeAnalysisNeeded(function)) continue;
|
||||
final JetType expectedReturnType = !function.hasBlockBody() && !function.hasDeclaredReturnType()
|
||||
? NO_EXPECTED_TYPE
|
||||
|
||||
@@ -120,7 +120,7 @@ public class DeclarationResolver {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
NamedFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(namespaceLike, scopeForFunctions, function);
|
||||
SimpleFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(namespaceLike, scopeForFunctions, function);
|
||||
namespaceLike.addFunctionDescriptor(functionDescriptor);
|
||||
context.getFunctions().put(function, functionDescriptor);
|
||||
context.getDeclaringScopes().put(function, scopeForFunctions);
|
||||
|
||||
@@ -71,10 +71,10 @@ public class DeclarationsChecker {
|
||||
checkObject(objectDeclaration, objectDescriptor);
|
||||
}
|
||||
|
||||
Map<JetNamedFunction, NamedFunctionDescriptor> functions = context.getFunctions();
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : functions.entrySet()) {
|
||||
Map<JetNamedFunction, SimpleFunctionDescriptor> functions = context.getFunctions();
|
||||
for (Map.Entry<JetNamedFunction, SimpleFunctionDescriptor> entry : functions.entrySet()) {
|
||||
JetNamedFunction function = entry.getKey();
|
||||
NamedFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
SimpleFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
|
||||
if (!context.completeAnalysisNeeded(function)) continue;
|
||||
checkFunction(function, functionDescriptor);
|
||||
@@ -246,7 +246,7 @@ public class DeclarationsChecker {
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkFunction(JetNamedFunction function, NamedFunctionDescriptor functionDescriptor) {
|
||||
protected void checkFunction(JetNamedFunction function, SimpleFunctionDescriptor functionDescriptor) {
|
||||
DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration();
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
JetModifierList modifierList = function.getModifierList();
|
||||
|
||||
@@ -62,10 +62,10 @@ public class DelegationResolver {
|
||||
context.getTrace().record(DELEGATED, copy);
|
||||
}
|
||||
}
|
||||
else if (declarationDescriptor instanceof NamedFunctionDescriptor) {
|
||||
NamedFunctionDescriptor functionDescriptor = (NamedFunctionDescriptor) declarationDescriptor;
|
||||
else if (declarationDescriptor instanceof SimpleFunctionDescriptor) {
|
||||
SimpleFunctionDescriptor functionDescriptor = (SimpleFunctionDescriptor) declarationDescriptor;
|
||||
if (functionDescriptor.getModality().isOverridable()) {
|
||||
NamedFunctionDescriptor copy = functionDescriptor.copy(classDescriptor, true, CallableMemberDescriptor.Kind.DELEGATION, true);
|
||||
SimpleFunctionDescriptor copy = functionDescriptor.copy(classDescriptor, true, CallableMemberDescriptor.Kind.DELEGATION, true);
|
||||
classDescriptor.addFunctionDescriptor(copy);
|
||||
context.getTrace().record(DELEGATED, copy);
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ public class DescriptorResolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public NamedFunctionDescriptor resolveFunctionDescriptor(DeclarationDescriptor containingDescriptor, final JetScope scope, final JetNamedFunction function) {
|
||||
final NamedFunctionDescriptorImpl functionDescriptor = new NamedFunctionDescriptorImpl(
|
||||
public SimpleFunctionDescriptor resolveFunctionDescriptor(DeclarationDescriptor containingDescriptor, final JetScope scope, final JetNamedFunction function) {
|
||||
final SimpleFunctionDescriptorImpl functionDescriptor = new SimpleFunctionDescriptorImpl(
|
||||
containingDescriptor,
|
||||
annotationResolver.resolveAnnotations(scope, function.getModifierList()),
|
||||
JetPsiUtil.safeName(function.getName()),
|
||||
|
||||
@@ -187,7 +187,7 @@ public class DescriptorUtils {
|
||||
return descriptor.getName();
|
||||
}
|
||||
|
||||
public static boolean isTopLevelFunction(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public static boolean isTopLevelFunction(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
return functionDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public class OverloadResolver {
|
||||
|
||||
MultiMap<Key, CallableMemberDescriptor> functionsByName = MultiMap.create();
|
||||
|
||||
for (NamedFunctionDescriptor function : context.getFunctions().values()) {
|
||||
for (SimpleFunctionDescriptor function : context.getFunctions().values()) {
|
||||
DeclarationDescriptor containingDeclaration = function.getContainingDeclaration();
|
||||
if (containingDeclaration instanceof NamespaceDescriptor) {
|
||||
NamespaceDescriptor namespaceDescriptor = (NamespaceDescriptor) containingDeclaration;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public class OverloadUtil {
|
||||
private static int braceCount(CallableDescriptor a) {
|
||||
if (a instanceof PropertyDescriptor) {
|
||||
return 0;
|
||||
} else if (a instanceof NamedFunctionDescriptor) {
|
||||
} else if (a instanceof SimpleFunctionDescriptor) {
|
||||
return 1;
|
||||
} else if (a instanceof ConstructorDescriptor) {
|
||||
return 1;
|
||||
|
||||
@@ -106,8 +106,8 @@ public class OverrideResolver {
|
||||
public void addToScope(@NotNull CallableMemberDescriptor fakeOverride) {
|
||||
if (fakeOverride instanceof PropertyDescriptor) {
|
||||
classDescriptor.getScopeForMemberLookupAsWritableScope().addPropertyDescriptor((PropertyDescriptor) fakeOverride);
|
||||
} else if (fakeOverride instanceof NamedFunctionDescriptor) {
|
||||
classDescriptor.getScopeForMemberLookupAsWritableScope().addFunctionDescriptor((NamedFunctionDescriptor) fakeOverride);
|
||||
} else if (fakeOverride instanceof SimpleFunctionDescriptor) {
|
||||
classDescriptor.getScopeForMemberLookupAsWritableScope().addFunctionDescriptor((SimpleFunctionDescriptor) fakeOverride);
|
||||
} else {
|
||||
throw new IllegalStateException(fakeOverride.getClass().getName());
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class OverrideResolver {
|
||||
JetScope scope) {
|
||||
List<CallableMemberDescriptor> r = Lists.newArrayList();
|
||||
for (DeclarationDescriptor decl : scope.getAllDescriptors()) {
|
||||
if (decl instanceof PropertyDescriptor || decl instanceof NamedFunctionDescriptor) {
|
||||
if (decl instanceof PropertyDescriptor || decl instanceof SimpleFunctionDescriptor) {
|
||||
r.add((CallableMemberDescriptor) decl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ import java.util.Set;
|
||||
protected final Map<JetFile, NamespaceDescriptorImpl> namespaceDescriptors = Maps.newHashMap();
|
||||
|
||||
private final Map<JetDeclaration, JetScope> declaringScopes = Maps.newHashMap();
|
||||
private final Map<JetNamedFunction, NamedFunctionDescriptor> functions = Maps.newLinkedHashMap();
|
||||
private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions = Maps.newLinkedHashMap();
|
||||
private final Map<JetSecondaryConstructor, ConstructorDescriptor> constructors = Maps.newLinkedHashMap();
|
||||
private final Map<JetProperty, PropertyDescriptor> properties = Maps.newLinkedHashMap();
|
||||
private final Set<PropertyDescriptor> primaryConstructorParameterProperties = Sets.newHashSet();
|
||||
@@ -154,7 +154,7 @@ import java.util.Set;
|
||||
return declaringScopes;
|
||||
}
|
||||
|
||||
public Map<JetNamedFunction, NamedFunctionDescriptor> getFunctions() {
|
||||
public Map<JetNamedFunction, SimpleFunctionDescriptor> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull SimpleFunctionDescriptor functionDescriptor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.jetbrains.jet.lang.types.error.ErrorNamedFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.types.error.ErrorSimpleFunctionDescriptorImpl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -162,8 +162,8 @@ public class ErrorUtils {
|
||||
CallableMemberDescriptor.Kind.DECLARATION);
|
||||
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
||||
|
||||
private static NamedFunctionDescriptor createErrorFunction(ErrorScope ownerScope) {
|
||||
ErrorNamedFunctionDescriptorImpl function = new ErrorNamedFunctionDescriptorImpl(ownerScope);
|
||||
private static SimpleFunctionDescriptor createErrorFunction(ErrorScope ownerScope) {
|
||||
ErrorSimpleFunctionDescriptorImpl function = new ErrorSimpleFunctionDescriptorImpl(ownerScope);
|
||||
function.initialize(
|
||||
null,
|
||||
ReceiverDescriptor.NO_RECEIVER,
|
||||
|
||||
+5
-8
@@ -17,11 +17,8 @@
|
||||
package org.jetbrains.jet.lang.types.error;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||
|
||||
@@ -30,12 +27,12 @@ import java.util.Collections;
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class ErrorNamedFunctionDescriptorImpl extends NamedFunctionDescriptorImpl {
|
||||
public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorImpl {
|
||||
// used for diagnostic only
|
||||
@NotNull
|
||||
private final ErrorUtils.ErrorScope ownerScope;
|
||||
|
||||
public ErrorNamedFunctionDescriptorImpl(ErrorUtils.ErrorScope ownerScope) {
|
||||
public ErrorSimpleFunctionDescriptorImpl(ErrorUtils.ErrorScope ownerScope) {
|
||||
super(ErrorUtils.getErrorClass(), Collections.<AnnotationDescriptor>emptyList(), "<ERROR FUNCTION>", Kind.DECLARATION);
|
||||
this.ownerScope = ownerScope;
|
||||
}
|
||||
@@ -47,7 +44,7 @@ public class ErrorNamedFunctionDescriptorImpl extends NamedFunctionDescriptorImp
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamedFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides) {
|
||||
public SimpleFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract, Kind kind, boolean copyOverrides) {
|
||||
return this;
|
||||
}
|
||||
|
||||
+3
-3
@@ -84,7 +84,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
JetType expectedType = context.expectedType;
|
||||
boolean functionTypeExpected = expectedType != TypeUtils.NO_EXPECTED_TYPE && JetStandardClasses.isFunctionType(expectedType);
|
||||
|
||||
NamedFunctionDescriptorImpl functionDescriptor = createFunctionDescriptor(expression, context, functionTypeExpected);
|
||||
SimpleFunctionDescriptorImpl functionDescriptor = createFunctionDescriptor(expression, context, functionTypeExpected);
|
||||
|
||||
List<JetType> parameterTypes = Lists.newArrayList();
|
||||
List<ValueParameterDescriptor> valueParameters = functionDescriptor.getValueParameters();
|
||||
@@ -124,10 +124,10 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
return DataFlowUtils.checkType(JetStandardClasses.getFunctionType(Collections.<AnnotationDescriptor>emptyList(), receiver, parameterTypes, safeReturnType), expression, context);
|
||||
}
|
||||
|
||||
private NamedFunctionDescriptorImpl createFunctionDescriptor(JetFunctionLiteralExpression expression, ExpressionTypingContext context, boolean functionTypeExpected) {
|
||||
private SimpleFunctionDescriptorImpl createFunctionDescriptor(JetFunctionLiteralExpression expression, ExpressionTypingContext context, boolean functionTypeExpected) {
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
|
||||
NamedFunctionDescriptorImpl functionDescriptor = new NamedFunctionDescriptorImpl(
|
||||
SimpleFunctionDescriptorImpl functionDescriptor = new SimpleFunctionDescriptorImpl(
|
||||
context.scope.getContainingDeclaration(), Collections.<AnnotationDescriptor>emptyList(), "<anonymous>", CallableMemberDescriptor.Kind.DECLARATION);
|
||||
|
||||
List<ValueParameterDescriptor> valueParameterDescriptors = createValueParameterDescriptors(context, functionLiteral, functionDescriptor, functionTypeExpected);
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
@@ -479,7 +479,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
}
|
||||
else if (element != null) {
|
||||
NamedFunctionDescriptor functionDescriptor = context.trace.get(FUNCTION, element);
|
||||
SimpleFunctionDescriptor functionDescriptor = context.trace.get(FUNCTION, element);
|
||||
if (functionDescriptor != null) {
|
||||
expectedType = DescriptorUtils.getFunctionExpectedReturnType(functionDescriptor, element);
|
||||
if (functionDescriptor != containingFunctionDescriptor) {
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
|
||||
@Override
|
||||
public JetType visitNamedFunction(JetNamedFunction function, ExpressionTypingContext context) {
|
||||
NamedFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(scope.getContainingDeclaration(), scope, function);
|
||||
SimpleFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(scope.getContainingDeclaration(), scope, function);
|
||||
scope.addFunctionDescriptor(functionDescriptor);
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||
context.getServices().checkFunctionReturnType(functionInnerScope, function, functionDescriptor, context.dataFlowInfo);
|
||||
|
||||
Reference in New Issue
Block a user