JetScope.get* return Collection, not Set
This commit is contained in:
@@ -220,7 +220,7 @@ public class IntrinsicMethods {
|
|||||||
|
|
||||||
private void declareIntrinsicProperty(Name className, Name methodName, IntrinsicMethod implementation) {
|
private void declareIntrinsicProperty(Name className, Name methodName, IntrinsicMethod implementation) {
|
||||||
final JetScope numberScope = getClassMemberScope(className);
|
final JetScope numberScope = getClassMemberScope(className);
|
||||||
Set<VariableDescriptor> properties = numberScope.getProperties(methodName);
|
Collection<VariableDescriptor> properties = numberScope.getProperties(methodName);
|
||||||
assert properties.size() == 1;
|
assert properties.size() == 1;
|
||||||
final VariableDescriptor property = properties.iterator().next();
|
final VariableDescriptor property = properties.iterator().next();
|
||||||
myMethods.put(property.getOriginal(), implementation);
|
myMethods.put(property.getOriginal(), implementation);
|
||||||
@@ -228,7 +228,7 @@ public class IntrinsicMethods {
|
|||||||
|
|
||||||
private void declareIntrinsicFunction(Name className, Name functionName, int arity, IntrinsicMethod implementation, boolean original) {
|
private void declareIntrinsicFunction(Name className, Name functionName, int arity, IntrinsicMethod implementation, boolean original) {
|
||||||
JetScope memberScope = getClassMemberScope(className);
|
JetScope memberScope = getClassMemberScope(className);
|
||||||
final Set<FunctionDescriptor> group = memberScope.getFunctions(functionName);
|
final Collection<FunctionDescriptor> group = memberScope.getFunctions(functionName);
|
||||||
for (FunctionDescriptor descriptor : group) {
|
for (FunctionDescriptor descriptor : group) {
|
||||||
if (className.equals(descriptor.getContainingDeclaration().getName()) && descriptor.getValueParameters().size() == arity) {
|
if (className.equals(descriptor.getContainingDeclaration().getName()) && descriptor.getValueParameters().size() == arity) {
|
||||||
myMethods.put(original ? descriptor.getOriginal() : descriptor, implementation);
|
myMethods.put(original ? descriptor.getOriginal() : descriptor, implementation);
|
||||||
@@ -236,7 +236,7 @@ public class IntrinsicMethods {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void declareOverload(Set<FunctionDescriptor> group, int arity, IntrinsicMethod implementation) {
|
private void declareOverload(Collection<FunctionDescriptor> group, int arity, IntrinsicMethod implementation) {
|
||||||
for (FunctionDescriptor descriptor : group) {
|
for (FunctionDescriptor descriptor : group) {
|
||||||
if (descriptor.getValueParameters().size() == arity) {
|
if (descriptor.getValueParameters().size() == arity) {
|
||||||
myMethods.put(descriptor.getOriginal(), implementation);
|
myMethods.put(descriptor.getOriginal(), implementation);
|
||||||
|
|||||||
+2
-2
@@ -57,13 +57,13 @@ public abstract class JavaClassOrPackageScope extends JetScopeImpl {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
return semanticServices.getDescriptorResolver().resolveFieldGroupByName(name, resolverScopeData);
|
return semanticServices.getDescriptorResolver().resolveFieldGroupByName(name, resolverScopeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
return semanticServices.getDescriptorResolver().resolveFunctionGroup(name, resolverScopeData);
|
return semanticServices.getDescriptorResolver().resolveFunctionGroup(name, resolverScopeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
|||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ public class WhenChecker {
|
|||||||
ClassDescriptor classObjectDescriptor = classDescriptor.getClassObjectDescriptor();
|
ClassDescriptor classObjectDescriptor = classDescriptor.getClassObjectDescriptor();
|
||||||
assert classObjectDescriptor != null;
|
assert classObjectDescriptor != null;
|
||||||
JetScope memberScope = classObjectDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
JetScope memberScope = classObjectDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||||
Set<ClassDescriptor> objectDescriptors = memberScope.getObjectDescriptors();
|
Collection<ClassDescriptor> objectDescriptors = memberScope.getObjectDescriptors();
|
||||||
boolean isExhaust = true;
|
boolean isExhaust = true;
|
||||||
boolean notEmpty = false;
|
boolean notEmpty = false;
|
||||||
for (ClassDescriptor descriptor : objectDescriptors) {
|
for (ClassDescriptor descriptor : objectDescriptors) {
|
||||||
|
|||||||
+1
-1
@@ -142,7 +142,7 @@ public class FunctionDescriptorUtil {
|
|||||||
|
|
||||||
ClassifierDescriptor classDescriptorForFunction = functionType.getConstructor().getDeclarationDescriptor();
|
ClassifierDescriptor classDescriptorForFunction = functionType.getConstructor().getDeclarationDescriptor();
|
||||||
assert classDescriptorForFunction instanceof ClassDescriptor;
|
assert classDescriptorForFunction instanceof ClassDescriptor;
|
||||||
Set<FunctionDescriptor> invokeFunctions = ((ClassDescriptor) classDescriptorForFunction).getMemberScope(functionType.getArguments()).getFunctions(Name.identifier("invoke"));
|
Collection<FunctionDescriptor> invokeFunctions = ((ClassDescriptor) classDescriptorForFunction).getMemberScope(functionType.getArguments()).getFunctions(Name.identifier("invoke"));
|
||||||
assert invokeFunctions.size() == 1;
|
assert invokeFunctions.size() == 1;
|
||||||
return invokeFunctions.iterator().next();
|
return invokeFunctions.iterator().next();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public abstract class AbstractScopeAdapter implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
return getWorkerScope().getFunctions(name);
|
return getWorkerScope().getFunctions(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,13 +70,13 @@ public abstract class AbstractScopeAdapter implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<ClassDescriptor> getObjectDescriptors() {
|
public Collection<ClassDescriptor> getObjectDescriptors() {
|
||||||
return getWorkerScope().getObjectDescriptors();
|
return getWorkerScope().getObjectDescriptors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
return getWorkerScope().getProperties(name);
|
return getWorkerScope().getProperties(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
|||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -206,7 +207,7 @@ public class DescriptorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static VariableDescriptor filterNonExtensionProperty(Set<VariableDescriptor> variables) {
|
public static VariableDescriptor filterNonExtensionProperty(Collection<VariableDescriptor> variables) {
|
||||||
for (VariableDescriptor variable : variables) {
|
for (VariableDescriptor variable : variables) {
|
||||||
if (!variable.getReceiverParameter().exists()) {
|
if (!variable.getReceiverParameter().exists()) {
|
||||||
return variable;
|
return variable;
|
||||||
|
|||||||
+1
-1
@@ -164,7 +164,7 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<ClassDescriptor> getObjectDescriptors() {
|
public Collection<ClassDescriptor> getObjectDescriptors() {
|
||||||
throw new UnsupportedOperationException(); // TODO
|
throw new UnsupportedOperationException(); // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,19 +51,19 @@ public interface JetScope {
|
|||||||
ClassDescriptor getObjectDescriptor(@NotNull Name name);
|
ClassDescriptor getObjectDescriptor(@NotNull Name name);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
Set<ClassDescriptor> getObjectDescriptors();
|
Collection<ClassDescriptor> getObjectDescriptors();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
NamespaceDescriptor getNamespace(@NotNull Name name);
|
NamespaceDescriptor getNamespace(@NotNull Name name);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
Set<VariableDescriptor> getProperties(@NotNull Name name);
|
Collection<VariableDescriptor> getProperties(@NotNull Name name);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
VariableDescriptor getLocalVariable(@NotNull Name name);
|
VariableDescriptor getLocalVariable(@NotNull Name name);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
Set<FunctionDescriptor> getFunctions(@NotNull Name name);
|
Collection<FunctionDescriptor> getFunctions(@NotNull Name name);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
DeclarationDescriptor getContainingDeclaration();
|
DeclarationDescriptor getContainingDeclaration();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public abstract class JetScopeImpl implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public abstract class JetScopeImpl implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class SubstitutingScope implements JetScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private <D extends DeclarationDescriptor> Set<D> substitute(@NotNull Set<D> descriptors) {
|
private <D extends DeclarationDescriptor> Collection<D> substitute(@NotNull Collection<D> descriptors) {
|
||||||
if (substitutor.isEmpty()) return descriptors;
|
if (substitutor.isEmpty()) return descriptors;
|
||||||
if (descriptors.isEmpty()) return descriptors;
|
if (descriptors.isEmpty()) return descriptors;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class SubstitutingScope implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
return substitute(workerScope.getProperties(name));
|
return substitute(workerScope.getProperties(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,13 +104,13 @@ public class SubstitutingScope implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<ClassDescriptor> getObjectDescriptors() {
|
public Collection<ClassDescriptor> getObjectDescriptors() {
|
||||||
return substitute(workerScope.getObjectDescriptors());
|
return substitute(workerScope.getObjectDescriptors());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
return substitute(workerScope.getFunctions(name));
|
return substitute(workerScope.getFunctions(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
checkMayRead();
|
checkMayRead();
|
||||||
|
|
||||||
Set<FunctionDescriptor> result = Sets.newLinkedHashSet(getFunctionGroups().get(name));
|
Set<FunctionDescriptor> result = Sets.newLinkedHashSet(getFunctionGroups().get(name));
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -145,7 +146,7 @@ public abstract class WritableScopeWithImports extends JetScopeAdapter implement
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
checkMayRead();
|
checkMayRead();
|
||||||
|
|
||||||
if (getImports().isEmpty()) {
|
if (getImports().isEmpty()) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class WriteThroughScope extends WritableScopeWithImports {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
checkMayRead();
|
checkMayRead();
|
||||||
|
|
||||||
Set<FunctionDescriptor> result = Sets.newLinkedHashSet();
|
Set<FunctionDescriptor> result = Sets.newLinkedHashSet();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.junit.Assert;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +54,7 @@ public class JavaDescriptorResolverTest extends TestCaseWithTmpdir {
|
|||||||
public void testStaticFinal() throws Exception {
|
public void testStaticFinal() throws Exception {
|
||||||
JavaDescriptorResolver javaDescriptorResolver = compileFileGetJavaDescriptorResolver("staticFinal.java");
|
JavaDescriptorResolver javaDescriptorResolver = compileFileGetJavaDescriptorResolver("staticFinal.java");
|
||||||
NamespaceDescriptor ns = javaDescriptorResolver.resolveNamespace(new FqName("StaticFinal"), DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN);
|
NamespaceDescriptor ns = javaDescriptorResolver.resolveNamespace(new FqName("StaticFinal"), DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN);
|
||||||
Set<VariableDescriptor> foos = ns.getMemberScope().getProperties(Name.identifier("foo"));
|
Collection<VariableDescriptor> foos = ns.getMemberScope().getProperties(Name.identifier("foo"));
|
||||||
Assert.assertEquals(1, foos.size());
|
Assert.assertEquals(1, foos.size());
|
||||||
VariableDescriptor foo = foos.iterator().next();
|
VariableDescriptor foo = foos.iterator().next();
|
||||||
Assert.assertFalse(foo.getType().isNullable());
|
Assert.assertFalse(foo.getType().isNullable());
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ public class NamespaceComparator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Name name : sorted(propertyNames)) {
|
for (Name name : sorted(propertyNames)) {
|
||||||
Set<VariableDescriptor> pa = nsa.getMemberScope().getProperties(name);
|
Collection<VariableDescriptor> pa = nsa.getMemberScope().getProperties(name);
|
||||||
Set<VariableDescriptor> pb = nsb.getMemberScope().getProperties(name);
|
Collection<VariableDescriptor> pb = nsb.getMemberScope().getProperties(name);
|
||||||
compareDeclarationSets("Properties in package " + nsa, pa, pb, sb);
|
compareDeclarationSets("Properties in package " + nsa, pa, pb, sb);
|
||||||
|
|
||||||
Assert.assertTrue(nsb.getMemberScope().getFunctions(Name.identifier(PropertyCodegen.getterName(name))).isEmpty());
|
Assert.assertTrue(nsb.getMemberScope().getFunctions(Name.identifier(PropertyCodegen.getterName(name))).isEmpty());
|
||||||
@@ -153,8 +153,8 @@ public class NamespaceComparator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Name name : sorted(functionNames)) {
|
for (Name name : sorted(functionNames)) {
|
||||||
Set<FunctionDescriptor> fa = nsa.getMemberScope().getFunctions(name);
|
Collection<FunctionDescriptor> fa = nsa.getMemberScope().getFunctions(name);
|
||||||
Set<FunctionDescriptor> fb = nsb.getMemberScope().getFunctions(name);
|
Collection<FunctionDescriptor> fb = nsb.getMemberScope().getFunctions(name);
|
||||||
compareDeclarationSets("Functions in package " + nsa, fa, fb, sb);
|
compareDeclarationSets("Functions in package " + nsa, fa, fb, sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@ public class NamespaceComparator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void compareDeclarationSets(String message,
|
private static void compareDeclarationSets(String message,
|
||||||
Set<? extends DeclarationDescriptor> a,
|
Collection<? extends DeclarationDescriptor> a,
|
||||||
Set<? extends DeclarationDescriptor> b,
|
Collection<? extends DeclarationDescriptor> b,
|
||||||
@NotNull StringBuilder sb) {
|
@NotNull StringBuilder sb) {
|
||||||
String at = serializedDeclarationSets(a);
|
String at = serializedDeclarationSets(a);
|
||||||
String bt = serializedDeclarationSets(b);
|
String bt = serializedDeclarationSets(b);
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
Set<FunctionDescriptor> writableFunctionGroup = Sets.newLinkedHashSet();
|
Set<FunctionDescriptor> writableFunctionGroup = Sets.newLinkedHashSet();
|
||||||
for (String funDecl : FUNCTION_DECLARATIONS) {
|
for (String funDecl : FUNCTION_DECLARATIONS) {
|
||||||
FunctionDescriptor functionDescriptor = descriptorResolver.resolveFunctionDescriptor(this.getContainingDeclaration(), this, JetPsiFactory.createFunction(getProject(), funDecl), JetTestUtils.DUMMY_TRACE);
|
FunctionDescriptor functionDescriptor = descriptorResolver.resolveFunctionDescriptor(this.getContainingDeclaration(), this, JetPsiFactory.createFunction(getProject(), funDecl), JetTestUtils.DUMMY_TRACE);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import org.jetbrains.jet.resolve.DescriptorRenderer;
|
|||||||
import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
|
import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -233,7 +234,7 @@ public class JetSourceNavigationHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getCandidatesFromScope(JetScope scope, Name name) {
|
public Collection<VariableDescriptor> getCandidatesFromScope(JetScope scope, Name name) {
|
||||||
return scope.getProperties(name);
|
return scope.getProperties(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -275,7 +276,7 @@ public class JetSourceNavigationHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getCandidatesFromScope(JetScope scope, Name name) {
|
public Collection<FunctionDescriptor> getCandidatesFromScope(JetScope scope, Name name) {
|
||||||
return scope.getFunctions(name);
|
return scope.getFunctions(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -284,6 +285,6 @@ public class JetSourceNavigationHelper {
|
|||||||
private interface Matcher<Decl extends JetDeclaration, Descr extends CallableDescriptor> {
|
private interface Matcher<Decl extends JetDeclaration, Descr extends CallableDescriptor> {
|
||||||
boolean areSame(Decl declaration, Descr descriptor);
|
boolean areSame(Decl declaration, Descr descriptor);
|
||||||
|
|
||||||
Set<Descr> getCandidatesFromScope(JetScope scope, Name name);
|
Collection<Descr> getCandidatesFromScope(JetScope scope, Name name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public final class JsDescriptorUtils {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static FunctionDescriptor getFunctionByName(@NotNull JetScope scope,
|
public static FunctionDescriptor getFunctionByName(@NotNull JetScope scope,
|
||||||
@NotNull Name name) {
|
@NotNull Name name) {
|
||||||
Set<FunctionDescriptor> functionDescriptors = scope.getFunctions(name);
|
Collection<FunctionDescriptor> functionDescriptors = scope.getFunctions(name);
|
||||||
assert functionDescriptors.size() == 1 :
|
assert functionDescriptors.size() == 1 :
|
||||||
"In scope " + scope + " supposed to be exactly one " + name + " function.\n" +
|
"In scope " + scope + " supposed to be exactly one " + name + " function.\n" +
|
||||||
"Found: " + functionDescriptors.size();
|
"Found: " + functionDescriptors.size();
|
||||||
@@ -83,7 +83,7 @@ public final class JsDescriptorUtils {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static PropertyDescriptor getPropertyByName(@NotNull JetScope scope,
|
public static PropertyDescriptor getPropertyByName(@NotNull JetScope scope,
|
||||||
@NotNull Name name) {
|
@NotNull Name name) {
|
||||||
Set<VariableDescriptor> variables = scope.getProperties(name);
|
Collection<VariableDescriptor> variables = scope.getProperties(name);
|
||||||
assert variables.size() == 1 : "Actual size: " + variables.size();
|
assert variables.size() == 1 : "Actual size: " + variables.size();
|
||||||
VariableDescriptor variable = variables.iterator().next();
|
VariableDescriptor variable = variables.iterator().next();
|
||||||
PropertyDescriptor descriptor = (PropertyDescriptor)variable;
|
PropertyDescriptor descriptor = (PropertyDescriptor)variable;
|
||||||
|
|||||||
Reference in New Issue
Block a user