Renamed method and got rid of some usages.
This commit is contained in:
@@ -23,7 +23,6 @@ import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.MutableClassDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.JetTypeImpl;
|
||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||
@@ -140,11 +139,10 @@ public class FunctionTypesUtil {
|
||||
|
||||
@NotNull
|
||||
private static ClassDescriptor createFunctionImplDescriptor(@NotNull Name name, @NotNull ClassDescriptor functionInterface) {
|
||||
JetScope builtInsScope = KotlinBuiltIns.getInstance().getBuiltInsScope();
|
||||
|
||||
PackageFragmentDescriptor builtinsFragment = KotlinBuiltIns.getInstance().getBuiltInsPackageFragment();
|
||||
MutableClassDescriptor functionImpl = new MutableClassDescriptor(
|
||||
KotlinBuiltIns.getInstance().getBuiltInsPackageFragment(),
|
||||
builtInsScope,
|
||||
builtinsFragment,
|
||||
builtinsFragment.getMemberScope(),
|
||||
ClassKind.CLASS,
|
||||
false,
|
||||
name
|
||||
|
||||
@@ -105,7 +105,7 @@ public class RangeCodegenUtil {
|
||||
) {
|
||||
ClassifierDescriptor declarationDescriptor = rangeOrProgression.getConstructor().getDeclarationDescriptor();
|
||||
assert declarationDescriptor != null;
|
||||
if (declarationDescriptor != KotlinBuiltIns.getInstance().getBuiltInsScope().getClassifier(declarationDescriptor.getName())) {
|
||||
if (declarationDescriptor != KotlinBuiltIns.getInstance().getBuiltInsPackageScope().getClassifier(declarationDescriptor.getName())) {
|
||||
// Must be a standard library class
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class BuiltinsDeserializationTest extends KotlinTestWithEnvironment {
|
||||
}
|
||||
|
||||
public void testBuiltIns() throws Exception {
|
||||
Collection<DeclarationDescriptor> allDescriptors = KotlinBuiltIns.getInstance().getBuiltInsScope().getAllDescriptors();
|
||||
Collection<DeclarationDescriptor> allDescriptors = KotlinBuiltIns.getInstance().getBuiltInsPackageScope().getAllDescriptors();
|
||||
PackageFragmentDescriptor actualPackage = getDeserializedDescriptorsAsPackage(allDescriptors);
|
||||
|
||||
RecursiveDescriptorComparator.Configuration configuration = RecursiveDescriptorComparator.RECURSIVE.withRenderer(
|
||||
|
||||
@@ -254,7 +254,7 @@ public abstract class ExpectedResolveData {
|
||||
|
||||
JetType actualType = bindingContext.get(BindingContext.TYPE, typeReference);
|
||||
assertNotNull("Type " + name + " not resolved for reference " + name, actualType);
|
||||
ClassifierDescriptor expectedClass = builtIns.getBuiltInsScope().getClassifier(Name.identifier(name.substring(STANDARD_PREFIX.length())));
|
||||
ClassifierDescriptor expectedClass = builtIns.getBuiltInClassByName(Name.identifier(name.substring(STANDARD_PREFIX.length())));
|
||||
assertNotNull("Expected class not found: " + name);
|
||||
assertSame("Type resolution mismatch: ", expectedClass.getTypeConstructor(), actualType.getConstructor());
|
||||
continue;
|
||||
@@ -311,7 +311,7 @@ public abstract class ExpectedResolveData {
|
||||
TypeConstructor expectedTypeConstructor;
|
||||
if (typeName.startsWith(STANDARD_PREFIX)) {
|
||||
String name = typeName.substring(STANDARD_PREFIX.length());
|
||||
ClassifierDescriptor expectedClass = builtIns.getBuiltInsScope().getClassifier(Name.identifier(name));
|
||||
ClassifierDescriptor expectedClass = builtIns.getBuiltInClassByName(Name.identifier(name));
|
||||
|
||||
assertNotNull("Expected class not found: " + typeName, expectedClass);
|
||||
expectedTypeConstructor = expectedClass.getTypeConstructor();
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
InjectorForTests injector = new InjectorForTests(getProject(), root);
|
||||
KotlinBuiltIns builtIns = injector.getKotlinBuiltIns();
|
||||
descriptorResolver = injector.getDescriptorResolver();
|
||||
scope = createScope(builtIns.getBuiltInsScope());
|
||||
scope = createScope(builtIns.getBuiltInsPackageScope());
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
@@ -182,7 +182,7 @@ public class JetOverloadTest extends JetLiteFixture {
|
||||
|
||||
private FunctionDescriptor makeFunction(String funDecl) {
|
||||
JetNamedFunction function = JetPsiFactory.createFunction(getProject(), funDecl);
|
||||
return descriptorResolver.resolveFunctionDescriptor(root, builtIns.getBuiltInsScope(), function,
|
||||
return descriptorResolver.resolveFunctionDescriptor(root, builtIns.getBuiltInsPackageScope(), function,
|
||||
JetTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class JetOverridingTest extends JetLiteFixture {
|
||||
|
||||
private FunctionDescriptor makeFunction(String funDecl) {
|
||||
JetNamedFunction function = JetPsiFactory.createFunction(getProject(), funDecl);
|
||||
return descriptorResolver.resolveFunctionDescriptor(root, builtIns.getBuiltInsScope(), function,
|
||||
return descriptorResolver.resolveFunctionDescriptor(root, builtIns.getBuiltInsPackageScope(), function,
|
||||
JetTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
||||
topLevelDeclarations,
|
||||
typeParameters,
|
||||
contextClass.getDefaultType().getMemberScope(),
|
||||
KotlinBuiltIns.getInstance().getBuiltInsScope());
|
||||
KotlinBuiltIns.getInstance().getBuiltInsPackageScope());
|
||||
}
|
||||
|
||||
private void doTest(@Nullable String expectedTypeStr, String initialTypeStr, Pair<String, String>... substitutionStrs) {
|
||||
|
||||
@@ -198,7 +198,7 @@ public class TypeUnifierTest extends JetLiteFixture {
|
||||
}
|
||||
|
||||
private TypeProjection makeType(String typeStr) {
|
||||
return makeTypeProjection(builtIns.getBuiltInsScope(), typeStr);
|
||||
return makeTypeProjection(builtIns.getBuiltInsPackageScope(), typeStr);
|
||||
}
|
||||
|
||||
private TypeProjection makeTypeProjection(JetScope scope, String typeStr) {
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ public final class JavaClassResolver {
|
||||
List<Name> segments = qualifiedName.pathSegments();
|
||||
if (segments.size() < 2) return null;
|
||||
|
||||
JetScope scope = KotlinBuiltIns.getInstance().getBuiltInsScope();
|
||||
JetScope scope = KotlinBuiltIns.getInstance().getBuiltInsPackageScope();
|
||||
for (int i = 1, size = segments.size(); i < size; i++) {
|
||||
ClassifierDescriptor classifier = scope.getClassifier(segments.get(i));
|
||||
if (classifier == null) return null;
|
||||
|
||||
@@ -227,9 +227,8 @@ public class KotlinBuiltIns {
|
||||
return builtInsModule.getPackageFragmentProvider().getPackageFragments(BUILT_INS_PACKAGE_FQ_NAME).get(0);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public JetScope getBuiltInsScope() { // TODO 1 scope?
|
||||
public JetScope getBuiltInsPackageScope() {
|
||||
return getBuiltInsPackageFragment().getMemberScope();
|
||||
}
|
||||
|
||||
@@ -241,7 +240,7 @@ public class KotlinBuiltIns {
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getBuiltInClassByName(@NotNull Name simpleName) {
|
||||
ClassifierDescriptor classifier = getBuiltInsScope().getClassifier(simpleName);
|
||||
ClassifierDescriptor classifier = getBuiltInsPackageFragment().getMemberScope().getClassifier(simpleName);
|
||||
assert classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + classifier;
|
||||
return (ClassDescriptor) classifier;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ fun generate(): String {
|
||||
|
||||
val builtIns = KotlinBuiltIns.getInstance()
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
val allPrimitiveTypes = builtIns.getBuiltInsPackage().getMemberScope().getAllDescriptors()
|
||||
val allPrimitiveTypes = builtIns.getBuiltInsPackageScope().getAllDescriptors()
|
||||
.filter { it is ClassDescriptor && builtIns.isPrimitiveType(it.getDefaultType()) } as List<ClassDescriptor>
|
||||
|
||||
for (descriptor in allPrimitiveTypes + builtIns.getString()) {
|
||||
|
||||
Reference in New Issue
Block a user