Drop package facades: code cleanup in Kotlin project.
This commit is contained in:
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.android.tests.OutputUtils;
|
||||
import org.jetbrains.kotlin.android.tests.PathManager;
|
||||
import org.jetbrains.kotlin.android.tests.run.RunResult;
|
||||
import org.jetbrains.kotlin.android.tests.run.RunUtils;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -90,7 +90,7 @@ public class AntRunner {
|
||||
Thread.sleep(20000);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsPackage;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles;
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils;
|
||||
@@ -182,7 +182,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
}
|
||||
Assert.assertTrue("Cannot create directory for compiled files", outputDir.exists());
|
||||
|
||||
OutputUtilsPackage.writeAllTo(outputFiles, outputDir);
|
||||
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,24 +21,23 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
|
||||
public class CodegenUtil {
|
||||
|
||||
private CodegenUtil() {
|
||||
@@ -53,7 +52,7 @@ public class CodegenUtil {
|
||||
) {
|
||||
Collection<FunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getFunctions(name, NoLookupLocation.FROM_BACKEND);
|
||||
for (FunctionDescriptor function : functions) {
|
||||
if (!CallResolverUtilPackage.isOrOverridesSynthesized(function)
|
||||
if (!CallResolverUtilKt.isOrOverridesSynthesized(function)
|
||||
&& function.getTypeParameters().isEmpty()
|
||||
&& valueParameterClassesMatch(function.getValueParameters(), Arrays.asList(valueParameterClassifiers))
|
||||
&& rawTypeMatches(function.getReturnType(), returnedClassifier)) {
|
||||
@@ -67,7 +66,7 @@ public class CodegenUtil {
|
||||
public static PropertyDescriptor getDelegatePropertyIfAny(JetExpression expression, ClassDescriptor classDescriptor, BindingContext bindingContext) {
|
||||
PropertyDescriptor propertyDescriptor = null;
|
||||
if (expression instanceof JetSimpleNameExpression) {
|
||||
ResolvedCall<?> call = CallUtilPackage.getResolvedCall(expression, bindingContext);
|
||||
ResolvedCall<?> call = CallUtilKt.getResolvedCall(expression, bindingContext);
|
||||
if (call != null) {
|
||||
CallableDescriptor callResultingDescriptor = call.getResultingDescriptor();
|
||||
if (callResultingDescriptor instanceof ValueParameterDescriptor) {
|
||||
@@ -100,7 +99,7 @@ public class CodegenUtil {
|
||||
if (!(declaration instanceof CallableMemberDescriptor)) continue;
|
||||
|
||||
CallableMemberDescriptor inheritedMember = (CallableMemberDescriptor) declaration;
|
||||
CallableMemberDescriptor traitMember = BridgesPackage.findTraitImplementation(inheritedMember);
|
||||
CallableMemberDescriptor traitMember = ImplKt.findTraitImplementation(inheritedMember);
|
||||
if (traitMember == null) continue;
|
||||
|
||||
assert traitMember.getModality() != Modality.ABSTRACT : "Cannot delegate to abstract trait method: " + inheritedMember;
|
||||
@@ -171,7 +170,7 @@ public class CodegenUtil {
|
||||
|
||||
public static boolean isEnumValueOfMethod(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
List<ValueParameterDescriptor> methodTypeParameters = functionDescriptor.getValueParameters();
|
||||
JetType nullableString = TypeUtils.makeNullable(getBuiltIns(functionDescriptor).getStringType());
|
||||
JetType nullableString = TypeUtils.makeNullable(DescriptorUtilsKt.getBuiltIns(functionDescriptor).getStringType());
|
||||
return DescriptorUtils.ENUM_VALUE_OF.equals(functionDescriptor.getName())
|
||||
&& methodTypeParameters.size() == 1
|
||||
&& JetTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters.get(0).getType(), nullableString);
|
||||
@@ -187,7 +186,7 @@ public class CodegenUtil {
|
||||
public static Integer getLineNumberForElement(@NotNull PsiElement statement, boolean markEndOffset) {
|
||||
PsiFile file = statement.getContainingFile();
|
||||
if (file instanceof JetFile) {
|
||||
if (PsiPackage.getDoNotAnalyze((JetFile) file) != null) {
|
||||
if (JetPsiFactoryKt.getDoNotAnalyze((JetFile) file) != null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -28,12 +28,11 @@ import org.jetbrains.kotlin.psi.JetParameter;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
|
||||
/**
|
||||
* A platform-independent logic for generating data class synthetic methods.
|
||||
* TODO: data class with zero components gets no toString/equals/hashCode methods. This is inconsistent and should be
|
||||
@@ -49,7 +48,7 @@ public abstract class DataClassMethodGenerator {
|
||||
this.declaration = declaration;
|
||||
this.bindingContext = bindingContext;
|
||||
this.classDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration);
|
||||
this.builtIns = getBuiltIns(classDescriptor);
|
||||
this.builtIns = DescriptorUtilsKt.getBuiltIns(classDescriptor);
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.JetSuperExpression;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
|
||||
public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDescriptor implements AccessorForCallableDescriptor<FunctionDescriptor> {
|
||||
private final FunctionDescriptor calleeDescriptor;
|
||||
@@ -40,7 +40,7 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
|
||||
this.superCallExpression = superCallExpression;
|
||||
|
||||
initialize(DescriptorUtils.getReceiverParameterType(descriptor.getExtensionReceiverParameter()),
|
||||
descriptor instanceof ConstructorDescriptor || AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)
|
||||
descriptor instanceof ConstructorDescriptor || AnnotationUtilKt.isPlatformStaticInObjectOrClass(descriptor)
|
||||
? null
|
||||
: descriptor.getDispatchReceiverParameter(),
|
||||
copyTypeParameters(descriptor),
|
||||
|
||||
@@ -28,18 +28,13 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.resolve.AnnotationChecker;
|
||||
import org.jetbrains.kotlin.resolve.constants.*;
|
||||
import org.jetbrains.kotlin.resolve.constants.StringValue;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.types.Flexibility;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.TypesPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getClassObjectType;
|
||||
|
||||
public abstract class AnnotationCodegen {
|
||||
|
||||
public static final class JvmFlagAnnotation {
|
||||
@@ -175,9 +170,9 @@ public abstract class AnnotationCodegen {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TypesPackage.isFlexible(type)) {
|
||||
if (FlexibleTypesKt.isFlexible(type)) {
|
||||
// A flexible type whose lower bound in not-null and upper bound is nullable, should not be annotated
|
||||
Flexibility flexibility = TypesPackage.flexibility(type);
|
||||
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
|
||||
|
||||
if (!TypeUtils.isNullableType(flexibility.getLowerBound()) && TypeUtils.isNullableType(flexibility.getUpperBound())) {
|
||||
AnnotationDescriptor notNull = type.getAnnotations().findAnnotation(JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
|
||||
@@ -245,7 +240,7 @@ public abstract class AnnotationCodegen {
|
||||
}
|
||||
|
||||
private void generateDocumentedAnnotation(@NotNull ClassDescriptor classDescriptor, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
|
||||
boolean documented = DescriptorUtilPackage.isDocumentedAnnotation(classDescriptor);
|
||||
boolean documented = DescriptorUtilsKt.isDocumentedAnnotation(classDescriptor);
|
||||
if (!documented) return;
|
||||
String descriptor = Type.getType(Documented.class).getDescriptor();
|
||||
if (!annotationDescriptorsAlreadyPresent.add(descriptor)) return;
|
||||
@@ -425,7 +420,7 @@ public abstract class AnnotationCodegen {
|
||||
for (ConstantValue<?> value : values) {
|
||||
if (value instanceof EnumValue) {
|
||||
ClassDescriptor enumEntry = ((EnumValue) value).getValue();
|
||||
JetType classObjectType = getClassObjectType(enumEntry);
|
||||
JetType classObjectType = DescriptorUtilsKt.getClassObjectType(enumEntry);
|
||||
if (classObjectType != null) {
|
||||
if ("java/lang/annotation/ElementType".equals(typeMapper.mapType(classObjectType).getInternalName())) {
|
||||
result.add(ElementType.valueOf(enumEntry.getName().asString()));
|
||||
@@ -442,7 +437,7 @@ public abstract class AnnotationCodegen {
|
||||
|
||||
@NotNull
|
||||
private RetentionPolicy getRetentionPolicy(@NotNull Annotated descriptor) {
|
||||
KotlinRetention retention = DescriptorUtilPackage.getAnnotationRetention(descriptor);
|
||||
KotlinRetention retention = DescriptorUtilsKt.getAnnotationRetention(descriptor);
|
||||
if (retention != null) {
|
||||
return annotationRetentionMap.get(retention);
|
||||
}
|
||||
@@ -453,7 +448,7 @@ public abstract class AnnotationCodegen {
|
||||
ConstantValue<?> compileTimeConstant = valueArguments.iterator().next();
|
||||
if (compileTimeConstant instanceof EnumValue) {
|
||||
ClassDescriptor enumEntry = ((EnumValue) compileTimeConstant).getValue();
|
||||
JetType classObjectType = getClassObjectType(enumEntry);
|
||||
JetType classObjectType = DescriptorUtilsKt.getClassObjectType(enumEntry);
|
||||
if (classObjectType != null) {
|
||||
if ("java/lang/annotation/RetentionPolicy".equals(typeMapper.mapType(classObjectType).getInternalName())) {
|
||||
return RetentionPolicy.valueOf(enumEntry.getName().asString());
|
||||
|
||||
@@ -43,17 +43,16 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.resolve.DeprecationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
import org.jetbrains.kotlin.serialization.jvm.BitEncoding;
|
||||
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.types.FlexibleTypesKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypesPackage;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
@@ -177,7 +176,7 @@ public class AsmUtil {
|
||||
public static boolean isStaticMethod(OwnerKind kind, CallableMemberDescriptor functionDescriptor) {
|
||||
return isStaticKind(kind) ||
|
||||
JetTypeMapper.isStaticAccessor(functionDescriptor) ||
|
||||
AnnotationsPackage.isPlatformStaticInObjectOrClass(functionDescriptor);
|
||||
AnnotationUtilKt.isPlatformStaticInObjectOrClass(functionDescriptor);
|
||||
}
|
||||
|
||||
public static boolean isStaticKind(OwnerKind kind) {
|
||||
@@ -193,7 +192,7 @@ public class AsmUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (AnnotationsPackage.isPlatformStaticInCompanionObject(functionDescriptor)) {
|
||||
if (AnnotationUtilKt.isPlatformStaticInCompanionObject(functionDescriptor)) {
|
||||
// Native method will be a member of the class, the companion object method will be delegated to it
|
||||
flags &= ~Opcodes.ACC_NATIVE;
|
||||
}
|
||||
@@ -666,14 +665,14 @@ public class AsmUtil {
|
||||
@NotNull String assertMethodToCall
|
||||
) {
|
||||
// Assertions are generated elsewhere for platform types
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return false;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return false;
|
||||
|
||||
if (!state.isCallAssertionsEnabled()) return false;
|
||||
|
||||
if (!isDeclaredInJava(descriptor)) return false;
|
||||
|
||||
JetType type = descriptor.getReturnType();
|
||||
if (type == null || isNullableType(TypesPackage.lowerIfFlexible(type))) return false;
|
||||
if (type == null || isNullableType(FlexibleTypesKt.lowerIfFlexible(type))) return false;
|
||||
|
||||
Type asmType = state.getTypeMapper().mapReturnType(descriptor);
|
||||
if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
@@ -70,7 +70,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
|
||||
for (DeclarationDescriptor memberDescriptor : descriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
|
||||
if (memberDescriptor instanceof CallableMemberDescriptor) {
|
||||
CallableMemberDescriptor member = (CallableMemberDescriptor) memberDescriptor;
|
||||
if (!member.getKind().isReal() && BridgesPackage.findTraitImplementation(member) == null) {
|
||||
if (!member.getKind().isReal() && ImplKt.findTraitImplementation(member) == null) {
|
||||
if (member instanceof FunctionDescriptor) {
|
||||
functionCodegen.generateBridges((FunctionDescriptor) member);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
sourceFiles.addAll(toIoFilesIgnoringNonPhysical(PackagePartClassUtils.getFilesWithCallables(codegen.getFiles())));
|
||||
}
|
||||
|
||||
for (PackageParts part : CodegenPackage.addCompiledPartsAndSort(parts, state)) {
|
||||
for (PackageParts part : ClassFileUtilsKt.addCompiledPartsAndSort(parts, state)) {
|
||||
PackageParts.Companion.serialize(part, builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,14 @@ import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.psi.JetElement;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.FunctionsKt;
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
@@ -60,9 +62,7 @@ import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConst;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeModuleName;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
}
|
||||
else {
|
||||
this.superInterfaceTypes = Collections.singletonList(samType.getType());
|
||||
this.superClassType = getBuiltIns(funDescriptor).getAnyType();
|
||||
this.superClassType = DescriptorUtilsKt.getBuiltIns(funDescriptor).getAnyType();
|
||||
}
|
||||
|
||||
this.closure = bindingContext.get(CLOSURE, classDescriptor);
|
||||
@@ -182,7 +182,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
typeMapper.mapSignature(funDescriptor).getAsmMethod()
|
||||
);
|
||||
|
||||
functionCodegen.generateMethod(OtherOrigin(element, funDescriptor), funDescriptor, strategy);
|
||||
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), funDescriptor, strategy);
|
||||
|
||||
//TODO: rewrite cause ugly hack
|
||||
if (samType != null) {
|
||||
@@ -207,7 +207,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
this.constructor = generateConstructor();
|
||||
|
||||
if (isConst(closure)) {
|
||||
generateConstInstance(asmType, asmType, UtilsPackage.<InstructionAdapter>doNothing());
|
||||
generateConstInstance(asmType, asmType, FunctionsKt.<InstructionAdapter>doNothing());
|
||||
}
|
||||
|
||||
genClosureFields(closure, v, typeMapper);
|
||||
@@ -270,7 +270,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
if (bridge.equals(delegate)) return;
|
||||
|
||||
MethodVisitor mv =
|
||||
v.newMethod(OtherOrigin(element, funDescriptor), ACC_PUBLIC | ACC_BRIDGE,
|
||||
v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), ACC_PUBLIC | ACC_BRIDGE,
|
||||
bridge.getName(), bridge.getDescriptor(), null, ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
@@ -284,8 +284,8 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
|
||||
Type[] myParameterTypes = bridge.getArgumentTypes();
|
||||
|
||||
List<ParameterDescriptor> calleeParameters = CollectionsKt.plus(
|
||||
UtilsPackage.<ParameterDescriptor>singletonOrEmptyList(funDescriptor.getExtensionReceiverParameter()),
|
||||
List<ParameterDescriptor> calleeParameters = CollectionsKt.<ParameterDescriptor>plus(
|
||||
org.jetbrains.kotlin.utils.CollectionsKt.<ParameterDescriptor>singletonOrEmptyList(funDescriptor.getExtensionReceiverParameter()),
|
||||
funDescriptor.getValueParameters()
|
||||
);
|
||||
|
||||
@@ -382,8 +382,8 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
Type[] argTypes = fieldListToTypeArray(args);
|
||||
|
||||
Method constructor = new Method("<init>", Type.VOID_TYPE, argTypes);
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(element, funDescriptor), visibilityFlag, "<init>", constructor.getDescriptor(), null,
|
||||
ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), visibilityFlag, "<init>", constructor.getDescriptor(), null,
|
||||
ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||
mv.visitCode();
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
@@ -463,8 +463,8 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
public static FunctionDescriptor getErasedInvokeFunction(@NotNull FunctionDescriptor elementDescriptor) {
|
||||
int arity = elementDescriptor.getValueParameters().size();
|
||||
ClassDescriptor elementClass = elementDescriptor.getExtensionReceiverParameter() == null
|
||||
? getBuiltIns(elementDescriptor).getFunction(arity)
|
||||
: getBuiltIns(elementDescriptor).getExtensionFunction(arity);
|
||||
? DescriptorUtilsKt.getBuiltIns(elementDescriptor).getFunction(arity)
|
||||
: DescriptorUtilsKt.getBuiltIns(elementDescriptor).getExtensionFunction(arity);
|
||||
JetScope scope = elementClass.getDefaultType().getMemberScope();
|
||||
return scope.getFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).iterator().next();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethod;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicPropertyGetter;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics;
|
||||
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsPackage;
|
||||
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsKt;
|
||||
import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
@@ -53,7 +53,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
|
||||
import org.jetbrains.kotlin.jvm.bindingContextSlices.BindingContextSlicesPackage;
|
||||
import org.jetbrains.kotlin.jvm.bindingContextSlices.BindingContextSlicesKt;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -63,16 +63,18 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
|
||||
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
@@ -101,11 +103,9 @@ import static org.jetbrains.kotlin.resolve.BindingContextUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCall;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCallWithAssert;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationUtilKt.hasJvmFieldAnnotation;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.TraitImpl;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implements LocalLookup {
|
||||
@@ -207,7 +207,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
Type asmType = asmTypeForAnonymousClass(bindingContext, objectDeclaration);
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(
|
||||
OtherOrigin(objectDeclaration, classDescriptor),
|
||||
JvmDeclarationOriginKt.OtherOrigin(objectDeclaration, classDescriptor),
|
||||
asmType,
|
||||
literal.getContainingFile()
|
||||
);
|
||||
@@ -285,7 +285,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
RuntimeAssertionInfo runtimeAssertionInfo = null;
|
||||
if (selector instanceof JetExpression) {
|
||||
runtimeAssertionInfo = bindingContext.get(BindingContextSlicesPackage.getRUNTIME_ASSERTION_INFO(), (JetExpression) selector);
|
||||
runtimeAssertionInfo = bindingContext.get(BindingContextSlicesKt.getRUNTIME_ASSERTION_INFO(), (JetExpression) selector);
|
||||
}
|
||||
|
||||
return genNotNullAssertions(state, stackValue, runtimeAssertionInfo);
|
||||
@@ -331,14 +331,14 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
assert descriptor != null;
|
||||
|
||||
Type asmType = asmTypeForAnonymousClass(bindingContext, declaration);
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(OtherOrigin(declaration, descriptor), asmType, declaration.getContainingFile());
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(declaration, descriptor), asmType, declaration.getContainingFile());
|
||||
|
||||
ClassContext objectContext = context.intoAnonymousClass(descriptor, this, OwnerKind.IMPLEMENTATION);
|
||||
new ImplementationBodyCodegen(declaration, objectContext, classBuilder, state, getParentCodegen(), /* isLocal = */ true).generate();
|
||||
|
||||
if (declaration instanceof JetClass && ((JetClass) declaration).isInterface()) {
|
||||
Type traitImplType = state.getTypeMapper().mapDefaultImpls(descriptor);
|
||||
ClassBuilder traitImplBuilder = state.getFactory().newVisitor(TraitImpl(declaration, descriptor), traitImplType, declaration.getContainingFile());
|
||||
ClassBuilder traitImplBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.TraitImpl(declaration, descriptor), traitImplType, declaration.getContainingFile());
|
||||
ClassContext traitImplContext = context.intoAnonymousClass(descriptor, this, OwnerKind.DEFAULT_IMPLS);
|
||||
new InterfaceImplBodyCodegen(declaration, traitImplContext, traitImplBuilder, state, parentCodegen).generate();
|
||||
}
|
||||
@@ -497,7 +497,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
blockStackElements.push(new LoopBlockStackElement(breakLabel, continueLabel, targetLabel(expression)));
|
||||
|
||||
PseudoInsnsPackage.fakeAlwaysFalseIfeq(v, continueLabel);
|
||||
PseudoInsnsKt.fakeAlwaysFalseIfeq(v, continueLabel);
|
||||
|
||||
JetExpression body = expression.getBody();
|
||||
JetExpression condition = expression.getCondition();
|
||||
@@ -534,7 +534,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
// Is it a "1..2" or so
|
||||
RangeCodegenUtil.BinaryCall binaryCall = RangeCodegenUtil.getRangeAsBinaryCall(forExpression);
|
||||
if (binaryCall != null) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(binaryCall.op, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(binaryCall.op, bindingContext);
|
||||
if (resolvedCall != null) {
|
||||
if (RangeCodegenUtil.isOptimizableRangeTo(resolvedCall.getResultingDescriptor())) {
|
||||
generateForLoop(new ForInRangeLiteralLoopGenerator(forExpression, binaryCall));
|
||||
@@ -583,7 +583,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
generator.checkPreCondition(loopExit);
|
||||
|
||||
// Some forms of for-loop can be optimized as post-condition loops.
|
||||
PseudoInsnsPackage.fakeAlwaysFalseIfeq(v, continueLabel);
|
||||
PseudoInsnsKt.fakeAlwaysFalseIfeq(v, continueLabel);
|
||||
|
||||
generator.beforeBody();
|
||||
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.forExpression)));
|
||||
@@ -805,7 +805,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
FunctionDescriptor hasNext = hasNextCall.getResultingDescriptor();
|
||||
JetType type = hasNext.getReturnType();
|
||||
assert type != null && JetTypeChecker.DEFAULT.isSubtypeOf(type, getBuiltIns(hasNext).getBooleanType());
|
||||
assert type != null && JetTypeChecker.DEFAULT.isSubtypeOf(type, DescriptorUtilsKt.getBuiltIns(hasNext).getBooleanType());
|
||||
|
||||
Type asmType = asmType(type);
|
||||
StackValue.coerce(asmType, Type.BOOLEAN_TYPE, v);
|
||||
@@ -1244,7 +1244,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
loopBlockStackElement.targetLabel != null &&
|
||||
labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) {
|
||||
Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel;
|
||||
PseudoInsnsPackage.fixStackAndJump(v, label);
|
||||
PseudoInsnsKt.fixStackAndJump(v, label);
|
||||
v.mark(afterBreakContinueLabel);
|
||||
return StackValue.none();
|
||||
}
|
||||
@@ -1423,7 +1423,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@Nullable FunctionDescriptor functionReferenceTarget
|
||||
) {
|
||||
ClassBuilder cv = state.getFactory().newVisitor(
|
||||
OtherOrigin(declaration, descriptor),
|
||||
JvmDeclarationOriginKt.OtherOrigin(declaration, descriptor),
|
||||
asmTypeForAnonymousClass(bindingContext, descriptor),
|
||||
declaration.getContainingFile()
|
||||
);
|
||||
@@ -1534,7 +1534,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
|
||||
ClassDescriptor superClass = DescriptorUtilPackage.getSuperClassNotAny(classDescriptor);
|
||||
ClassDescriptor superClass = DescriptorUtilsKt.getSuperClassNotAny(classDescriptor);
|
||||
if (superClass != null) {
|
||||
pushClosureOnStack(
|
||||
superClass,
|
||||
@@ -1957,7 +1957,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
@Override
|
||||
public StackValue visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression, @NotNull StackValue receiver) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, bindingContext);
|
||||
|
||||
DeclarationDescriptor descriptor;
|
||||
if (resolvedCall == null) {
|
||||
@@ -2013,7 +2013,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
(expression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER || isSyntheticField)
|
||||
&& contextKind() != OwnerKind.DEFAULT_IMPLS;
|
||||
JetSuperExpression superExpression =
|
||||
resolvedCall == null ? null : CallResolverUtilPackage.getSuperCallExpression(resolvedCall.getCall());
|
||||
resolvedCall == null ? null : CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall());
|
||||
propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression);
|
||||
|
||||
if (directToField) {
|
||||
@@ -2266,7 +2266,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
@Override
|
||||
public StackValue visitCallExpression(@NotNull JetCallExpression expression, StackValue receiver) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
FunctionDescriptor descriptor = accessibleFunctionDescriptor(resolvedCall);
|
||||
|
||||
if (descriptor instanceof ConstructorDescriptor) {
|
||||
@@ -2342,7 +2342,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
// $default method is not private, so you need no accessor to call it
|
||||
return usesDefaultArguments(resolvedCall)
|
||||
? descriptor
|
||||
: context.accessibleDescriptor(descriptor, CallResolverUtilPackage.getSuperCallExpression(resolvedCall.getCall()));
|
||||
: context.accessibleDescriptor(descriptor, CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall()));
|
||||
}
|
||||
|
||||
private static boolean usesDefaultArguments(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
@@ -2364,7 +2364,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@NotNull
|
||||
public StackValue invokeFunction(@NotNull Call call, @NotNull ResolvedCall<?> resolvedCall, @NotNull StackValue receiver) {
|
||||
FunctionDescriptor fd = accessibleFunctionDescriptor(resolvedCall);
|
||||
JetSuperExpression superCallExpression = CallResolverUtilPackage.getSuperCallExpression(call);
|
||||
JetSuperExpression superCallExpression = CallResolverUtilKt.getSuperCallExpression(call);
|
||||
boolean superCall = superCallExpression != null;
|
||||
|
||||
if (superCall && !isJvmInterface(fd.getContainingDeclaration())) {
|
||||
@@ -2619,7 +2619,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
boolean isSingleton = calleeContainingClass.getKind().isSingleton();
|
||||
if (isSingleton) {
|
||||
if (calleeContainingClass.equals(context.getThisDescriptor()) &&
|
||||
!AnnotationsPackage.isPlatformStaticInObjectOrClass(context.getContextDescriptor())) {
|
||||
!AnnotationUtilKt.isPlatformStaticInObjectOrClass(context.getContextDescriptor())) {
|
||||
return StackValue.local(0, typeMapper.mapType(calleeContainingClass));
|
||||
}
|
||||
else {
|
||||
@@ -2774,7 +2774,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
@Override
|
||||
public StackValue visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression, StackValue data) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression.getCallableReference(), bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression.getCallableReference(), bindingContext);
|
||||
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
|
||||
if (functionDescriptor != null) {
|
||||
FunctionReferenceGenerationStrategy strategy = new FunctionReferenceGenerationStrategy(state, functionDescriptor, resolvedCall);
|
||||
@@ -2800,7 +2800,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
ClassDescriptor classDescriptor = CodegenBinding.anonymousClassForCallable(bindingContext, variableDescriptor);
|
||||
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(
|
||||
OtherOrigin(element),
|
||||
JvmDeclarationOriginKt.OtherOrigin(element),
|
||||
typeMapper.mapClass(classDescriptor),
|
||||
element.getContainingFile()
|
||||
);
|
||||
@@ -2923,7 +2923,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
expression.getRight(), reference);
|
||||
}
|
||||
else {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
FunctionDescriptor descriptor = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
|
||||
|
||||
if (descriptor instanceof ConstructorDescriptor) {
|
||||
@@ -2946,7 +2946,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
genInIntRange(leftValue, (JetBinaryExpression) deparenthesized);
|
||||
}
|
||||
else {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = getResolvedCallWithAssert(operationReference, bindingContext);
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt
|
||||
.getResolvedCallWithAssert(operationReference, bindingContext);
|
||||
StackValue result = invokeFunction(resolvedCall.getCall(), resolvedCall, StackValue.none());
|
||||
result.put(result.type, v);
|
||||
}
|
||||
@@ -3090,7 +3091,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
private StackValue generateComparison(JetBinaryExpression expression, StackValue receiver) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
|
||||
JetExpression left = expression.getLeft();
|
||||
JetExpression right = expression.getRight();
|
||||
@@ -3122,7 +3123,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
private StackValue generateAugmentedAssignment(JetBinaryExpression expression) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
FunctionDescriptor descriptor = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
|
||||
Callable callable = resolveToCallable(descriptor, false, resolvedCall);
|
||||
JetExpression lhs = expression.getLeft();
|
||||
@@ -3195,7 +3196,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@Override
|
||||
public StackValue visitPrefixExpression(@NotNull JetPrefixExpression expression, @NotNull StackValue receiver) {
|
||||
DeclarationDescriptor originalOperation = bindingContext.get(REFERENCE_TARGET, expression.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
CallableDescriptor op = resolvedCall.getResultingDescriptor();
|
||||
|
||||
assert op instanceof FunctionDescriptor || originalOperation == null : String.valueOf(op);
|
||||
@@ -3234,7 +3235,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
DeclarationDescriptor originalOperation = bindingContext.get(REFERENCE_TARGET, expression.getOperationReference());
|
||||
String originalOperationName = originalOperation != null ? originalOperation.getName().asString() : null;
|
||||
final ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
|
||||
final ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(expression, bindingContext);
|
||||
DeclarationDescriptor op = resolvedCall.getResultingDescriptor();
|
||||
if (!(op instanceof FunctionDescriptor) || originalOperation == null) {
|
||||
throw new UnsupportedOperationException("Don't know how to generate this postfix expression: " + originalOperationName + " " + op);
|
||||
@@ -3966,14 +3967,14 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
JetType jetType = bindingContext.getType(rangeExpression);
|
||||
assert jetType != null;
|
||||
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
|
||||
return getBuiltIns(descriptor).getIntegralRanges().contains(descriptor);
|
||||
return DescriptorUtilsKt.getBuiltIns(descriptor).getIntegralRanges().contains(descriptor);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Call makeFakeCall(ReceiverValue initializerAsReceiver) {
|
||||
JetSimpleNameExpression fake = JetPsiFactory(state.getProject()).createSimpleName("fake");
|
||||
JetSimpleNameExpression fake = JetPsiFactoryKt.JetPsiFactory(state.getProject()).createSimpleName("fake");
|
||||
return CallMaker.makeCall(fake, initializerAsReceiver);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.Bridge;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
|
||||
import org.jetbrains.kotlin.codegen.annotation.AnnotatedWithOnlyTargetedAnnotations;
|
||||
import org.jetbrains.kotlin.codegen.context.*;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics;
|
||||
@@ -40,19 +40,19 @@ import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
|
||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialJvmSignature;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.java.SpecialBuiltinMembers;
|
||||
import org.jetbrains.kotlin.load.kotlin.nativeDeclarations.NativeDeclarationsPackage;
|
||||
import org.jetbrains.kotlin.load.kotlin.nativeDeclarations.NativeKt;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetNamedFunction;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.KClassValue;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
@@ -80,7 +80,6 @@ import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarg
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.*;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
public class FunctionCodegen {
|
||||
@@ -111,7 +110,7 @@ public class FunctionCodegen {
|
||||
"in " + function.getContainingFile().getVirtualFile();
|
||||
|
||||
if (owner.getContextKind() != OwnerKind.DEFAULT_IMPLS || function.hasBody()) {
|
||||
generateMethod(OtherOrigin(function, functionDescriptor), functionDescriptor,
|
||||
generateMethod(JvmDeclarationOriginKt.OtherOrigin(function, functionDescriptor), functionDescriptor,
|
||||
new FunctionGenerationStrategy.FunctionDefault(state, functionDescriptor, function));
|
||||
}
|
||||
|
||||
@@ -156,7 +155,7 @@ public class FunctionCodegen {
|
||||
Method asmMethod = jvmSignature.getAsmMethod();
|
||||
|
||||
int flags = getMethodAsmFlags(functionDescriptor, contextKind);
|
||||
boolean isNative = NativeDeclarationsPackage.hasNativeAnnotation(functionDescriptor);
|
||||
boolean isNative = NativeKt.hasNativeAnnotation(functionDescriptor);
|
||||
|
||||
if (isNative && owner instanceof DelegatingFacadeContext) {
|
||||
// Native methods are only defined in facades and do not need package part implementations
|
||||
@@ -183,7 +182,7 @@ public class FunctionCodegen {
|
||||
|
||||
generateBridges(functionDescriptor);
|
||||
|
||||
boolean staticInCompanionObject = AnnotationsPackage.isPlatformStaticInCompanionObject(functionDescriptor);
|
||||
boolean staticInCompanionObject = AnnotationUtilKt.isPlatformStaticInCompanionObject(functionDescriptor);
|
||||
if (staticInCompanionObject) {
|
||||
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
|
||||
parentBodyCodegen.addAdditionalTask(new PlatformStaticGenerator(functionDescriptor, origin, state));
|
||||
@@ -515,13 +514,13 @@ public class FunctionCodegen {
|
||||
if (isMethodOfAny(descriptor)) return;
|
||||
|
||||
// If the function doesn't have a physical declaration among super-functions, it's a SAM adapter or alike and doesn't need bridges
|
||||
if (CallResolverUtilPackage.isOrOverridesSynthesized(descriptor)) return;
|
||||
if (CallResolverUtilKt.isOrOverridesSynthesized(descriptor)) return;
|
||||
|
||||
boolean isSpecial = SpecialBuiltinMembers.overridesBuiltinSpecialDeclaration(descriptor);
|
||||
|
||||
Set<Bridge<Method>> bridgesToGenerate;
|
||||
if (!isSpecial) {
|
||||
bridgesToGenerate = BridgesPackage.generateBridgesForFunctionDescriptor(
|
||||
bridgesToGenerate = ImplKt.generateBridgesForFunctionDescriptor(
|
||||
descriptor,
|
||||
new Function1<FunctionDescriptor, Method>() {
|
||||
@Override
|
||||
@@ -566,7 +565,7 @@ public class FunctionCodegen {
|
||||
|
||||
Method method = typeMapper.mapSignature(descriptor).getAsmMethod();
|
||||
int flags = ACC_ABSTRACT | getVisibilityAccessFlag(descriptor);
|
||||
v.newMethod(OtherOrigin(overridden), flags, method.getName(), method.getDescriptor(), null, null);
|
||||
v.newMethod(JvmDeclarationOriginKt.OtherOrigin(overridden), flags, method.getName(), method.getDescriptor(), null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -645,7 +644,7 @@ public class FunctionCodegen {
|
||||
Method defaultMethod = typeMapper.mapDefaultMethod(functionDescriptor, kind);
|
||||
|
||||
MethodVisitor mv = v.newMethod(
|
||||
Synthetic(function, functionDescriptor),
|
||||
JvmDeclarationOriginKt.Synthetic(function, functionDescriptor),
|
||||
flags,
|
||||
defaultMethod.getName(),
|
||||
defaultMethod.getDescriptor(), null,
|
||||
@@ -807,7 +806,7 @@ public class FunctionCodegen {
|
||||
int flags = ACC_PUBLIC | ACC_BRIDGE | (!isSpecialBridge ? ACC_SYNTHETIC : 0) | (isSpecialBridge ? ACC_FINAL : 0); // TODO.
|
||||
|
||||
MethodVisitor mv =
|
||||
v.newMethod(DiagnosticsPackage.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
|
||||
v.newMethod(JvmDeclarationOriginKt.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
|
||||
mv.visitCode();
|
||||
@@ -909,7 +908,7 @@ public class FunctionCodegen {
|
||||
final StackValue field
|
||||
) {
|
||||
generateMethod(
|
||||
Delegation(DescriptorToSourceUtils.descriptorToDeclaration(delegatedTo), delegateFunction), delegateFunction,
|
||||
JvmDeclarationOriginKt.Delegation(DescriptorToSourceUtils.descriptorToDeclaration(delegatedTo), delegateFunction), delegateFunction,
|
||||
new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
|
||||
+4
-6
@@ -21,10 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.psi.Call;
|
||||
import org.jetbrains.kotlin.psi.JetCallExpression;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.ValueArgument;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DelegatingResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
@@ -142,7 +139,7 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
|
||||
}
|
||||
}
|
||||
fakeFunctionCall.append(")");
|
||||
return (JetCallExpression) JetPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
|
||||
return (JetCallExpression) JetPsiFactoryKt.JetPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
|
||||
}
|
||||
|
||||
private void computeAndSaveArguments(@NotNull List<? extends ValueArgument> fakeArguments, @NotNull ExpressionCodegen codegen) {
|
||||
@@ -168,7 +165,8 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
|
||||
) {
|
||||
if (receiver == null) return NO_RECEIVER;
|
||||
|
||||
JetExpression receiverExpression = JetPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
|
||||
JetExpression receiverExpression = JetPsiFactoryKt
|
||||
.JetPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
|
||||
codegen.tempVariables.put(receiverExpression, receiverParameterStackValue(signature));
|
||||
return new ExpressionReceiver(receiverExpression, receiver.getType());
|
||||
}
|
||||
|
||||
@@ -49,16 +49,17 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
@@ -84,11 +85,8 @@ import static org.jetbrains.kotlin.resolve.BindingContextUtils.getNotNull;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCall;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getSecondaryConstructors;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.JAVA_STRING_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
|
||||
import static org.jetbrains.kotlin.types.Variance.INVARIANT;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
@@ -237,7 +235,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
if (isInterface(descriptor) && !isLocal) {
|
||||
Type defaultImplsType = state.getTypeMapper().mapDefaultImpls(descriptor);
|
||||
ClassBuilder defaultImplsBuilder =
|
||||
state.getFactory().newVisitor(TraitImpl(myClass, descriptor), defaultImplsType, myClass.getContainingFile());
|
||||
state.getFactory().newVisitor(JvmDeclarationOriginKt.TraitImpl(myClass, descriptor), defaultImplsType, myClass.getContainingFile());
|
||||
|
||||
CodegenContext parentContext = context.getParentContext();
|
||||
assert parentContext != null : "Parent context of interface declaration should not be null";
|
||||
@@ -378,7 +376,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
try {
|
||||
lookupConstructorExpressionsInClosureIfPresent();
|
||||
generatePrimaryConstructor(delegationFieldsInfo);
|
||||
for (ConstructorDescriptor secondaryConstructor : getSecondaryConstructors(descriptor)) {
|
||||
for (ConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) {
|
||||
generateSecondaryConstructor(secondaryConstructor);
|
||||
}
|
||||
}
|
||||
@@ -417,7 +415,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
Collection<FunctionDescriptor> functions =
|
||||
descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier("toArray"), NoLookupLocation.FROM_BACKEND);
|
||||
for (FunctionDescriptor function : functions) {
|
||||
if (CallResolverUtilPackage.isOrOverridesSynthesized(function)) {
|
||||
if (CallResolverUtilKt.isOrOverridesSynthesized(function)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -430,8 +428,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
JetType paramType = function.getValueParameters().get(0).getType();
|
||||
if (KotlinBuiltIns.isArray(returnType) && KotlinBuiltIns.isArray(paramType)) {
|
||||
JetType elementType = function.getTypeParameters().get(0).getDefaultType();
|
||||
if (JetTypeChecker.DEFAULT.equalTypes(elementType, getBuiltIns(descriptor).getArrayElementType(returnType))
|
||||
&& JetTypeChecker.DEFAULT.equalTypes(elementType, getBuiltIns(descriptor).getArrayElementType(paramType))) {
|
||||
if (JetTypeChecker.DEFAULT.equalTypes(elementType, DescriptorUtilsKt.getBuiltIns(descriptor).getArrayElementType(returnType))
|
||||
&& JetTypeChecker.DEFAULT.equalTypes(elementType, DescriptorUtilsKt
|
||||
.getBuiltIns(descriptor).getArrayElementType(paramType))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -441,7 +440,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
private void generateToArray() {
|
||||
KotlinBuiltIns builtIns = getBuiltIns(descriptor);
|
||||
KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor);
|
||||
if (!isSubclass(descriptor, builtIns.getCollection())) return;
|
||||
|
||||
int access = descriptor.getKind() == ClassKind.INTERFACE ?
|
||||
@@ -498,7 +497,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
@Override
|
||||
public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
|
||||
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(function), ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
mv.visitCode();
|
||||
@@ -555,7 +554,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
@Override
|
||||
public void generateHashCodeMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
|
||||
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(function), ACC_PUBLIC, "hashCode", "()I", null, null);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "hashCode", "()I", null, null);
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
mv.visitCode();
|
||||
@@ -604,7 +603,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
@Override
|
||||
public void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
|
||||
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(function), ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
mv.visitCode();
|
||||
@@ -667,7 +666,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
@Override
|
||||
public void generateComponentFunction(@NotNull FunctionDescriptor function, @NotNull final ValueParameterDescriptor parameter) {
|
||||
PsiElement originalElement = DescriptorToSourceUtils.descriptorToDeclaration(parameter);
|
||||
functionCodegen.generateMethod(OtherOrigin(originalElement, function), function, new FunctionGenerationStrategy() {
|
||||
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(originalElement, function), function, new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
@NotNull MethodVisitor mv,
|
||||
@@ -695,7 +694,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
public void generateCopyFunction(@NotNull final FunctionDescriptor function, @NotNull List<JetParameter> constructorParameters) {
|
||||
final Type thisDescriptorType = typeMapper.mapType(descriptor);
|
||||
|
||||
functionCodegen.generateMethod(OtherOrigin(myClass, function), function, new FunctionGenerationStrategy() {
|
||||
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(myClass, function), function, new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
@NotNull MethodVisitor mv,
|
||||
@@ -793,7 +792,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
private void generateEnumValuesMethod() {
|
||||
Type type = typeMapper.mapType(getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType()));
|
||||
Type type = typeMapper.mapType(DescriptorUtilsKt.getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType()));
|
||||
|
||||
FunctionDescriptor valuesFunction =
|
||||
CollectionsKt.single(descriptor.getStaticScope().getFunctions(ENUM_VALUES, NoLookupLocation.FROM_BACKEND), new Function1<FunctionDescriptor, Boolean>() {
|
||||
@@ -802,7 +801,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
return CodegenUtil.isEnumValuesMethod(descriptor);
|
||||
}
|
||||
});
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(myClass, valuesFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUES.asString(),
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(myClass, valuesFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUES.asString(),
|
||||
"()" + type.getDescriptor(), null, null);
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
|
||||
@@ -822,7 +821,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
return CodegenUtil.isEnumValueOfMethod(descriptor);
|
||||
}
|
||||
});
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(myClass, valueOfFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUE_OF.asString(),
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(myClass, valueOfFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUE_OF.asString(),
|
||||
"(Ljava/lang/String;)" + classAsmType.getDescriptor(), null, null);
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
|
||||
@@ -846,7 +845,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
final FunctionDescriptor accessor = (FunctionDescriptor) accessorForCallableDescriptor;
|
||||
final FunctionDescriptor original = (FunctionDescriptor) accessorForCallableDescriptor.getCalleeDescriptor();
|
||||
functionCodegen.generateMethod(
|
||||
Synthetic(null, original), accessor,
|
||||
JvmDeclarationOriginKt.Synthetic(null, original), accessor,
|
||||
new FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, accessor) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
@@ -900,16 +899,18 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
PropertyGetterDescriptor getter = accessor.getGetter();
|
||||
assert getter != null;
|
||||
functionCodegen.generateMethod(Synthetic(null, original.getGetter() != null ? original.getGetter() : original),
|
||||
getter, new PropertyAccessorStrategy(getter));
|
||||
functionCodegen.generateMethod(
|
||||
JvmDeclarationOriginKt.Synthetic(null, original.getGetter() != null ? original.getGetter() : original),
|
||||
getter, new PropertyAccessorStrategy(getter));
|
||||
|
||||
|
||||
if (accessor.isVar()) {
|
||||
PropertySetterDescriptor setter = accessor.getSetter();
|
||||
assert setter != null;
|
||||
|
||||
functionCodegen.generateMethod(Synthetic(null, original.getSetter() != null ? original.getSetter() : original),
|
||||
setter, new PropertyAccessorStrategy(setter));
|
||||
functionCodegen.generateMethod(
|
||||
JvmDeclarationOriginKt.Synthetic(null, original.getSetter() != null ? original.getSetter() : original),
|
||||
setter, new PropertyAccessorStrategy(setter));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -953,7 +954,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
reg = 0;
|
||||
}
|
||||
else if (accessorIsConstructor || (accessorDescriptor != null && JetTypeMapper.isAccessor(accessorDescriptor))) {
|
||||
if (!AnnotationsPackage.isPlatformStaticInObjectOrClass(functionDescriptor)) {
|
||||
if (!AnnotationUtilKt.isPlatformStaticInObjectOrClass(functionDescriptor)) {
|
||||
iv.load(0, OBJECT_TYPE);
|
||||
}
|
||||
}
|
||||
@@ -976,11 +977,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
if (isObject(descriptor)) {
|
||||
StackValue.Field field = StackValue.singleton(descriptor, typeMapper);
|
||||
v.newField(OtherOrigin(myClass), ACC_PUBLIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null);
|
||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(myClass), ACC_PUBLIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null);
|
||||
|
||||
if (isNonCompanionObject(descriptor)) {
|
||||
StackValue.Field oldField = StackValue.oldSingleton(descriptor, typeMapper);
|
||||
v.newField(OtherOrigin(myClass), ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_DEPRECATED, oldField.name, oldField.type.getDescriptor(), null, null);
|
||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(myClass), ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_DEPRECATED, oldField.name, oldField.type.getDescriptor(), null, null);
|
||||
}
|
||||
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
@@ -1008,7 +1009,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
assert companionObject != null : "Companion object not found: " + myClass.getText();
|
||||
|
||||
StackValue.Field field = StackValue.singletonForCompanion(companionObjectDescriptor, typeMapper);
|
||||
v.newField(OtherOrigin(companionObject), ACC_PUBLIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null);
|
||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(companionObject), ACC_PUBLIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null);
|
||||
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
|
||||
|
||||
@@ -1025,7 +1026,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
Type type = typeMapper.mapType(property);
|
||||
int modifiers = ACC_STATIC | ACC_FINAL | ACC_PUBLIC | (property.isConst() ? 0 : ACC_DEPRECATED);
|
||||
FieldVisitor fv = v.newField(Synthetic(DescriptorToSourceUtils.descriptorToDeclaration(property), property),
|
||||
FieldVisitor fv = v.newField(JvmDeclarationOriginKt.Synthetic(DescriptorToSourceUtils.descriptorToDeclaration(property), property),
|
||||
modifiers, context.getFieldName(property, false),
|
||||
type.getDescriptor(), typeMapper.mapFieldSignature(property.getType()),
|
||||
info.defaultValue);
|
||||
@@ -1079,7 +1080,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
ConstructorContext constructorContext = context.intoConstructor(constructorDescriptor);
|
||||
|
||||
JetPrimaryConstructor primaryConstructor = myClass.getPrimaryConstructor();
|
||||
JvmDeclarationOrigin origin = OtherOrigin(primaryConstructor != null ? primaryConstructor : myClass, constructorDescriptor);
|
||||
JvmDeclarationOrigin origin = JvmDeclarationOriginKt
|
||||
.OtherOrigin(primaryConstructor != null ? primaryConstructor : myClass, constructorDescriptor);
|
||||
functionCodegen.generateMethod(origin, constructorDescriptor, constructorContext,
|
||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||
@Override
|
||||
@@ -1104,9 +1106,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
ConstructorContext constructorContext = context.intoConstructor(constructorDescriptor);
|
||||
|
||||
functionCodegen.generateMethod(OtherOrigin(descriptorToDeclaration(constructorDescriptor), constructorDescriptor),
|
||||
constructorDescriptor, constructorContext,
|
||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||
functionCodegen.generateMethod(
|
||||
JvmDeclarationOriginKt.OtherOrigin(descriptorToDeclaration(constructorDescriptor), constructorDescriptor),
|
||||
constructorDescriptor, constructorContext,
|
||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
generateSecondaryConstructorImpl(callableDescriptor, codegen);
|
||||
@@ -1335,7 +1338,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
lookupInContext(descriptor);
|
||||
}
|
||||
else if (descriptor instanceof CallableMemberDescriptor) {
|
||||
ResolvedCall<? extends CallableDescriptor> call = getResolvedCall(expr, bindingContext);
|
||||
ResolvedCall<? extends CallableDescriptor> call = CallUtilKt.getResolvedCall(expr, bindingContext);
|
||||
if (call != null) {
|
||||
lookupReceiver(call.getDispatchReceiver());
|
||||
lookupReceiver(call.getExtensionReceiver());
|
||||
@@ -1414,7 +1417,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
ClassDescriptor superClass = DescriptorUtilPackage.getSuperClassNotAny(descriptor);
|
||||
ClassDescriptor superClass = DescriptorUtilsKt.getSuperClassNotAny(descriptor);
|
||||
if (superClass != null) {
|
||||
if (superClass.isInner()) {
|
||||
context.lookupInContext(superClass.getContainingDeclaration(), StackValue.LOCAL_0, state, true);
|
||||
@@ -1445,7 +1448,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull final FunctionDescriptor inheritedFun) {
|
||||
functionCodegen.generateMethod(
|
||||
DelegationToTraitImpl(descriptorToDeclaration(traitFun), traitFun),
|
||||
JvmDeclarationOriginKt.DelegationToTraitImpl(descriptorToDeclaration(traitFun), traitFun),
|
||||
inheritedFun,
|
||||
new FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, inheritedFun) {
|
||||
@Override
|
||||
@@ -1676,7 +1679,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
for (JetEnumEntry enumEntry : enumEntries) {
|
||||
ClassDescriptor descriptor = getNotNull(bindingContext, BindingContext.CLASS, enumEntry);
|
||||
FieldVisitor fv = v.newField(OtherOrigin(enumEntry, descriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL,
|
||||
FieldVisitor fv = v.newField(JvmDeclarationOriginKt.OtherOrigin(enumEntry, descriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL,
|
||||
descriptor.getName().asString(), classAsmType.getDescriptor(), null, null);
|
||||
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(descriptor, null);
|
||||
}
|
||||
@@ -1690,8 +1693,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
ExpressionCodegen codegen = createOrGetClInitCodegen();
|
||||
InstructionAdapter iv = codegen.v;
|
||||
|
||||
Type arrayAsmType = typeMapper.mapType(getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType()));
|
||||
v.newField(OtherOrigin(myClass), ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, ENUM_VALUES_FIELD_NAME,
|
||||
Type arrayAsmType = typeMapper.mapType(DescriptorUtilsKt.getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType()));
|
||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(myClass), ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, ENUM_VALUES_FIELD_NAME,
|
||||
arrayAsmType.getDescriptor(), null, null);
|
||||
|
||||
iv.iconst(enumEntries.size());
|
||||
@@ -1726,7 +1729,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
List<JetDelegationSpecifier> delegationSpecifiers = enumEntry.getDelegationSpecifiers();
|
||||
if (delegationSpecifiers.size() == 1 && !enumEntryNeedSubclass(bindingContext, enumEntry)) {
|
||||
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCallWithAssert(delegationSpecifiers.get(0), bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCallWithAssert(delegationSpecifiers.get(0), bindingContext);
|
||||
|
||||
CallableMethod method = typeMapper.mapToCallableMethod((ConstructorDescriptor) resolvedCall.getResultingDescriptor(), false);
|
||||
|
||||
|
||||
@@ -34,11 +34,10 @@ import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityUtilsKt;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetFunction;
|
||||
import org.jetbrains.kotlin.psi.codeFragmentUtil.CodeFragmentUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.codeFragmentUtil.CodeFragmentUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
@@ -172,7 +171,7 @@ public class JvmCodegenUtil {
|
||||
|
||||
private static boolean isDebuggerContext(@NotNull MethodContext context) {
|
||||
JetFile file = DescriptorToSourceUtils.getContainingFile(context.getContextDescriptor());
|
||||
return file != null && CodeFragmentUtilPackage.getSuppressDiagnosticsInDebugMode(file);
|
||||
return file != null && CodeFragmentUtilKt.getSuppressDiagnosticsInDebugMode(file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatformKt;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
@@ -31,8 +32,6 @@ import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
|
||||
public class JvmRuntimeTypes {
|
||||
private final ClassDescriptor lambda;
|
||||
private final ClassDescriptor functionReference;
|
||||
@@ -77,7 +76,7 @@ public class JvmRuntimeTypes {
|
||||
ReceiverParameterDescriptor receiverParameter = descriptor.getExtensionReceiverParameter();
|
||||
|
||||
//noinspection ConstantConditions
|
||||
JetType functionType = getBuiltIns(descriptor).getFunctionType(
|
||||
JetType functionType = DescriptorUtilsKt.getBuiltIns(descriptor).getFunctionType(
|
||||
Annotations.Companion.getEMPTY(),
|
||||
receiverParameter == null ? null : receiverParameter.getType(),
|
||||
ExpressionTypingUtils.getValueParametersTypes(descriptor.getValueParameters()),
|
||||
@@ -96,7 +95,7 @@ public class JvmRuntimeTypes {
|
||||
extensionReceiver != null ? extensionReceiver.getType() : dispatchReceiver != null ? dispatchReceiver.getType() : null;
|
||||
|
||||
//noinspection ConstantConditions
|
||||
JetType functionType = getBuiltIns(descriptor).getFunctionType(
|
||||
JetType functionType = DescriptorUtilsKt.getBuiltIns(descriptor).getFunctionType(
|
||||
Annotations.Companion.getEMPTY(),
|
||||
receiverType,
|
||||
ExpressionTypingUtils.getValueParametersTypes(descriptor.getValueParameters()),
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClassesPackage;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClasses;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -41,11 +41,12 @@ import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
import org.jetbrains.kotlin.resolve.source.SourcePackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.storage.NotNullLazyValue;
|
||||
import org.jetbrains.kotlin.types.ErrorUtils;
|
||||
@@ -205,7 +206,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
}
|
||||
|
||||
Type classType = state.getTypeMapper().mapClass(descriptor);
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(OtherOrigin(aClass, descriptor), classType, aClass.getContainingFile());
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(aClass, descriptor), classType, aClass.getContainingFile());
|
||||
ClassContext classContext = parentContext.intoClass(descriptor, OwnerKind.IMPLEMENTATION, state);
|
||||
new ImplementationBodyCodegen(aClass, classContext, classBuilder, state, parentCodegen, false).generate();
|
||||
}
|
||||
@@ -291,7 +292,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
return implementationOwnerType;
|
||||
}
|
||||
else {
|
||||
return FileClassesPackage.getFileClassType(fileClassesProvider, element.getContainingJetFile());
|
||||
return FileClasses.getFileClassType(fileClassesProvider, element.getContainingJetFile());
|
||||
}
|
||||
}
|
||||
/*disabled cause of KT-7775
|
||||
@@ -325,13 +326,13 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
protected ExpressionCodegen createOrGetClInitCodegen() {
|
||||
DeclarationDescriptor descriptor = context.getContextDescriptor();
|
||||
if (clInit == null) {
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
|
||||
SimpleFunctionDescriptorImpl clInit =
|
||||
SimpleFunctionDescriptorImpl.create(descriptor, Annotations.Companion.getEMPTY(), Name.special("<clinit>"), SYNTHESIZED,
|
||||
SourcePackage.toSourceElement(element));
|
||||
KotlinSourceElementKt.toSourceElement(element));
|
||||
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
Collections.<ValueParameterDescriptor>emptyList(),
|
||||
DescriptorUtilPackage.getModule(descriptor).getBuiltIns().getUnitType(),
|
||||
DescriptorUtilsKt.getModule(descriptor).getBuiltIns().getUnitType(),
|
||||
null, Visibilities.PRIVATE);
|
||||
|
||||
this.clInit = new ExpressionCodegen(mv, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state, this);
|
||||
@@ -535,7 +536,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
@NotNull Type fieldAsmType,
|
||||
@NotNull Function1<InstructionAdapter, Unit> initialization
|
||||
) {
|
||||
v.newField(OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor(),
|
||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor(),
|
||||
null, null);
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||
|
||||
@@ -32,13 +32,14 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
@@ -197,7 +198,7 @@ public class PropertyCodegen {
|
||||
String name = p.getName();
|
||||
if (name == null) return;
|
||||
MethodVisitor mv = v.newMethod(
|
||||
OtherOrigin(p, descriptor), ACC_PUBLIC | ACC_ABSTRACT, name,
|
||||
JvmDeclarationOriginKt.OtherOrigin(p, descriptor), ACC_PUBLIC | ACC_ABSTRACT, name,
|
||||
signature.getAsmMethod().getDescriptor(),
|
||||
signature.getGenericsSignature(),
|
||||
null
|
||||
@@ -254,7 +255,7 @@ public class PropertyCodegen {
|
||||
|
||||
if (!isInterface(context.getContextDescriptor()) || kind == OwnerKind.DEFAULT_IMPLS) {
|
||||
int flags = ACC_DEPRECATED | ACC_FINAL | ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC;
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(descriptor), flags, name, desc, null, null);
|
||||
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), flags, name, desc, null, null);
|
||||
AnnotationCodegen.forMethod(mv, typeMapper)
|
||||
.genAnnotations(new AnnotatedSimple(annotations), Type.VOID_TYPE, AnnotationUseSiteTarget.PROPERTY);
|
||||
mv.visitCode();
|
||||
@@ -353,8 +354,8 @@ public class PropertyCodegen {
|
||||
|
||||
v.getSerializationBindings().put(FIELD_FOR_PROPERTY, propertyDescriptor, Pair.create(type, name));
|
||||
|
||||
FieldVisitor fv = builder.newField(OtherOrigin(element, propertyDescriptor), modifiers, name, type.getDescriptor(),
|
||||
typeMapper.mapFieldSignature(jetType), defaultValue);
|
||||
FieldVisitor fv = builder.newField(JvmDeclarationOriginKt.OtherOrigin(element, propertyDescriptor), modifiers, name, type.getDescriptor(),
|
||||
typeMapper.mapFieldSignature(jetType), defaultValue);
|
||||
|
||||
Annotated fieldAnnotated = new AnnotatedWithFakeAnnotations(propertyDescriptor, annotations);
|
||||
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(fieldAnnotated, type, AnnotationUseSiteTarget.FIELD);
|
||||
@@ -425,7 +426,7 @@ public class PropertyCodegen {
|
||||
strategy = new FunctionGenerationStrategy.FunctionDefault(state, accessorDescriptor, accessor);
|
||||
}
|
||||
|
||||
functionCodegen.generateMethod(OtherOrigin(accessor != null ? accessor : p, accessorDescriptor), accessorDescriptor, strategy);
|
||||
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(accessor != null ? accessor : p, accessorDescriptor), accessorDescriptor, strategy);
|
||||
}
|
||||
|
||||
public static int indexOfDelegatedProperty(@NotNull JetProperty property) {
|
||||
@@ -451,7 +452,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Delegated property not found in its parent: " + PsiUtilPackage.getElementTextWithContext(property));
|
||||
throw new IllegalStateException("Delegated property not found in its parent: " + PsiUtilsKt.getElementTextWithContext(property));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
@@ -82,7 +83,7 @@ public class SamWrapperCodegen {
|
||||
/*copyOverrides=*/ false
|
||||
);
|
||||
|
||||
ClassBuilder cv = state.getFactory().newVisitor(OtherOrigin(erasedInterfaceFunction), asmType, file);
|
||||
ClassBuilder cv = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(erasedInterfaceFunction), asmType, file);
|
||||
cv.defineClass(file,
|
||||
V1_6,
|
||||
ACC_FINAL,
|
||||
@@ -98,7 +99,7 @@ public class SamWrapperCodegen {
|
||||
// e.g. ASM type for Function2
|
||||
Type functionAsmType = typeMapper.mapType(functionType);
|
||||
|
||||
cv.newField(OtherOrigin(erasedInterfaceFunction),
|
||||
cv.newField(JvmDeclarationOriginKt.OtherOrigin(erasedInterfaceFunction),
|
||||
ACC_SYNTHETIC | ACC_PRIVATE | ACC_FINAL,
|
||||
FUNCTION_FIELD_NAME,
|
||||
functionAsmType.getDescriptor(),
|
||||
@@ -114,7 +115,7 @@ public class SamWrapperCodegen {
|
||||
}
|
||||
|
||||
private void generateConstructor(Type ownerType, Type functionType, ClassBuilder cv) {
|
||||
MethodVisitor mv = cv.newMethod(OtherOrigin(samType.getJavaClassDescriptor()),
|
||||
MethodVisitor mv = cv.newMethod(JvmDeclarationOriginKt.OtherOrigin(samType.getJavaClassDescriptor()),
|
||||
NO_FLAG_PACKAGE_PRIVATE, "<init>", Type.getMethodDescriptor(Type.VOID_TYPE, functionType), null, null);
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
@@ -61,7 +62,7 @@ public class ScriptCodegen extends MemberCodegen<JetScript> {
|
||||
|
||||
Type classType = asmTypeForScriptDescriptor(bindingContext, scriptDescriptor);
|
||||
|
||||
ClassBuilder builder = state.getFactory().newVisitor(OtherOrigin(declaration, classDescriptorForScript),
|
||||
ClassBuilder builder = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(declaration, classDescriptorForScript),
|
||||
classType, declaration.getContainingFile());
|
||||
List<ScriptDescriptor> earlierScripts = state.getEarlierScriptsForReplInterpreter();
|
||||
ScriptContext scriptContext = parentContext.intoScript(
|
||||
@@ -124,14 +125,14 @@ public class ScriptCodegen extends MemberCodegen<JetScript> {
|
||||
Type blockType = typeMapper.mapType(scriptDescriptor.getScriptCodeDescriptor().getReturnType());
|
||||
|
||||
PropertyDescriptor scriptResultProperty = scriptDescriptor.getScriptResultProperty();
|
||||
classBuilder.newField(OtherOrigin(scriptResultProperty),
|
||||
classBuilder.newField(JvmDeclarationOriginKt.OtherOrigin(scriptResultProperty),
|
||||
ACC_PUBLIC | ACC_FINAL, scriptResultProperty.getName().asString(),
|
||||
blockType.getDescriptor(), null, null);
|
||||
|
||||
JvmMethodSignature jvmSignature = typeMapper.mapScriptSignature(scriptDescriptor, context.getEarlierScripts());
|
||||
|
||||
MethodVisitor mv = classBuilder.newMethod(
|
||||
OtherOrigin(scriptDeclaration, scriptDescriptor.getClassDescriptor().getUnsubstitutedPrimaryConstructor()),
|
||||
JvmDeclarationOriginKt.OtherOrigin(scriptDeclaration, scriptDescriptor.getClassDescriptor().getUnsubstitutedPrimaryConstructor()),
|
||||
ACC_PUBLIC, jvmSignature.getAsmMethod().getName(), jvmSignature.getAsmMethod().getDescriptor(),
|
||||
null, null);
|
||||
|
||||
@@ -216,7 +217,7 @@ public class ScriptCodegen extends MemberCodegen<JetScript> {
|
||||
for (ValueParameterDescriptor parameter : script.getScriptCodeDescriptor().getValueParameters()) {
|
||||
Type parameterType = typeMapper.mapType(parameter);
|
||||
int access = ACC_PUBLIC | ACC_FINAL;
|
||||
classBuilder.newField(OtherOrigin(parameter), access, parameter.getName().getIdentifier(), parameterType.getDescriptor(), null, null);
|
||||
classBuilder.newField(JvmDeclarationOriginKt.OtherOrigin(parameter), access, parameter.getName().getIdentifier(), parameterType.getDescriptor(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
@@ -548,7 +548,7 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
private static StackValue platformStaticCallIfPresent(@NotNull StackValue resultReceiver, @NotNull CallableDescriptor descriptor) {
|
||||
if (AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)) {
|
||||
if (AnnotationUtilKt.isPlatformStaticInObjectOrClass(descriptor)) {
|
||||
if (resultReceiver.canHaveSideEffects()) {
|
||||
return coercion(resultReceiver, Type.VOID_TYPE);
|
||||
}
|
||||
@@ -1312,7 +1312,7 @@ public abstract class StackValue {
|
||||
else if (dispatchReceiver != null) {
|
||||
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
||||
|
||||
if (AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)) {
|
||||
if (AnnotationUtilKt.isPlatformStaticInObjectOrClass(descriptor)) {
|
||||
return Type.VOID_TYPE;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.JetSimpleNameExpression;
|
||||
import org.jetbrains.kotlin.psi.ValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
@@ -107,7 +108,7 @@ public class TailRecursionCodegen {
|
||||
JetExpression argumentExpression = argument == null ? null : argument.getArgumentExpression();
|
||||
|
||||
if (argumentExpression instanceof JetSimpleNameExpression) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(argumentExpression, state.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(argumentExpression, state.getBindingContext());
|
||||
if (resolvedCall != null && resolvedCall.getResultingDescriptor().equals(parameterDescriptor.getOriginal())) {
|
||||
// do nothing: we shouldn't store argument to itself again
|
||||
AsmUtil.pop(v, type);
|
||||
|
||||
+8
-8
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.codegen.when.SwitchCodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClassesPackage;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClasses;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||
@@ -50,7 +50,7 @@ import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.NullValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.resolve.source.SourcePackage;
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
|
||||
@@ -99,7 +99,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
Name.special("<closure-" + simpleName + ">"),
|
||||
Modality.FINAL,
|
||||
supertypes,
|
||||
SourcePackage.toSourceElement(element)
|
||||
KotlinSourceElementKt.toSourceElement(element)
|
||||
);
|
||||
classDescriptor.initialize(JetScope.Empty.INSTANCE$, Collections.<ConstructorDescriptor>emptySet(), null);
|
||||
|
||||
@@ -288,7 +288,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression) {
|
||||
ResolvedCall<?> referencedFunction = CallUtilPackage.getResolvedCall(expression.getCallableReference(), bindingContext);
|
||||
ResolvedCall<?> referencedFunction = CallUtilKt.getResolvedCall(expression.getCallableReference(), bindingContext);
|
||||
if (referencedFunction == null) return;
|
||||
CallableDescriptor target = referencedFunction.getResultingDescriptor();
|
||||
|
||||
@@ -392,7 +392,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
else if (containingDeclaration instanceof PackageFragmentDescriptor) {
|
||||
JetFile containingFile = DescriptorToSourceUtils.getContainingFile(descriptor);
|
||||
assert containingFile != null : "File not found for " + descriptor;
|
||||
return FileClassesPackage.getFileClassInternalName(fileClassesProvider, containingFile) + '$' + name;
|
||||
return FileClasses.getFileClassInternalName(fileClassesProvider, containingFile) + '$' + name;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -405,7 +405,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
private void checkSamCall(@NotNull JetCallElement expression) {
|
||||
ResolvedCall<?> call = CallUtilPackage.getResolvedCall(expression, bindingContext);
|
||||
ResolvedCall<?> call = CallUtilKt.getResolvedCall(expression, bindingContext);
|
||||
if (call == null) return;
|
||||
|
||||
CallableDescriptor descriptor = call.getResultingDescriptor();
|
||||
@@ -573,7 +573,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
}
|
||||
|
||||
return FileClassesPackage.getFacadeClassInternalName(fileClassesProvider, file);
|
||||
return FileClasses.getFacadeClassInternalName(fileClassesProvider, file);
|
||||
}
|
||||
|
||||
private static <T> T peekFromStack(@NotNull Stack<T> stack) {
|
||||
|
||||
@@ -29,11 +29,12 @@ import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
|
||||
import org.jetbrains.kotlin.util.slicedMap.BasicWritableSlice;
|
||||
import org.jetbrains.kotlin.util.slicedMap.Slices;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
@@ -43,7 +44,6 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
|
||||
import static org.jetbrains.kotlin.resolve.source.SourcePackage.toSourceElement;
|
||||
|
||||
public class CodegenBinding {
|
||||
public static final WritableSlice<ClassDescriptor, MutableClosure> CLOSURE = Slices.createSimpleSlice();
|
||||
@@ -137,7 +137,7 @@ public class CodegenBinding {
|
||||
return asmTypeForAnonymousClass(bindingContext, variableDescriptor);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Couldn't compute ASM type for " + PsiUtilPackage.getElementTextWithContext(expression));
|
||||
throw new IllegalStateException("Couldn't compute ASM type for " + PsiUtilsKt.getElementTextWithContext(expression));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -207,14 +207,14 @@ public class CodegenBinding {
|
||||
) {
|
||||
ScriptDescriptor descriptor = trace.getBindingContext().get(SCRIPT, script);
|
||||
if (descriptor == null) {
|
||||
throw new IllegalStateException("Script descriptor is not found for PSI: " + PsiUtilPackage.getElementTextWithContext(script));
|
||||
throw new IllegalStateException("Script descriptor is not found for PSI: " + PsiUtilsKt.getElementTextWithContext(script));
|
||||
}
|
||||
|
||||
String simpleName = asmType.getInternalName().substring(asmType.getInternalName().lastIndexOf('/') + 1);
|
||||
ClassDescriptorImpl classDescriptor =
|
||||
new ClassDescriptorImpl(descriptor, Name.special("<script-" + simpleName + ">"), Modality.FINAL,
|
||||
Collections.singleton(DescriptorUtilPackage.getBuiltIns(descriptor).getAnyType()),
|
||||
toSourceElement(script));
|
||||
Collections.singleton(DescriptorUtilsKt.getBuiltIns(descriptor).getAnyType()),
|
||||
KotlinSourceElementKt.toSourceElement(script));
|
||||
classDescriptor.initialize(JetScope.Empty.INSTANCE$, Collections.<ConstructorDescriptor>emptySet(), null);
|
||||
|
||||
recordClosure(trace, classDescriptor, null, asmType, fileClassesManager);
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClassesPackage;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClasses;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -75,7 +75,7 @@ public final class PsiCodegenPredictor {
|
||||
|
||||
if (declaration instanceof JetNamedFunction) {
|
||||
Name name = ((JetNamedFunction) declaration).getNameAsName();
|
||||
return name == null ? null : FileClassesPackage.getFileClassInternalName(fileClassesProvider, containingFile) + "$" + name.asString();
|
||||
return name == null ? null : FileClasses.getFileClassInternalName(fileClassesProvider, containingFile) + "$" + name.asString();
|
||||
}
|
||||
|
||||
parentInternalName = AsmUtil.internalNameByFqNameWithoutInnerClasses(containingFile.getPackageFqName());
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationUtilKt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -65,7 +65,7 @@ public abstract class FieldOwnerContext<T extends DeclarationDescriptor> extends
|
||||
String actualName = descriptor2Name.get(descriptor);
|
||||
if (actualName != null) return actualName;
|
||||
|
||||
String newName = descriptor2Name.isEmpty() || AnnotationsPackage.hasJvmFieldAnnotation(descriptor)
|
||||
String newName = descriptor2Name.isEmpty() || AnnotationUtilKt.hasJvmFieldAnnotation(descriptor)
|
||||
? defaultPropertyName
|
||||
: defaultPropertyName + "$" + descriptor2Name.size();
|
||||
descriptor2Name.put(descriptor, newName);
|
||||
|
||||
@@ -65,8 +65,6 @@ import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLASS_FOR_SCRIPT;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil.addInlineMarker;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil.getConstant;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlinePackage.getClassFilePath;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlinePackage.getSourceFilePath;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionLiteral;
|
||||
|
||||
public class InlineCodegen extends CallGenerator {
|
||||
@@ -766,8 +764,8 @@ public class InlineCodegen extends CallGenerator {
|
||||
if (incrementalCompilationComponents == null || targetId == null) return;
|
||||
|
||||
IncrementalCache incrementalCache = incrementalCompilationComponents.getIncrementalCache(targetId);
|
||||
String sourceFile = getClassFilePath(sourceDescriptor, incrementalCache);
|
||||
String targetFile = getSourceFilePath(targetDescriptor);
|
||||
String sourceFile = InlineCodegenUtilsKt.getClassFilePath(sourceDescriptor, incrementalCache);
|
||||
String targetFile = InlineCodegenUtilsKt.getSourceFilePath(targetDescriptor);
|
||||
incrementalCache.registerInline(sourceFile, jvmSignature.toString(), targetFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.codegen.context.MethodContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClassesPackage;
|
||||
import org.jetbrains.kotlin.fileClasses.FileClasses;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinder;
|
||||
@@ -44,10 +44,9 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
@@ -173,7 +172,7 @@ public class InlineCodegenUtil {
|
||||
return PackageClassUtils.getPackageClassId(getFqName(containerDescriptor).toSafe());
|
||||
}
|
||||
if (containerDescriptor instanceof ClassDescriptor) {
|
||||
ClassId classId = DescriptorUtilPackage.getClassId((ClassDescriptor) containerDescriptor);
|
||||
ClassId classId = DescriptorUtilsKt.getClassId((ClassDescriptor) containerDescriptor);
|
||||
if (isInterface(containerDescriptor)) {
|
||||
FqName relativeClassName = classId.getRelativeClassName();
|
||||
//TODO test nested trait fun inlining
|
||||
@@ -205,7 +204,7 @@ public class InlineCodegenUtil {
|
||||
if (file == null) {
|
||||
implementationOwnerType = CodegenContextUtil.getImplementationOwnerClassType(codegenContext);
|
||||
} else {
|
||||
implementationOwnerType = FileClassesPackage.getFileClassType(fileClassesProvider, (JetFile) file);
|
||||
implementationOwnerType = FileClasses.getFileClassType(fileClassesProvider, (JetFile) file);
|
||||
}
|
||||
|
||||
if (implementationOwnerType == null) {
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.CommonPackage;
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.UtilKt;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
@@ -153,7 +153,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
||||
// Each group that corresponds to try/*catches*/finally contains tryCatch block with default handler.
|
||||
// For each such group we should insert corresponding finally before non-local return.
|
||||
// So we split all try blocks on current instructions to groups and process them independently
|
||||
List<TryBlockCluster<TryCatchBlockNodeInfo>> clustersFromInnermost = InlinePackage.doClustering(
|
||||
List<TryBlockCluster<TryCatchBlockNodeInfo>> clustersFromInnermost = TryBlockClusteringKt.doClustering(
|
||||
currentCoveringNodesFromInnermost);
|
||||
Iterator<TryBlockCluster<TryCatchBlockNodeInfo>> tryCatchBlockIterator = clustersFromInnermost.iterator();
|
||||
|
||||
@@ -304,7 +304,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
||||
) {
|
||||
|
||||
//copy tryCatchFinallies that totally in finally block
|
||||
List<TryBlockCluster<TryCatchBlockNodePosition>> clusters = InlinePackage.doClustering(tryCatchBlockPresentInFinally);
|
||||
List<TryBlockCluster<TryCatchBlockNodePosition>> clusters = TryBlockClusteringKt.doClustering(tryCatchBlockPresentInFinally);
|
||||
Map<LabelNode, TryBlockCluster<TryCatchBlockNodePosition>> handler2Cluster = new HashMap<LabelNode, TryBlockCluster<TryCatchBlockNodePosition>>();
|
||||
|
||||
IntervalMetaInfo<TryCatchBlockNodeInfo> tryBlocksMetaInfo = getTryBlocksMetaInfo();
|
||||
@@ -522,7 +522,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
||||
@Nullable
|
||||
private static AbstractInsnNode getNextMeaningful(@NotNull AbstractInsnNode node) {
|
||||
AbstractInsnNode result = node.getNext();
|
||||
while (result != null && !CommonPackage.isMeaningful(result)) {
|
||||
while (result != null && !UtilKt.isMeaningful(result)) {
|
||||
result = result.getNext();
|
||||
}
|
||||
return result;
|
||||
|
||||
+2
-3
@@ -21,8 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.optimization.boxing.RedundantBoxingMethodTransformer;
|
||||
import org.jetbrains.kotlin.codegen.optimization.boxing.RedundantNullCheckMethodTransformer;
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.CommonPackage;
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer;
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.UtilKt;
|
||||
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
@@ -83,7 +82,7 @@ public class OptimizationMethodVisitor extends MethodVisitor {
|
||||
transformer.transform("fake", methodNode);
|
||||
}
|
||||
}
|
||||
CommonPackage.prepareForEmitting(methodNode);
|
||||
UtilKt.prepareForEmitting(methodNode);
|
||||
}
|
||||
|
||||
methodNode.accept(new EndIgnoringMethodVisitorDecorator(Opcodes.ASM5, delegate));
|
||||
|
||||
@@ -51,10 +51,11 @@ import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetFunctionLiteral;
|
||||
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
|
||||
@@ -80,7 +81,6 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.isVarCapturedInClosure;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.DEFAULT_CONSTRUCTOR_MARKER;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
@@ -562,7 +562,7 @@ public class JetTypeMapper {
|
||||
|
||||
if (declarationElement == null) {
|
||||
String message = "Error type encountered: %s (%s).";
|
||||
if (TypesPackage.upperIfFlexible(type) instanceof DeserializedType) {
|
||||
if (FlexibleTypesKt.upperIfFlexible(type) instanceof DeserializedType) {
|
||||
message +=
|
||||
" One of the possible reasons may be that this type is not directly accessible from this module. " +
|
||||
"To workaround this error, try adding an explicit dependency on the module or library which contains this type " +
|
||||
@@ -719,7 +719,7 @@ public class JetTypeMapper {
|
||||
boolean isStaticInvocation = (isStaticDeclaration(functionDescriptor) &&
|
||||
!(functionDescriptor instanceof ImportedFromObjectCallableDescriptor)) ||
|
||||
isStaticAccessor(functionDescriptor) ||
|
||||
AnnotationsPackage.isPlatformStaticInObjectOrClass(functionDescriptor);
|
||||
AnnotationUtilKt.isPlatformStaticInObjectOrClass(functionDescriptor);
|
||||
if (isStaticInvocation) {
|
||||
invokeOpcode = INVOKESTATIC;
|
||||
}
|
||||
@@ -1161,8 +1161,8 @@ public class JetTypeMapper {
|
||||
|
||||
ClassDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
if (containingDeclaration.getKind() == ClassKind.ENUM_CLASS || containingDeclaration.getKind() == ClassKind.ENUM_ENTRY) {
|
||||
writeParameter(sw, JvmMethodParameterKind.ENUM_NAME_OR_ORDINAL, getBuiltIns(descriptor).getStringType());
|
||||
writeParameter(sw, JvmMethodParameterKind.ENUM_NAME_OR_ORDINAL, getBuiltIns(descriptor).getIntType());
|
||||
writeParameter(sw, JvmMethodParameterKind.ENUM_NAME_OR_ORDINAL, DescriptorUtilsKt.getBuiltIns(descriptor).getStringType());
|
||||
writeParameter(sw, JvmMethodParameterKind.ENUM_NAME_OR_ORDINAL, DescriptorUtilsKt.getBuiltIns(descriptor).getIntType());
|
||||
}
|
||||
|
||||
if (closure == null) return;
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -114,7 +114,7 @@ public final class AnalyzerWithCompilerReport {
|
||||
assert unresolved != null && !unresolved.isEmpty() :
|
||||
"Incomplete hierarchy should be reported with names of unresolved superclasses: " + fqName;
|
||||
message.append(" class ").append(fqName)
|
||||
.append(", unresolved supertypes: ").append(UtilsPackage.join(unresolved, ", "))
|
||||
.append(", unresolved supertypes: ").append(StringsKt.join(unresolved, ", "))
|
||||
.append("\n");
|
||||
}
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, message.toString(), CompilerMessageLocation.NO_LOCATION);
|
||||
|
||||
@@ -37,12 +37,13 @@ import org.jetbrains.kotlin.cli.common.ExitCode;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
|
||||
import org.jetbrains.kotlin.cli.common.messages.*;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsPackage;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.CompilerJarLocator;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JVMConfigurationKeys;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.config.ContentRootsKt;
|
||||
import org.jetbrains.kotlin.config.Services;
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
||||
import org.jetbrains.kotlin.js.analyze.TopDownAnalyzerFacadeForJS;
|
||||
@@ -62,7 +63,6 @@ import java.util.List;
|
||||
import static org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR;
|
||||
import static org.jetbrains.kotlin.cli.common.ExitCode.OK;
|
||||
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation.NO_LOCATION;
|
||||
import static org.jetbrains.kotlin.config.ConfigPackage.addKotlinSourceRoots;
|
||||
|
||||
public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
|
||||
@@ -100,7 +100,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
configuration.put(JVMConfigurationKeys.COMPILER_JAR_LOCATOR, locator);
|
||||
}
|
||||
|
||||
addKotlinSourceRoots(configuration, arguments.freeArgs);
|
||||
ContentRootsKt.addKotlinSourceRoots(configuration, arguments.freeArgs);
|
||||
KotlinCoreEnvironment environmentForJS =
|
||||
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||
|
||||
OutputUtilsPackage.writeAll(outputFiles, outputDir, messageSeverityCollector);
|
||||
OutputUtilsKt.writeAll(outputFiles, outputDir, messageSeverityCollector);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ import org.jetbrains.kotlin.codegen.ClassFileFactory;
|
||||
import org.jetbrains.kotlin.idea.JetFileType;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
@@ -105,10 +105,10 @@ public class CompileEnvironmentUtil {
|
||||
throw new CompileEnvironmentException("Invalid jar path " + jarPath, e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
finally {
|
||||
UtilsPackage.closeQuietly(outputStream);
|
||||
ExceptionUtilsKt.closeQuietly(outputStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-14
@@ -34,12 +34,15 @@ import org.jetbrains.kotlin.cli.common.CompilerPlugin;
|
||||
import org.jetbrains.kotlin.cli.common.CompilerPluginContext;
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport;
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsPackage;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JVMConfigurationKeys;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.ModuleNameKt;
|
||||
import org.jetbrains.kotlin.codegen.*;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.config.ContentRootsKt;
|
||||
import org.jetbrains.kotlin.context.ModuleContext;
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager;
|
||||
@@ -47,8 +50,8 @@ import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents;
|
||||
import org.jetbrains.kotlin.modules.Module;
|
||||
import org.jetbrains.kotlin.modules.ModulesPackage;
|
||||
import org.jetbrains.kotlin.modules.TargetId;
|
||||
import org.jetbrains.kotlin.modules.TargetIdKt;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
||||
@@ -60,8 +63,6 @@ import org.jetbrains.kotlin.resolve.BindingTraceContext;
|
||||
import org.jetbrains.kotlin.resolve.ScriptNameUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM;
|
||||
import org.jetbrains.kotlin.serialization.PackageData;
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil;
|
||||
import org.jetbrains.kotlin.util.PerformanceCounter;
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths;
|
||||
|
||||
@@ -71,9 +72,6 @@ import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.*;
|
||||
import static org.jetbrains.kotlin.config.ConfigPackage.addKotlinSourceRoots;
|
||||
|
||||
public class KotlinToJVMBytecodeCompiler {
|
||||
|
||||
private KotlinToJVMBytecodeCompiler() {
|
||||
@@ -106,7 +104,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
}
|
||||
else {
|
||||
MessageCollector messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE);
|
||||
OutputUtilsPackage.writeAll(outputFiles, outputDir == null ? new File(".") : outputDir, messageCollector);
|
||||
OutputUtilsKt.writeAll(outputFiles, outputDir == null ? new File(".") : outputDir, messageCollector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,18 +172,18 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
CompilerConfiguration configuration = base.copy();
|
||||
|
||||
for (Module module : chunk) {
|
||||
addKotlinSourceRoots(configuration, getAbsolutePaths(directory, module));
|
||||
ContentRootsKt.addKotlinSourceRoots(configuration, getAbsolutePaths(directory, module));
|
||||
}
|
||||
|
||||
for (Module module : chunk) {
|
||||
for (String javaSourceRoot : module.getJavaSourceRoots()) {
|
||||
addJavaSourceRoot(configuration, new File(javaSourceRoot));
|
||||
JvmContentRootsKt.addJavaSourceRoot(configuration, new File(javaSourceRoot));
|
||||
}
|
||||
}
|
||||
|
||||
for (Module module : chunk) {
|
||||
for (String classpathRoot : module.getClasspathRoots()) {
|
||||
addJvmClasspathRoot(configuration, new File(classpathRoot));
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, new File(classpathRoot));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +274,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
GeneratedClassLoader classLoader;
|
||||
try {
|
||||
List<URL> classPaths = Lists.newArrayList(paths.getRuntimePath().toURI().toURL());
|
||||
for (File file : getJvmClasspathRoots(configuration)) {
|
||||
for (File file : JvmContentRootsKt.getJvmClasspathRoots(configuration)) {
|
||||
classPaths.add(file.toURI().toURL());
|
||||
}
|
||||
//noinspection UnnecessaryFullyQualifiedName
|
||||
@@ -321,7 +319,8 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
public AnalysisResult invoke() {
|
||||
BindingTrace sharedTrace = new CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace();
|
||||
ModuleContext moduleContext = TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(environment.getProject(),
|
||||
getModuleName(environment));
|
||||
ModuleNameKt
|
||||
.getModuleName(environment));
|
||||
|
||||
return TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationWithCustomContext(
|
||||
moduleContext,
|
||||
@@ -374,7 +373,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
obsoleteMultifileClasses = Collections.emptyList();
|
||||
}
|
||||
else {
|
||||
targetId = ModulesPackage.TargetId(module);
|
||||
targetId = TargetIdKt.TargetId(module);
|
||||
IncrementalCache incrementalCache = incrementalCompilationComponents.getIncrementalCache(targetId);
|
||||
|
||||
packagesWithObsoleteParts = new HashSet<FqName>();
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.cli.jvm.repl.reader.ConsoleReplCommandReader;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.reader.IdeReplCommandReader;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.reader.ReplCommandReader;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
@@ -109,13 +109,13 @@ public class ReplFromTerminal {
|
||||
waitRepl.wait();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
if (replInterpreter != null) {
|
||||
return replInterpreter;
|
||||
}
|
||||
throw UtilsPackage.rethrow(replInitializationFailed);
|
||||
throw ExceptionUtilsKt.rethrow(replInitializationFailed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public class ReplFromTerminal {
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,10 @@ import org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.ModuleNameKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.di.ContainerForReplWithJava;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.di.DiPackage;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.di.InjectionKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.messages.DiagnosticMessageHolder;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.messages.ReplIdeDiagnosticMessageHolder;
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.messages.ReplSystemInWrapper;
|
||||
@@ -68,7 +70,7 @@ import org.jetbrains.kotlin.resolve.lazy.data.JetClassLikeInfo;
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.*;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
|
||||
import java.io.File;
|
||||
@@ -83,8 +85,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.getJvmClasspathRoots;
|
||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.getModuleName;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.asmTypeByFqNameWithoutInnerClasses;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.registerClassNameForScript;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
|
||||
@@ -121,7 +121,8 @@ public class ReplInterpreter {
|
||||
Project project = environment.getProject();
|
||||
this.psiFileFactory = (PsiFileFactoryImpl) PsiFileFactory.getInstance(project);
|
||||
this.trace = new CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace();
|
||||
MutableModuleContext moduleContext = TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, getModuleName(environment));
|
||||
MutableModuleContext moduleContext = TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, ModuleNameKt
|
||||
.getModuleName(environment));
|
||||
this.module = moduleContext.getModule();
|
||||
|
||||
scriptDeclarationFactory = new ScriptMutableDeclarationProviderFactory();
|
||||
@@ -134,7 +135,7 @@ public class ReplInterpreter {
|
||||
}
|
||||
};
|
||||
|
||||
ContainerForReplWithJava container = DiPackage.createContainerForReplWithJava(
|
||||
ContainerForReplWithJava container = InjectionKt.createContainerForReplWithJava(
|
||||
moduleContext,
|
||||
trace,
|
||||
scriptDeclarationFactory,
|
||||
@@ -156,12 +157,12 @@ public class ReplInterpreter {
|
||||
));
|
||||
|
||||
List<URL> classpath = Lists.newArrayList();
|
||||
for (File file : getJvmClasspathRoots(configuration)) {
|
||||
for (File file : JvmContentRootsKt.getJvmClasspathRoots(configuration)) {
|
||||
try {
|
||||
classpath.add(file.toURI().toURL());
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +364,7 @@ public class ReplInterpreter {
|
||||
PrintWriter writer = new PrintWriter(System.err);
|
||||
classLoader.dumpClasses(writer);
|
||||
writer.flush();
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.load.java.structure.JavaField;
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaMember;
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaMethod;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.kotlinSignature.AlternativeFieldSignatureData;
|
||||
import org.jetbrains.kotlin.resolve.jvm.kotlinSignature.AlternativeMethodSignatureData;
|
||||
import org.jetbrains.kotlin.resolve.jvm.kotlinSignature.SignaturesPropagationData;
|
||||
@@ -86,7 +86,7 @@ public class TraceBasedExternalSignatureResolver implements ExternalSignatureRes
|
||||
);
|
||||
|
||||
if (data.isAnnotated() && !data.hasErrors()) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) {
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) {
|
||||
return new AlternativeMethodSignature(returnType, receiverType, valueParameters,
|
||||
typeParameters, Collections.<String>emptyList(), hasStableParameterNames);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class TraceBasedExternalSignatureResolver implements ExternalSignatureRes
|
||||
AlternativeFieldSignatureData data = new AlternativeFieldSignatureData(field, returnType, project, isVar);
|
||||
|
||||
if (data.isAnnotated() && !data.hasErrors()) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) {
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) {
|
||||
return new AlternativeFieldSignature(returnType, null);
|
||||
}
|
||||
return new AlternativeFieldSignature(data.getReturnType(), null);
|
||||
|
||||
+4
-4
@@ -29,13 +29,13 @@ import org.jetbrains.kotlin.load.java.lazy.types.LazyJavaTypeResolver;
|
||||
import org.jetbrains.kotlin.load.java.structure.*;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaResolverUtils;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.types.Variance.INVARIANT;
|
||||
|
||||
public class SingleAbstractMethodUtils {
|
||||
@@ -103,7 +103,7 @@ public class SingleAbstractMethodUtils {
|
||||
JetType type = fixProjections(substitute);
|
||||
if (type == null) return null;
|
||||
|
||||
if (JvmPackage.getPLATFORM_TYPES() && TypesPackage.isNullabilityFlexible(samType)) {
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES() && FlexibleTypesKt.isNullabilityFlexible(samType)) {
|
||||
return LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create(type, TypeUtils.makeNullable(type));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class SingleAbstractMethodUtils {
|
||||
for (ValueParameterDescriptor parameter : valueParameters) {
|
||||
parameterTypes.add(parameter.getType());
|
||||
}
|
||||
return getBuiltIns(function).getFunctionType(Annotations.Companion.getEMPTY(), null, parameterTypes, returnType);
|
||||
return DescriptorUtilsKt.getBuiltIns(function).getFunctionType(Annotations.Companion.getEMPTY(), null, parameterTypes, returnType);
|
||||
}
|
||||
|
||||
private static boolean isSamInterface(@NotNull ClassDescriptor klass) {
|
||||
|
||||
+6
-5
@@ -21,21 +21,22 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
import org.jetbrains.kotlin.context.ContextKt;
|
||||
import org.jetbrains.kotlin.context.ModuleContext;
|
||||
import org.jetbrains.kotlin.context.MutableModuleContext;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider;
|
||||
import org.jetbrains.kotlin.descriptors.PackagePartProvider;
|
||||
import org.jetbrains.kotlin.frontend.java.di.ContainerForTopDownAnalyzerForJvm;
|
||||
import org.jetbrains.kotlin.frontend.java.di.DiPackage;
|
||||
import org.jetbrains.kotlin.frontend.java.di.InjectionKt;
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackagePartProvider;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents;
|
||||
import org.jetbrains.kotlin.modules.Module;
|
||||
import org.jetbrains.kotlin.modules.ModulesPackage;
|
||||
import org.jetbrains.kotlin.modules.TargetId;
|
||||
import org.jetbrains.kotlin.modules.TargetIdKt;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -104,13 +105,13 @@ public enum TopDownAnalyzerFacadeForJVM {
|
||||
targetIds = new ArrayList<TargetId>(modules.size());
|
||||
|
||||
for (Module module : modules) {
|
||||
targetIds.add(ModulesPackage.TargetId(module));
|
||||
targetIds.add(TargetIdKt.TargetId(module));
|
||||
}
|
||||
}
|
||||
|
||||
packagePartProvider = IncrementalPackagePartProvider.create(packagePartProvider, files, targetIds, incrementalCompilationComponents, moduleContext.getStorageManager());
|
||||
|
||||
ContainerForTopDownAnalyzerForJvm container = DiPackage.createContainerForTopDownAnalyzerForJvm(
|
||||
ContainerForTopDownAnalyzerForJvm container = InjectionKt.createContainerForTopDownAnalyzerForJvm(
|
||||
moduleContext,
|
||||
trace,
|
||||
providerFactory,
|
||||
@@ -154,7 +155,7 @@ public enum TopDownAnalyzerFacadeForJVM {
|
||||
|
||||
@NotNull
|
||||
public static MutableModuleContext createContextWithSealedModule(@NotNull Project project, @NotNull String moduleName) {
|
||||
MutableModuleContext context = ContextForNewModule(
|
||||
MutableModuleContext context = ContextKt.ContextForNewModule(
|
||||
project, Name.special("<" + moduleName + ">"), JvmPlatform.INSTANCE$
|
||||
);
|
||||
context.setDependencies(context.getModule(), JvmPlatform.INSTANCE$.getBuiltIns().getBuiltInsModule());
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaField;
|
||||
import org.jetbrains.kotlin.psi.JetProperty;
|
||||
import org.jetbrains.kotlin.psi.JetPsiFactoryKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -46,7 +47,7 @@ public class AlternativeFieldSignatureData extends ElementAlternativeSignatureDa
|
||||
}
|
||||
|
||||
setAnnotated(true);
|
||||
JetProperty altPropertyDeclaration = JetPsiFactory(project).createProperty(signature);
|
||||
JetProperty altPropertyDeclaration = JetPsiFactoryKt.JetPsiFactory(project).createProperty(signature);
|
||||
|
||||
try {
|
||||
checkForSyntaxErrors(altPropertyDeclaration);
|
||||
|
||||
+5
-8
@@ -22,7 +22,6 @@ import com.intellij.util.containers.ComparatorUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
@@ -31,16 +30,14 @@ import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaMember;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaResolverUtils;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.Variance;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -83,7 +80,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
}
|
||||
|
||||
setAnnotated(true);
|
||||
altFunDeclaration = JetPsiFactory(project).createFunction(signature);
|
||||
altFunDeclaration = JetPsiFactoryKt.JetPsiFactory(project).createFunction(signature);
|
||||
|
||||
originalToAltTypeParameters = JavaResolverUtils.recreateTypeParametersAndReturnMapping(methodTypeParameters, null);
|
||||
|
||||
@@ -125,7 +122,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
@NotNull List<TypeParameterDescriptor> methodTypeParameters,
|
||||
@Nullable JetType returnType
|
||||
) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return;
|
||||
TypeSubstitutor substitutor = JavaResolverUtils.createSubstitutorForTypeParameters(originalToAltTypeParameters);
|
||||
|
||||
for (ValueParameterDescriptor parameter : valueParameters) {
|
||||
@@ -260,7 +257,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
if (altUpperBounds.size() != originalUpperBounds.size()) {
|
||||
if (altUpperBounds.isEmpty()
|
||||
&& originalUpperBounds.size() == 1
|
||||
&& TypeUtilPackage.isDefaultBound(originalUpperBounds.iterator().next())) {
|
||||
&& TypeUtilsKt.isDefaultBound(originalUpperBounds.iterator().next())) {
|
||||
// Only default bound => no error
|
||||
}
|
||||
else {
|
||||
|
||||
+8
-8
@@ -39,11 +39,12 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaResolverUtils;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmSignaturePackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.KotlinToJvmSignatureMapper;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.KotlinToJvmSignatureMapperKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
|
||||
@@ -51,7 +52,6 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.load.java.components.TypeUsage.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.types.Variance.INVARIANT;
|
||||
|
||||
public class SignaturesPropagationData {
|
||||
@@ -156,7 +156,7 @@ public class SignaturesPropagationData {
|
||||
private JetType modifyReturnTypeAccordingToSuperMethods(
|
||||
@NotNull JetType autoType // type built by JavaTypeTransformer
|
||||
) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return autoType;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return autoType;
|
||||
|
||||
List<TypeAndVariance> typesFromSuperMethods = ContainerUtil.map(superFunctions,
|
||||
new Function<FunctionDescriptor, TypeAndVariance>() {
|
||||
@@ -171,7 +171,7 @@ public class SignaturesPropagationData {
|
||||
}
|
||||
|
||||
private List<TypeParameterDescriptor> modifyTypeParametersAccordingToSuperMethods(List<TypeParameterDescriptor> autoTypeParameters) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return autoTypeParameters;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return autoTypeParameters;
|
||||
|
||||
List<TypeParameterDescriptor> result = Lists.newArrayList();
|
||||
|
||||
@@ -266,7 +266,7 @@ public class SignaturesPropagationData {
|
||||
stableName != null ? stableName : originalParam.getName(),
|
||||
altType,
|
||||
originalParam.declaresDefaultValue(),
|
||||
varargCheckResult.isVararg ? getBuiltIns(originalParam).getArrayElementType(altType) : null,
|
||||
varargCheckResult.isVararg ? DescriptorUtilsKt.getBuiltIns(originalParam).getArrayElementType(altType) : null,
|
||||
SourceElement.NO_SOURCE
|
||||
));
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class SignaturesPropagationData {
|
||||
Collection<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS);
|
||||
for (FunctionDescriptor candidate : superFunctionCandidates) {
|
||||
JvmMethodSignature candidateSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(candidate);
|
||||
if (JvmSignaturePackage.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) {
|
||||
if (KotlinToJvmSignatureMapperKt.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) {
|
||||
superFunctions.add(candidate);
|
||||
}
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public class SignaturesPropagationData {
|
||||
) {
|
||||
if (autoType.isError()) return autoType;
|
||||
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return autoType;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return autoType;
|
||||
|
||||
boolean resultNullable = typeMustBeNullable(autoType, typesFromSuper, howThisTypeIsUsed);
|
||||
ClassifierDescriptor resultClassifier = modifyTypeClassifier(autoType, typesFromSuper);
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
@@ -136,7 +136,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
List<TypeProjection> arguments = originalType.getArguments();
|
||||
|
||||
if (arguments.size() != type.getTypeArgumentsAsTypes().size()) {
|
||||
if (JvmPackage.getPLATFORM_TYPES()) return originalType;
|
||||
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return originalType;
|
||||
|
||||
throw new AlternativeSignatureMismatchException("'%s' type in method signature has %d type arguments, while '%s' in alternative signature has %d of them",
|
||||
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(originalType), arguments.size(), type.getText(),
|
||||
@@ -189,7 +189,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
if (type instanceof JetUserType) {
|
||||
JetTypeProjection typeProjection = ((JetUserType) type).getTypeArguments().get(i);
|
||||
altProjectionKind = TypeResolver.resolveProjectionKind(typeProjection.getProjectionKind());
|
||||
if (altProjectionKind != projectionKind && projectionKind != Variance.INVARIANT && !JvmPackage.getPLATFORM_TYPES()) {
|
||||
if (altProjectionKind != projectionKind && projectionKind != Variance.INVARIANT && !JavaDescriptorResolverKt.getPLATFORM_TYPES()) {
|
||||
throw new AlternativeSignatureMismatchException("Projection kind mismatch, actual: %s, in alternative signature: %s",
|
||||
projectionKind, altProjectionKind);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,12 @@ import org.jetbrains.kotlin.lexer.JetToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
@@ -270,7 +271,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
@NotNull
|
||||
private AccessTarget getResolvedCallAccessTarget(JetElement element) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(element, trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(element, trace.getBindingContext());
|
||||
return resolvedCall != null ? new AccessTarget.Call(resolvedCall) : AccessTarget.BlackBox.INSTANCE$;
|
||||
}
|
||||
|
||||
@@ -303,7 +304,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
@Override
|
||||
public void visitThisExpression(@NotNull JetThisExpression expression) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
|
||||
if (resolvedCall == null) {
|
||||
createNonSyntheticValue(expression, MagicKind.UNRESOLVED_CALL);
|
||||
return;
|
||||
@@ -325,7 +326,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
VariableAsFunctionResolvedCall variableAsFunctionResolvedCall = (VariableAsFunctionResolvedCall) resolvedCall;
|
||||
generateCall(variableAsFunctionResolvedCall.getVariableCall());
|
||||
@@ -360,7 +361,7 @@ public class JetControlFlowProcessor {
|
||||
visitAssignment(left, getDeferredValue(right), expression);
|
||||
}
|
||||
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
|
||||
if (resolvedCall != null) {
|
||||
PseudoValue rhsValue = generateCall(resolvedCall).getOutputValue();
|
||||
Name assignMethodName = OperatorConventions.getNameForOperationSymbol((JetToken) expression.getOperationToken());
|
||||
@@ -467,7 +468,7 @@ public class JetControlFlowProcessor {
|
||||
Map<PseudoValue, ReceiverValue> receiverValues = SmartFMap.emptyMap();
|
||||
AccessTarget accessTarget = AccessTarget.BlackBox.INSTANCE$;
|
||||
if (left instanceof JetSimpleNameExpression || left instanceof JetQualifiedExpression) {
|
||||
accessTarget = getResolvedCallAccessTarget(PsiUtilPackage.getQualifiedElementSelector(left));
|
||||
accessTarget = getResolvedCallAccessTarget(JetPsiUtilKt.getQualifiedElementSelector(left));
|
||||
if (accessTarget instanceof AccessTarget.Call) {
|
||||
receiverValues = getReceiverValues(((AccessTarget.Call) accessTarget).getResolvedCall());
|
||||
}
|
||||
@@ -602,7 +603,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
boolean incrementOrDecrement = isIncrementOrDecrement(operationType);
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
|
||||
|
||||
PseudoValue rhsValue;
|
||||
if (resolvedCall != null) {
|
||||
@@ -1472,7 +1473,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
private boolean generateCall(@Nullable JetElement callElement) {
|
||||
if (callElement == null) return false;
|
||||
return checkAndGenerateCall(getResolvedCall(callElement, trace.getBindingContext()));
|
||||
return checkAndGenerateCall(CallUtilKt.getResolvedCall(callElement, trace.getBindingContext()));
|
||||
}
|
||||
|
||||
private boolean checkAndGenerateCall(@Nullable ResolvedCall<?> resolvedCall) {
|
||||
|
||||
@@ -30,10 +30,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.cfg.PseudocodeVariablesData.VariableControlFlowState;
|
||||
import org.jetbrains.kotlin.cfg.PseudocodeVariablesData.VariableUseState;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.PseudocodePackage;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.PseudocodeUtil;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.*;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.JetElementInstruction;
|
||||
@@ -44,7 +41,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.MarkInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineExitInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.VariableDeclarationInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.Edges;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserPackage;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserKt;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.TraversalOrder;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptorKt;
|
||||
@@ -55,10 +52,10 @@ import org.jetbrains.kotlin.idea.MainFunctionDetector;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
||||
@@ -311,7 +308,7 @@ public class JetFlowInformationProvider {
|
||||
|
||||
final Map<Instruction, DiagnosticFactory<?>> reportedDiagnosticMap = Maps.newHashMap();
|
||||
|
||||
PseudocodeTraverserPackage.traverse(
|
||||
PseudocodeTraverserKt.traverse(
|
||||
pseudocode, FORWARD, initializers,
|
||||
new InstructionDataAnalyzeStrategy<Map<VariableDescriptor, VariableControlFlowState>>() {
|
||||
@Override
|
||||
@@ -424,7 +421,7 @@ public class JetFlowInformationProvider {
|
||||
DeclarationDescriptor descriptor = BindingContextUtils.getEnclosingDescriptor(trace.getBindingContext(), expression);
|
||||
PropertySetterDescriptor setterDescriptor = ((PropertyDescriptor) variableDescriptor).getSetter();
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilPackage.getResolvedCall(expression, trace.getBindingContext());
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
|
||||
ReceiverValue receiverValue = ReceiverValue.IRRELEVANT_RECEIVER;
|
||||
if (resolvedCall != null) {
|
||||
receiverValue = ExpressionTypingUtils
|
||||
@@ -708,7 +705,7 @@ public class JetFlowInformationProvider {
|
||||
}
|
||||
}
|
||||
};
|
||||
PseudocodeTraverserPackage.traverse(pseudocode, TraversalOrder.BACKWARD, variableStatusData, variableStatusAnalyzeStrategy);
|
||||
PseudocodeTraverserKt.traverse(pseudocode, TraversalOrder.BACKWARD, variableStatusData, variableStatusAnalyzeStrategy);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -716,7 +713,7 @@ public class JetFlowInformationProvider {
|
||||
|
||||
public void markUnusedExpressions() {
|
||||
final Map<Instruction, DiagnosticFactory<?>> reportedDiagnosticMap = Maps.newHashMap();
|
||||
PseudocodeTraverserPackage.traverse(
|
||||
PseudocodeTraverserKt.traverse(
|
||||
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
|
||||
@Override
|
||||
public void execute(@NotNull Instruction instruction) {
|
||||
@@ -725,8 +722,8 @@ public class JetFlowInformationProvider {
|
||||
JetElement element = ((JetElementInstruction)instruction).getElement();
|
||||
if (!(element instanceof JetExpression)) return;
|
||||
|
||||
if (BindingContextUtilPackage.isUsedAsStatement((JetExpression) element, trace.getBindingContext())
|
||||
&& PseudocodePackage.getSideEffectFree(instruction)) {
|
||||
if (BindingContextUtilsKt.isUsedAsStatement((JetExpression) element, trace.getBindingContext())
|
||||
&& PseudocodeUtilsKt.getSideEffectFree(instruction)) {
|
||||
VariableContext ctxt = new VariableContext(instruction, reportedDiagnosticMap);
|
||||
report(
|
||||
element instanceof JetFunctionLiteralExpression
|
||||
@@ -744,7 +741,7 @@ public class JetFlowInformationProvider {
|
||||
// Statements
|
||||
|
||||
public void markStatements() {
|
||||
PseudocodeTraverserPackage.traverse(
|
||||
PseudocodeTraverserKt.traverse(
|
||||
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
|
||||
@Override
|
||||
public void execute(@NotNull Instruction instruction) {
|
||||
@@ -762,7 +759,7 @@ public class JetFlowInformationProvider {
|
||||
}
|
||||
|
||||
public void markWhenWithoutElse() {
|
||||
PseudocodeTraverserPackage.traverse(
|
||||
PseudocodeTraverserKt.traverse(
|
||||
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
|
||||
@Override
|
||||
public void execute(@NotNull Instruction instruction) {
|
||||
@@ -810,7 +807,7 @@ public class JetFlowInformationProvider {
|
||||
}
|
||||
}
|
||||
final Map<JetElement, KindAndCall> calls = new HashMap<JetElement, KindAndCall>();
|
||||
PseudocodeTraverserPackage.traverse(
|
||||
PseudocodeTraverserKt.traverse(
|
||||
pseudocode,
|
||||
FORWARD,
|
||||
new FunctionVoid1<Instruction>() {
|
||||
@@ -818,7 +815,7 @@ public class JetFlowInformationProvider {
|
||||
if (!(instruction instanceof CallInstruction)) return;
|
||||
CallInstruction callInstruction = (CallInstruction) instruction;
|
||||
|
||||
ResolvedCall<?> resolvedCall = getResolvedCall(callInstruction.getElement(), trace.getBindingContext());
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(callInstruction.getElement(), trace.getBindingContext());
|
||||
if (resolvedCall == null) return;
|
||||
|
||||
// is this a recursive call?
|
||||
@@ -839,7 +836,7 @@ public class JetFlowInformationProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isTail = PseudocodeTraverserPackage.traverseFollowingInstructions(
|
||||
boolean isTail = PseudocodeTraverserKt.traverseFollowingInstructions(
|
||||
callInstruction,
|
||||
new HashSet<Instruction>(),
|
||||
FORWARD,
|
||||
@@ -853,7 +850,7 @@ public class JetFlowInformationProvider {
|
||||
// }
|
||||
// }
|
||||
boolean sameDispatchReceiver =
|
||||
ResolvedCallUtilPackage.hasThisOrNoDispatchReceiver(resolvedCall, trace.getBindingContext());
|
||||
ResolvedCallUtilKt.hasThisOrNoDispatchReceiver(resolvedCall, trace.getBindingContext());
|
||||
|
||||
TailRecursionKind kind = isTail && sameDispatchReceiver ? TAIL_CALL : NON_TAIL;
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
|
||||
import org.jetbrains.kotlin.types.FlexibleTypesKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
|
||||
@@ -34,7 +35,6 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumClass;
|
||||
import static org.jetbrains.kotlin.types.TypesPackage.isFlexible;
|
||||
|
||||
public final class WhenChecker {
|
||||
private WhenChecker() {
|
||||
@@ -44,7 +44,7 @@ public final class WhenChecker {
|
||||
JetType expectedType = trace.get(BindingContext.EXPECTED_EXPRESSION_TYPE, expression);
|
||||
boolean isUnit = expectedType != null && KotlinBuiltIns.isUnit(expectedType);
|
||||
// Some "statements" are actually expressions returned from lambdas, their expected types are non-null
|
||||
boolean isStatement = BindingContextUtilPackage.isUsedAsStatement(expression, trace.getBindingContext()) && expectedType == null;
|
||||
boolean isStatement = BindingContextUtilsKt.isUsedAsStatement(expression, trace.getBindingContext()) && expectedType == null;
|
||||
|
||||
return !isUnit && !isStatement && !isWhenExhaustive(expression, trace);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public final class WhenChecker {
|
||||
}
|
||||
if (exhaustive) {
|
||||
if (// Flexible (nullable) enum types are also counted as exhaustive
|
||||
(enumClassDescriptor != null && isFlexible(type))
|
||||
(enumClassDescriptor != null && FlexibleTypesKt.isFlexible(type))
|
||||
|| containsNullCase(expression, trace)
|
||||
|| !isNullableTypeWithoutPossibleSmartCast(expression.getSubjectExpression(), type, trace.getBindingContext())) {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.LocalFunctionDec
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineEnterInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineExitInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineSinkInstruction;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserPackage;
|
||||
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserKt;
|
||||
import org.jetbrains.kotlin.psi.JetElement;
|
||||
|
||||
import java.util.*;
|
||||
@@ -181,13 +181,13 @@ public class PseudocodeImpl implements Pseudocode {
|
||||
@Override
|
||||
public List<Instruction> getReversedInstructions() {
|
||||
LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet();
|
||||
PseudocodeTraverserPackage.traverseFollowingInstructions(sinkInstruction, traversedInstructions, BACKWARD, null);
|
||||
PseudocodeTraverserKt.traverseFollowingInstructions(sinkInstruction, traversedInstructions, BACKWARD, null);
|
||||
if (traversedInstructions.size() < instructions.size()) {
|
||||
List<Instruction> simplyReversedInstructions = Lists.newArrayList(instructions);
|
||||
Collections.reverse(simplyReversedInstructions);
|
||||
for (Instruction instruction : simplyReversedInstructions) {
|
||||
if (!traversedInstructions.contains(instruction)) {
|
||||
PseudocodeTraverserPackage.traverseFollowingInstructions(instruction, traversedInstructions, BACKWARD, null);
|
||||
PseudocodeTraverserKt.traverseFollowingInstructions(instruction, traversedInstructions, BACKWARD, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public class PseudocodeImpl implements Pseudocode {
|
||||
addValueUsage(mergedValue, instruction);
|
||||
}
|
||||
}
|
||||
if (PseudocodePackage.calcSideEffectFree(instruction)) {
|
||||
if (PseudocodeUtilsKt.calcSideEffectFree(instruction)) {
|
||||
sideEffectFree.add(instruction);
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ public class PseudocodeImpl implements Pseudocode {
|
||||
|
||||
private Set<Instruction> collectReachableInstructions() {
|
||||
Set<Instruction> visited = Sets.newHashSet();
|
||||
PseudocodeTraverserPackage.traverseFollowingInstructions(getEnterInstruction(), visited, FORWARD, null);
|
||||
PseudocodeTraverserKt.traverseFollowingInstructions(getEnterInstruction(), visited, FORWARD, null);
|
||||
if (!visited.contains(getExitInstruction())) {
|
||||
visited.add(getExitInstruction());
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
@@ -117,6 +117,6 @@ public class PseudocodeUtil {
|
||||
"AccessTarget.Declaration has no receivers and it's not BlackBox, so it should be Call";
|
||||
|
||||
ResolvedCall<?> accessResolvedCall = ((AccessTarget.Call) accessTarget).getResolvedCall();
|
||||
return ResolvedCallUtilPackage.hasThisOrNoDispatchReceiver(accessResolvedCall, bindingContext);
|
||||
return ResolvedCallUtilKt.hasThisOrNoDispatchReceiver(accessResolvedCall, bindingContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.TasksPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallsKt;
|
||||
import org.jetbrains.kotlin.types.ErrorUtils;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
@@ -127,7 +127,7 @@ public class DebugInfoUtil {
|
||||
|
||||
@Override
|
||||
public void visitThisExpression(@NotNull JetThisExpression expression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilPackage.getResolvedCall(expression, bindingContext);
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(expression, bindingContext);
|
||||
if (resolvedCall != null) {
|
||||
reportIfDynamic(expression, resolvedCall.getResultingDescriptor(), debugInfoReporter);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class DebugInfoUtil {
|
||||
}
|
||||
|
||||
private static boolean reportIfDynamic(JetElement element, DeclarationDescriptor declarationDescriptor, DebugInfoReporter debugInfoReporter) {
|
||||
if (declarationDescriptor != null && TasksPackage.isDynamic(declarationDescriptor)) {
|
||||
if (declarationDescriptor != null && DynamicCallsKt.isDynamic(declarationDescriptor)) {
|
||||
debugInfoReporter.reportDynamicCall(element, declarationDescriptor);
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-3
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1;
|
||||
import org.jetbrains.kotlin.renderer.Renderer;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
|
||||
|
||||
public class DiagnosticWithParameters1Renderer<A> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters1<?, A>> {
|
||||
private final Renderer<? super A> rendererForA;
|
||||
|
||||
@@ -34,6 +32,6 @@ public class DiagnosticWithParameters1Renderer<A> extends AbstractDiagnosticWith
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] renderParameters(@NotNull DiagnosticWithParameters1<?, A> diagnostic) {
|
||||
return new Object[]{renderParameter(diagnostic.getA(), rendererForA)};
|
||||
return new Object[]{DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA)};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2;
|
||||
import org.jetbrains.kotlin.renderer.Renderer;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
|
||||
|
||||
public class DiagnosticWithParameters2Renderer<A, B> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters2<?, A, B>> {
|
||||
private final Renderer<? super A> rendererForA;
|
||||
private final Renderer<? super B> rendererForB;
|
||||
@@ -37,7 +35,7 @@ public class DiagnosticWithParameters2Renderer<A, B> extends AbstractDiagnosticW
|
||||
@Override
|
||||
public Object[] renderParameters(@NotNull DiagnosticWithParameters2<?, A, B> diagnostic) {
|
||||
return new Object[]{
|
||||
renderParameter(diagnostic.getA(), rendererForA),
|
||||
renderParameter(diagnostic.getB(), rendererForB)};
|
||||
DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA),
|
||||
DiagnosticRendererUtilKt.renderParameter(diagnostic.getB(), rendererForB)};
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters3;
|
||||
import org.jetbrains.kotlin.renderer.Renderer;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
|
||||
|
||||
public class DiagnosticWithParameters3Renderer<A, B, C> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters3<?, A, B, C>> {
|
||||
private final Renderer<? super A> rendererForA;
|
||||
private final Renderer<? super B> rendererForB;
|
||||
@@ -42,8 +40,8 @@ public class DiagnosticWithParameters3Renderer<A, B, C> extends AbstractDiagnost
|
||||
@Override
|
||||
public Object[] renderParameters(@NotNull DiagnosticWithParameters3<?, A, B, C> diagnostic) {
|
||||
return new Object[]{
|
||||
renderParameter(diagnostic.getA(), rendererForA),
|
||||
renderParameter(diagnostic.getB(), rendererForB),
|
||||
renderParameter(diagnostic.getC(), rendererForC)};
|
||||
DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA),
|
||||
DiagnosticRendererUtilKt.renderParameter(diagnostic.getB(), rendererForB),
|
||||
DiagnosticRendererUtilKt.renderParameter(diagnostic.getC(), rendererForC)};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetNamedFunction;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeProjection;
|
||||
import org.jetbrains.kotlin.types.Variance;
|
||||
@@ -108,7 +108,7 @@ public class MainFunctionDetector {
|
||||
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
|
||||
return containingDeclaration instanceof ClassDescriptor
|
||||
&& ((ClassDescriptor) containingDeclaration).getKind().isSingleton()
|
||||
&& AnnotationsPackage.hasPlatformStaticAnnotation(functionDescriptor);
|
||||
&& AnnotationUtilKt.hasPlatformStaticAnnotation(functionDescriptor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.lexer.JetKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.JetToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.utils.strings.StringsPackage;
|
||||
import org.jetbrains.kotlin.utils.strings.StringsKt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -488,6 +488,6 @@ import static org.jetbrains.kotlin.lexer.JetTokens.*;
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@TestOnly
|
||||
public String currentContext() {
|
||||
return StringsPackage.substringWithContext(myBuilder.getOriginalText(), myBuilder.getCurrentOffset(), myBuilder.getCurrentOffset(), 20);
|
||||
return StringsKt.substringWithContext(myBuilder.getOriginalText(), myBuilder.getCurrentOffset(), myBuilder.getCurrentOffset(), 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,8 @@ import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.JetNodeTypes;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class JetAnnotatedExpression extends JetExpressionImpl implements JetAnnotated, JetAnnotationsContainer {
|
||||
@@ -50,6 +48,6 @@ public class JetAnnotatedExpression extends JetExpressionImpl implements JetAnno
|
||||
@Override
|
||||
@NotNull
|
||||
public List<JetAnnotationEntry> getAnnotationEntries() {
|
||||
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.JetNodeTypes;
|
||||
import org.jetbrains.kotlin.kdoc.psi.api.KDoc;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierPackage;
|
||||
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentPackage;
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierKt;
|
||||
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -47,18 +47,18 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
|
||||
|
||||
@Override
|
||||
public void addModifier(@NotNull JetModifierKeywordToken modifier) {
|
||||
AddRemoveModifierPackage.addModifier(this, modifier);
|
||||
AddRemoveModifierKt.addModifier(this, modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeModifier(@NotNull JetModifierKeywordToken modifier) {
|
||||
AddRemoveModifierPackage.removeModifier(this, modifier);
|
||||
AddRemoveModifierKt.removeModifier(this, modifier);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetAnnotationEntry addAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
|
||||
return AddRemoveModifierPackage.addAnnotationEntry(this, annotationEntry);
|
||||
return AddRemoveModifierKt.addAnnotationEntry(this, annotationEntry);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -80,6 +80,6 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
|
||||
@Nullable
|
||||
@Override
|
||||
public KDoc getDocComment() {
|
||||
return FindDocCommentPackage.findDocComment(this);
|
||||
return FindDocCommentKt.findDocComment(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.kdoc.psi.api.KDoc;
|
||||
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentPackage;
|
||||
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub;
|
||||
|
||||
abstract class JetDeclarationStub<T extends StubElement<?>> extends JetModifierListOwnerStub<T> implements JetDeclaration {
|
||||
@@ -51,7 +51,7 @@ abstract class JetDeclarationStub<T extends StubElement<?>> extends JetModifierL
|
||||
@Nullable
|
||||
@Override
|
||||
public KDoc getDocComment() {
|
||||
return FindDocCommentPackage.findDocComment(this);
|
||||
return FindDocCommentKt.findDocComment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
@@ -46,6 +46,6 @@ public class JetFileAnnotationList extends JetElementImplStub<KotlinPlaceHolderS
|
||||
|
||||
@NotNull
|
||||
public List<JetAnnotationEntry> getAnnotationEntries() {
|
||||
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,9 @@ package org.jetbrains.kotlin.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.JetNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JetImportsFactory {
|
||||
return directive;
|
||||
}
|
||||
|
||||
JetImportDirective createdDirective = JetPsiFactory(project).createImportDirective(importPath);
|
||||
JetImportDirective createdDirective = JetPsiFactoryKt.JetPsiFactory(project).createImportDirective(importPath);
|
||||
importsCache.put(importPath, createdDirective);
|
||||
|
||||
return createdDirective;
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.psi.stubs.IStubElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinModifierListStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class JetModifierList extends JetElementImplStub<KotlinModifierL
|
||||
|
||||
@NotNull
|
||||
public List<JetAnnotationEntry> getAnnotationEntries() {
|
||||
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||
}
|
||||
|
||||
public boolean hasModifier(@NotNull JetModifierKeywordToken tokenType) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierPackage;
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -51,18 +51,18 @@ public class JetModifierListOwnerStub<T extends StubElement<?>> extends JetEleme
|
||||
|
||||
@Override
|
||||
public void addModifier(@NotNull JetModifierKeywordToken modifier) {
|
||||
AddRemoveModifierPackage.addModifier(this, modifier);
|
||||
AddRemoveModifierKt.addModifier(this, modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeModifier(@NotNull JetModifierKeywordToken modifier) {
|
||||
AddRemoveModifierPackage.removeModifier(this, modifier);
|
||||
AddRemoveModifierKt.removeModifier(this, modifier);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetAnnotationEntry addAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
|
||||
return AddRemoveModifierPackage.addAnnotationEntry(this, annotationEntry);
|
||||
return AddRemoveModifierKt.addAnnotationEntry(this, annotationEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.JetNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -41,13 +41,13 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
|
||||
|
||||
@Override
|
||||
public JetTypeReference getTypeReference() {
|
||||
return TypeRefHelpersPackage.getTypeReference(this);
|
||||
return TypeRefHelpersKt.getTypeReference(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
|
||||
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
|
||||
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
|
||||
|
||||
// TODO: Remove when all named declarations get stubs
|
||||
@Deprecated
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinFunctionStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -184,13 +184,13 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<KotlinFuncti
|
||||
}
|
||||
return typeReferences.get(returnTypeIndex);
|
||||
}
|
||||
return TypeRefHelpersPackage.getTypeReference(this);
|
||||
return TypeRefHelpersKt.getTypeReference(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeReference(this, getValueParameterList(), typeRef);
|
||||
return TypeRefHelpersKt.setTypeReference(this, getValueParameterList(), typeRef);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
|
||||
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
|
||||
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
|
||||
|
||||
public class JetObjectDeclarationName extends JetExpressionImpl {
|
||||
public JetObjectDeclarationName(@NotNull ASTNode node) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.name.SpecialNames;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class JetPackageDirective extends JetModifierListOwnerStub<KotlinPlaceHol
|
||||
JetExpression nameExpression = getPackageNameExpression();
|
||||
if (nameExpression == null) return null;
|
||||
|
||||
return (JetSimpleNameExpression)PsiUtilPackage.getQualifiedElementSelector(nameExpression);
|
||||
return (JetSimpleNameExpression) JetPsiUtilKt.getQualifiedElementSelector(nameExpression);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinParameterStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -55,7 +55,7 @@ public class JetParameter extends JetNamedDeclarationStub<KotlinParameterStub> i
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.JetNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPropertyStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -142,13 +142,13 @@ public class JetProperty extends JetTypeParameterListOwnerStub<KotlinPropertyStu
|
||||
return typeReferences.get(returnTypeRefPositionInPsi);
|
||||
}
|
||||
}
|
||||
return TypeRefHelpersPackage.getTypeReference(this);
|
||||
return TypeRefHelpersKt.getTypeReference(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -41,9 +41,9 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.name.SpecialNames;
|
||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.StatementFilter;
|
||||
import org.jetbrains.kotlin.resolve.StatementFilterKt;
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -263,12 +263,12 @@ public class JetPsiUtil {
|
||||
|
||||
@Nullable
|
||||
public static JetSimpleNameExpression getLastReference(@NotNull JetExpression importedReference) {
|
||||
JetElement selector = PsiUtilPackage.getQualifiedElementSelector(importedReference);
|
||||
JetElement selector = JetPsiUtilKt.getQualifiedElementSelector(importedReference);
|
||||
return selector instanceof JetSimpleNameExpression ? (JetSimpleNameExpression) selector : null;
|
||||
}
|
||||
|
||||
public static boolean isSelectorInQualified(@NotNull JetSimpleNameExpression nameExpression) {
|
||||
JetElement qualifiedElement = PsiUtilPackage.getQualifiedElement(nameExpression);
|
||||
JetElement qualifiedElement = JetPsiUtilKt.getQualifiedElement(nameExpression);
|
||||
return qualifiedElement instanceof JetQualifiedExpression
|
||||
|| ((qualifiedElement instanceof JetUserType) && ((JetUserType) qualifiedElement).getQualifier() != null);
|
||||
}
|
||||
@@ -502,7 +502,7 @@ public class JetPsiUtil {
|
||||
|
||||
if (parentExpression instanceof JetCallExpression && currentInner == ((JetCallExpression) parentExpression).getCalleeExpression()) {
|
||||
if (innerExpression instanceof JetSimpleNameExpression) return false;
|
||||
if (PsiUtilPackage.getQualifiedExpressionForSelector(parentExpression) != null) return true;
|
||||
if (JetPsiUtilKt.getQualifiedExpressionForSelector(parentExpression) != null) return true;
|
||||
return !(innerExpression instanceof JetThisExpression
|
||||
|| innerExpression instanceof JetArrayAccessExpression
|
||||
|| innerExpression instanceof JetConstantExpression
|
||||
@@ -845,7 +845,7 @@ public class JetPsiUtil {
|
||||
// This case is a temporary hack for 'if' branches.
|
||||
// The right way to implement this logic is to interpret 'if' branches as function literals with explicitly-typed signatures
|
||||
// (no arguments and no receiver) and therefore analyze them straight away (not in the 'complete' phase).
|
||||
JetExpression lastStatementInABlock = ResolvePackage.getLastStatementInABlock(statementFilter, blockExpression);
|
||||
JetExpression lastStatementInABlock = StatementFilterKt.getLastStatementInABlock(statementFilter, blockExpression);
|
||||
if (lastStatementInABlock != null) {
|
||||
return getLastElementDeparenthesized(lastStatementInABlock, statementFilter);
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetClass;
|
||||
import org.jetbrains.kotlin.psi.JetEnumEntry;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinClassStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinClassStubImpl;
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
||||
@@ -57,10 +57,10 @@ public class JetClassElementType extends JetStubElementType<KotlinClassStub, Jet
|
||||
public KotlinClassStub createStub(@NotNull JetClass psi, StubElement parentStub) {
|
||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||
boolean isEnumEntry = psi instanceof JetEnumEntry;
|
||||
List<String> superNames = PsiUtilPackage.getSuperNames(psi);
|
||||
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
|
||||
return new KotlinClassStubImpl(
|
||||
getStubType(isEnumEntry), parentStub, StringRef.fromString(fqName != null ? fqName.asString() : null),
|
||||
StringRef.fromString(psi.getName()), Utils.INSTANCE$.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
|
||||
StringRef.fromString(psi.getName()), Utils.INSTANCE.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
|
||||
psi.isLocal(), psi.isTopLevel());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetObjectDeclaration;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinObjectStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinObjectStubImpl;
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
||||
@@ -43,8 +43,8 @@ public class JetObjectElementType extends JetStubElementType<KotlinObjectStub, J
|
||||
public KotlinObjectStub createStub(@NotNull JetObjectDeclaration psi, StubElement parentStub) {
|
||||
String name = psi.getName();
|
||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||
List<String> superNames = PsiUtilPackage.getSuperNames(psi);
|
||||
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE$.wrapStrings(superNames),
|
||||
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
|
||||
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE.wrapStrings(superNames),
|
||||
psi.isTopLevel(), psi.isCompanion(), psi.isLocal(), psi.isObjectLiteral());
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetProperty;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPropertyStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSessionUtils;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.kotlin.psi.JetElement;
|
||||
import org.jetbrains.kotlin.psi.JetTreeVisitorVoid;
|
||||
import org.jetbrains.kotlin.psi.debugText.DebugTextPackage;
|
||||
import org.jetbrains.kotlin.psi.debugText.DebugTextUtilKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -70,7 +70,7 @@ public class AnalyzingUtils {
|
||||
StringBuilder debugInfo = new StringBuilder(debugName);
|
||||
if (resolutionSubjectForMessage instanceof JetElement) {
|
||||
JetElement element = (JetElement) resolutionSubjectForMessage;
|
||||
debugInfo.append(" ").append(DebugTextPackage.getDebugText(element));
|
||||
debugInfo.append(" ").append(DebugTextUtilKt.getDebugText(element));
|
||||
debugInfo.append(" in ").append(element.getContainingFile().getName());
|
||||
}
|
||||
else if (resolutionSubjectForMessage != null) {
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.annotations.*;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.CallResolver;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults;
|
||||
@@ -68,7 +67,7 @@ public class AnnotationResolver {
|
||||
this.constantExpressionEvaluator = constantExpressionEvaluator;
|
||||
this.storageManager = storageManager;
|
||||
|
||||
modifiersAnnotations = AnnotationsPackage.buildMigrationAnnotationDescriptors(kotlinBuiltIns);
|
||||
modifiersAnnotations = AnnotationUtilKt.buildMigrationAnnotationDescriptors(kotlinBuiltIns);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
@@ -34,14 +34,13 @@ import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppressio
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
import org.jetbrains.kotlin.util.slicedMap.MutableSlicedMap;
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.AMBIGUOUS_LABEL;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
|
||||
@@ -161,7 +160,7 @@ public class BindingContextUtils {
|
||||
if (!context.get(BindingContext.PROCESSED, expression)) return null;
|
||||
// NB: should never return null if expression is already processed
|
||||
JetTypeInfo result = context.get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
return result != null ? result : TypeInfoFactoryPackage.noTypeInfo(DataFlowInfo.EMPTY);
|
||||
return result != null ? result : TypeInfoFactoryKt.noTypeInfo(DataFlowInfo.EMPTY);
|
||||
}
|
||||
|
||||
public static boolean isExpressionWithValidReference(
|
||||
@@ -169,7 +168,7 @@ public class BindingContextUtils {
|
||||
@NotNull BindingContext context
|
||||
) {
|
||||
if (expression instanceof JetCallExpression) {
|
||||
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(expression, context);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, context);
|
||||
return resolvedCall instanceof VariableAsFunctionResolvedCall;
|
||||
}
|
||||
return expression instanceof JetReferenceExpression;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
import org.jetbrains.kotlin.util.slicedMap.*;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -139,7 +139,7 @@ public class BindingTraceContext implements BindingTrace {
|
||||
@Override
|
||||
public void recordType(@NotNull JetExpression expression, @Nullable JetType type) {
|
||||
JetTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
typeInfo = typeInfo != null ? typeInfo.replaceType(type) : TypeInfoFactoryPackage.createTypeInfo(type);
|
||||
typeInfo = typeInfo != null ? typeInfo.replaceType(type) : TypeInfoFactoryKt.createTypeInfo(type);
|
||||
record(BindingContext.EXPRESSION_TYPE_INFO, expression, typeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.CallResolver;
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
@@ -46,7 +46,7 @@ import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
|
||||
import org.jetbrains.kotlin.types.expressions.ValueParameterResolver;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
import org.jetbrains.kotlin.util.Box;
|
||||
import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
@@ -330,7 +330,7 @@ public class BodyResolver {
|
||||
// Recording type info for callee to use later in JetObjectLiteralExpression
|
||||
trace.record(PROCESSED, call.getCalleeExpression(), true);
|
||||
trace.record(EXPRESSION_TYPE_INFO, call.getCalleeExpression(),
|
||||
TypeInfoFactoryPackage.noTypeInfo(results.getResultingCall().getDataFlowInfoForArguments().getResultInfo()));
|
||||
TypeInfoFactoryKt.noTypeInfo(results.getResultingCall().getDataFlowInfoForArguments().getResultInfo()));
|
||||
}
|
||||
else {
|
||||
recordSupertype(typeReference, trace.getBindingContext().get(BindingContext.TYPE, typeReference));
|
||||
@@ -450,7 +450,7 @@ public class BodyResolver {
|
||||
addSupertype = false;
|
||||
}
|
||||
else if (supertypeOwner.getKind() == ClassKind.INTERFACE &&
|
||||
!classAppeared && !TypesPackage.isDynamic(supertype) /* avoid duplicate diagnostics */) {
|
||||
!classAppeared && !DynamicTypesKt.isDynamic(supertype) /* avoid duplicate diagnostics */) {
|
||||
trace.report(INTERFACE_WITH_SUPERCLASS.on(typeReference));
|
||||
addSupertype = false;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ public class BodyResolver {
|
||||
JetNamedFunction declaration = entry.getKey();
|
||||
|
||||
LexicalScope scope = c.getDeclaringScope(declaration);
|
||||
assert scope != null : "Scope is null: " + PsiUtilPackage.getElementTextWithContext(declaration);
|
||||
assert scope != null : "Scope is null: " + PsiUtilsKt.getElementTextWithContext(declaration);
|
||||
|
||||
if (!c.getTopDownAnalysisMode().isLocalDeclarations() && !(bodyResolveCache instanceof BodyResolveCache.ThrowException) &&
|
||||
expressionTypingServices.getStatementFilter() != StatementFilter.NONE) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.Renderers;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
@@ -48,9 +49,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
|
||||
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getCalleeExpressionIfAny;
|
||||
import static org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.FROM_COMPLETER;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.noExpectedType;
|
||||
@@ -313,7 +313,7 @@ public class DelegatedPropertyResolver {
|
||||
@NotNull DataFlowInfo dataFlowInfo
|
||||
) {
|
||||
TemporaryBindingTrace traceToResolveDelegatedProperty = TemporaryBindingTrace.create(trace, "Trace to resolve delegated property");
|
||||
JetExpression calleeExpression = getCalleeExpressionIfAny(delegateExpression);
|
||||
JetExpression calleeExpression = CallUtilKt.getCalleeExpressionIfAny(delegateExpression);
|
||||
ConstraintSystemCompleter completer = createConstraintSystemCompleter(
|
||||
jetProperty, propertyDescriptor, delegateExpression, accessorScope, trace);
|
||||
if (calleeExpression != null) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
import org.jetbrains.kotlin.util.slicedMap.*;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -148,7 +148,7 @@ public class DelegatingBindingTrace implements BindingTrace {
|
||||
public void recordType(@NotNull JetExpression expression, @Nullable JetType type) {
|
||||
JetTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
if (typeInfo == null) {
|
||||
typeInfo = TypeInfoFactoryPackage.createTypeInfo(type);
|
||||
typeInfo = TypeInfoFactoryKt.createTypeInfo(type);
|
||||
}
|
||||
else {
|
||||
typeInfo = typeInfo.replaceType(type);
|
||||
|
||||
@@ -38,17 +38,19 @@ import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
||||
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage;
|
||||
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
|
||||
import org.jetbrains.kotlin.storage.StorageManager;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
@@ -64,8 +66,6 @@ import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveModalityFromModifiers;
|
||||
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveVisibilityFromModifiers;
|
||||
import static org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage.asJetScope;
|
||||
import static org.jetbrains.kotlin.resolve.source.SourcePackage.toSourceElement;
|
||||
|
||||
public class DescriptorResolver {
|
||||
public static final Name COPY_METHOD_NAME = Name.identifier("copy");
|
||||
@@ -175,7 +175,7 @@ public class DescriptorResolver {
|
||||
JetTypeReference typeReference = delegationSpecifier.getTypeReference();
|
||||
if (typeReference != null) {
|
||||
JetType supertype = resolver.resolveType(extensibleScope, typeReference, trace, checkBounds);
|
||||
if (TypesPackage.isDynamic(supertype)) {
|
||||
if (DynamicTypesKt.isDynamic(supertype)) {
|
||||
trace.report(DYNAMIC_SUPERTYPE.on(typeReference));
|
||||
}
|
||||
else {
|
||||
@@ -224,7 +224,7 @@ public class DescriptorResolver {
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull BindingTrace trace
|
||||
) {
|
||||
Name functionName = DataClassUtilsPackage.createComponentName(parameterIndex);
|
||||
Name functionName = DataClassUtilsKt.createComponentName(parameterIndex);
|
||||
JetType returnType = property.getType();
|
||||
|
||||
SimpleFunctionDescriptorImpl functionDescriptor = SimpleFunctionDescriptorImpl.create(
|
||||
@@ -366,7 +366,7 @@ public class DescriptorResolver {
|
||||
variableType,
|
||||
valueParameter.hasDefaultValue(),
|
||||
varargElementType,
|
||||
toSourceElement(valueParameter)
|
||||
KotlinSourceElementKt.toSourceElement(valueParameter)
|
||||
);
|
||||
|
||||
trace.record(BindingContext.VALUE_PARAMETER, valueParameter, valueParameterDescriptor);
|
||||
@@ -418,7 +418,7 @@ public class DescriptorResolver {
|
||||
typeParameter.getVariance(),
|
||||
JetPsiUtil.safeName(typeParameter.getName()),
|
||||
index,
|
||||
toSourceElement(typeParameter)
|
||||
KotlinSourceElementKt.toSourceElement(typeParameter)
|
||||
);
|
||||
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
||||
extensibleScope.addClassifierDescriptor(typeParameterDescriptor);
|
||||
@@ -432,7 +432,7 @@ public class DescriptorResolver {
|
||||
@NotNull BindingTrace trace
|
||||
) {
|
||||
ConstructorDescriptorImpl constructorDescriptor =
|
||||
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, toSourceElement(object));
|
||||
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, KotlinSourceElementKt.toSourceElement(object));
|
||||
if (object != null) {
|
||||
JetPrimaryConstructor primaryConstructor = object.getPrimaryConstructor();
|
||||
trace.record(CONSTRUCTOR, primaryConstructor != null ? primaryConstructor : object, constructorDescriptor);
|
||||
@@ -549,7 +549,7 @@ public class DescriptorResolver {
|
||||
|
||||
Name name = nameExpression.getReferencedNameAsName();
|
||||
|
||||
ClassifierDescriptor classifier = asJetScope(scope).getClassifier(name, NoLookupLocation.UNSORTED);
|
||||
ClassifierDescriptor classifier = ScopeUtilsKt.asJetScope(scope).getClassifier(name, NoLookupLocation.UNSORTED);
|
||||
if (classifier instanceof TypeParameterDescriptor && classifier.getContainingDeclaration() == descriptor) continue;
|
||||
|
||||
if (classifier != null) {
|
||||
@@ -580,7 +580,7 @@ public class DescriptorResolver {
|
||||
}
|
||||
trace.report(FINAL_UPPER_BOUND.on(upperBound, upperBoundType));
|
||||
}
|
||||
if (TypesPackage.isDynamic(upperBoundType)) {
|
||||
if (DynamicTypesKt.isDynamic(upperBoundType)) {
|
||||
trace.report(DYNAMIC_UPPER_BOUND.on(upperBound));
|
||||
}
|
||||
}
|
||||
@@ -623,7 +623,7 @@ public class DescriptorResolver {
|
||||
JetPsiUtil.safeName(parameter.getName()),
|
||||
type,
|
||||
false,
|
||||
toSourceElement(parameter)
|
||||
KotlinSourceElementKt.toSourceElement(parameter)
|
||||
);
|
||||
trace.record(BindingContext.VALUE_PARAMETER, parameter, variableDescriptor);
|
||||
// Type annotations also should be resolved
|
||||
@@ -651,7 +651,7 @@ public class DescriptorResolver {
|
||||
variable.isVar(),
|
||||
JetPsiUtil.safeName(variable.getName()),
|
||||
CallableMemberDescriptor.Kind.DECLARATION,
|
||||
toSourceElement(variable),
|
||||
KotlinSourceElementKt.toSourceElement(variable),
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false
|
||||
);
|
||||
@@ -704,7 +704,7 @@ public class DescriptorResolver {
|
||||
JetPsiUtil.safeName(variable.getName()),
|
||||
type,
|
||||
variable.isVar(),
|
||||
toSourceElement(variable)
|
||||
KotlinSourceElementKt.toSourceElement(variable)
|
||||
);
|
||||
trace.record(BindingContext.VARIABLE, variable, variableDescriptor);
|
||||
return variableDescriptor;
|
||||
@@ -750,7 +750,7 @@ public class DescriptorResolver {
|
||||
isVar,
|
||||
JetPsiUtil.safeName(property.getName()),
|
||||
CallableMemberDescriptor.Kind.DECLARATION,
|
||||
toSourceElement(property),
|
||||
KotlinSourceElementKt.toSourceElement(property),
|
||||
modifierList != null && modifierList.hasModifier(JetTokens.LATEINIT_KEYWORD),
|
||||
modifierList != null && modifierList.hasModifier(JetTokens.CONST_KEYWORD)
|
||||
);
|
||||
@@ -998,7 +998,8 @@ public class DescriptorResolver {
|
||||
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
||||
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
||||
setter.hasBody(), false,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(setter));
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
|
||||
.toSourceElement(setter));
|
||||
if (parameter != null) {
|
||||
|
||||
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
||||
@@ -1078,7 +1079,8 @@ public class DescriptorResolver {
|
||||
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
||||
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
||||
getter.hasBody(), false,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(getter));
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
|
||||
.toSourceElement(getter));
|
||||
getterDescriptor.initialize(returnType);
|
||||
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
||||
}
|
||||
@@ -1130,7 +1132,7 @@ public class DescriptorResolver {
|
||||
isMutable,
|
||||
name,
|
||||
CallableMemberDescriptor.Kind.DECLARATION,
|
||||
toSourceElement(parameter),
|
||||
KotlinSourceElementKt.toSourceElement(parameter),
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false
|
||||
);
|
||||
@@ -1167,12 +1169,12 @@ public class DescriptorResolver {
|
||||
List<JetTypeReference> jetTypeArguments = typeElement.getTypeArgumentsAsTypes();
|
||||
|
||||
// A type reference from Kotlin code can yield a flexible type only if it's `ft<T1, T2>`, whose bounds should not be checked
|
||||
if (TypesPackage.isFlexible(type) && !TypesPackage.isDynamic(type)) {
|
||||
if (FlexibleTypesKt.isFlexible(type) && !DynamicTypesKt.isDynamic(type)) {
|
||||
assert jetTypeArguments.size() == 2
|
||||
: "Flexible type cannot be denoted in Kotlin otherwise than as ft<T1, T2>, but was: "
|
||||
+ PsiUtilPackage.getElementTextWithContext(typeReference);
|
||||
+ PsiUtilsKt.getElementTextWithContext(typeReference);
|
||||
// it's really ft<Foo, Bar>
|
||||
Flexibility flexibility = TypesPackage.flexibility(type);
|
||||
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
|
||||
checkBounds(jetTypeArguments.get(0), flexibility.getLowerBound(), trace);
|
||||
checkBounds(jetTypeArguments.get(1), flexibility.getUpperBound(), trace);
|
||||
return;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -57,7 +57,7 @@ public class FunctionDescriptorUtil {
|
||||
) {
|
||||
if (functionDescriptor.getTypeParameters().isEmpty()) return TypeSubstitution.getEMPTY();
|
||||
|
||||
return new IndexedParametersSubstitution(functionDescriptor.getTypeParameters(), TypeUtilPackage.defaultProjections(typeArguments));
|
||||
return new IndexedParametersSubstitution(functionDescriptor.getTypeParameters(), TypeUtilsKt.defaultProjections(typeArguments));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypesPackage;
|
||||
import org.jetbrains.kotlin.types.TypeCapabilitiesKt;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
|
||||
import java.util.List;
|
||||
@@ -72,7 +72,7 @@ public class OverloadUtil {
|
||||
JetType superValueParameterType = OverridingUtil.getUpperBound(superValueParameters.get(i));
|
||||
JetType subValueParameterType = OverridingUtil.getUpperBound(subValueParameters.get(i));
|
||||
if (!JetTypeChecker.DEFAULT.equalTypes(superValueParameterType, subValueParameterType)
|
||||
|| TypesPackage.oneMoreSpecificThanAnother(subValueParameterType, superValueParameterType)) {
|
||||
|| TypeCapabilitiesKt.oneMoreSpecificThanAnother(subValueParameterType, superValueParameterType)) {
|
||||
return OverridingUtil.OverrideCompatibilityInfo
|
||||
.valueParameterTypeMismatch(superValueParameterType, subValueParameterType, INCOMPATIBLE);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
@@ -423,7 +423,7 @@ public class OverrideResolver {
|
||||
@NotNull List<CallableMemberDescriptor> concreteOverridden
|
||||
) {
|
||||
for (CallableMemberDescriptor overridden : allOverriddenDeclarations) {
|
||||
if (!CallResolverUtilPackage.isOrOverridesSynthesized(overridden)) {
|
||||
if (!CallResolverUtilKt.isOrOverridesSynthesized(overridden)) {
|
||||
if (overridden.getModality() == Modality.ABSTRACT) {
|
||||
abstractOverridden.add(overridden);
|
||||
}
|
||||
@@ -566,7 +566,7 @@ public class OverrideResolver {
|
||||
|
||||
private void checkOverrideForMember(@NotNull final CallableMemberDescriptor declared) {
|
||||
if (declared.getKind() == CallableMemberDescriptor.Kind.SYNTHESIZED) {
|
||||
if (DataClassUtilsPackage.isComponentLike(declared.getName())) {
|
||||
if (DataClassUtilsKt.isComponentLike(declared.getName())) {
|
||||
checkOverrideForComponentFunction(declared);
|
||||
}
|
||||
return;
|
||||
|
||||
+12
-12
@@ -28,12 +28,13 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver;
|
||||
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesPackage;
|
||||
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesResolutionUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImplKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults;
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
@@ -51,7 +52,7 @@ import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
|
||||
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -62,7 +63,6 @@ import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumen
|
||||
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
|
||||
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.DEPENDENT;
|
||||
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
|
||||
import static org.jetbrains.kotlin.resolve.calls.inference.InferencePackage.createTypeForFunctionPlaceholder;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.DONT_CARE;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ArgumentTypeResolver {
|
||||
@NotNull JetType expectedType
|
||||
) {
|
||||
if (FunctionPlaceholdersKt.isFunctionPlaceholder(actualType)) {
|
||||
JetType functionType = createTypeForFunctionPlaceholder(actualType, expectedType);
|
||||
JetType functionType = ConstraintSystemImplKt.createTypeForFunctionPlaceholder(actualType, expectedType);
|
||||
return JetTypeChecker.DEFAULT.isSubtypeOf(functionType, expectedType);
|
||||
}
|
||||
return JetTypeChecker.DEFAULT.isSubtypeOf(actualType, expectedType);
|
||||
@@ -200,7 +200,7 @@ public class ArgumentTypeResolver {
|
||||
@NotNull ResolveArgumentsMode resolveArgumentsMode
|
||||
) {
|
||||
if (expression == null) {
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
|
||||
JetFunction functionLiteralArgument = getFunctionLiteralArgumentIfAny(expression, context);
|
||||
@@ -232,7 +232,7 @@ public class ArgumentTypeResolver {
|
||||
) {
|
||||
if (resolveArgumentsMode == SHAPE_FUNCTION_ARGUMENTS) {
|
||||
JetType type = getShapeTypeOfCallableReference(callableReferenceExpression, context, true);
|
||||
return TypeInfoFactoryPackage.createTypeInfo(type);
|
||||
return TypeInfoFactoryKt.createTypeInfo(type);
|
||||
}
|
||||
return expressionTypingServices.getTypeInfo(expression, context.replaceContextDependency(INDEPENDENT));
|
||||
}
|
||||
@@ -244,12 +244,12 @@ public class ArgumentTypeResolver {
|
||||
boolean expectedTypeIsUnknown
|
||||
) {
|
||||
JetType receiverType =
|
||||
CallableReferencesPackage.resolveCallableReferenceReceiverType(callableReferenceExpression, context, typeResolver);
|
||||
CallableReferencesResolutionUtilsKt.resolveCallableReferenceReceiverType(callableReferenceExpression, context, typeResolver);
|
||||
OverloadResolutionResults<CallableDescriptor> overloadResolutionResults =
|
||||
CallableReferencesPackage.resolvePossiblyAmbiguousCallableReference(
|
||||
CallableReferencesResolutionUtilsKt.resolvePossiblyAmbiguousCallableReference(
|
||||
callableReferenceExpression, receiverType, context, ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS,
|
||||
callResolver);
|
||||
return CallableReferencesPackage.getResolvedCallableReferenceShapeType(
|
||||
return CallableReferencesResolutionUtilsKt.getResolvedCallableReferenceShapeType(
|
||||
callableReferenceExpression, overloadResolutionResults, context, expectedTypeIsUnknown,
|
||||
reflectionTypes, builtIns, functionPlaceholders);
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public class ArgumentTypeResolver {
|
||||
) {
|
||||
if (resolveArgumentsMode == SHAPE_FUNCTION_ARGUMENTS) {
|
||||
JetType type = getShapeTypeOfFunctionLiteral(functionLiteral, context.scope, context.trace, true);
|
||||
return TypeInfoFactoryPackage.createTypeInfo(type, context);
|
||||
return TypeInfoFactoryKt.createTypeInfo(type, context);
|
||||
}
|
||||
return expressionTypingServices.getTypeInfo(expression, context.replaceContextDependency(INDEPENDENT));
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public class ArgumentTypeResolver {
|
||||
// For an unsafe call, we should not do it,
|
||||
// otherwise not-null will propagate to successive statements
|
||||
// Sample: x?.foo(x.bar()) // Inside foo call, x is not-nullable
|
||||
if (CallUtilPackage.isSafeCall(call)) {
|
||||
if (CallUtilKt.isSafeCall(call)) {
|
||||
initialDataFlowInfo = initialDataFlowInfo.disequate(receiverDataFlowValue, DataFlowValue.nullValue(builtIns));
|
||||
}
|
||||
}
|
||||
|
||||
+14
-16
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||
@@ -49,7 +49,7 @@ import org.jetbrains.kotlin.types.expressions.DataFlowAnalyzer;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
|
||||
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collections;
|
||||
@@ -57,8 +57,6 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
|
||||
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiversPackage.createQualifier;
|
||||
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiversPackage.resolveAsStandaloneExpression;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||
|
||||
public class CallExpressionResolver {
|
||||
@@ -129,11 +127,11 @@ public class CallExpressionResolver {
|
||||
}
|
||||
}
|
||||
|
||||
QualifierReceiver qualifier = createQualifier(nameExpression, receiver, context);
|
||||
QualifierReceiver qualifier = QualifierKt.createQualifier(nameExpression, receiver, context);
|
||||
if (qualifier != null) {
|
||||
result[0] = true;
|
||||
if (!isLHSOfDot) {
|
||||
resolveAsStandaloneExpression(qualifier, context, symbolUsageValidator);
|
||||
QualifierKt.resolveAsStandaloneExpression(qualifier, context, symbolUsageValidator);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -159,7 +157,7 @@ public class CallExpressionResolver {
|
||||
|
||||
if (result[0]) {
|
||||
temporaryForVariable.commit();
|
||||
return TypeInfoFactoryPackage.createTypeInfo(type, context);
|
||||
return TypeInfoFactoryKt.createTypeInfo(type, context);
|
||||
}
|
||||
|
||||
Call call = CallMaker.makeCall(nameExpression, receiver, callOperationNode, nameExpression, Collections.<ValueArgument>emptyList());
|
||||
@@ -174,11 +172,11 @@ public class CallExpressionResolver {
|
||||
boolean hasValueParameters = functionDescriptor == null || functionDescriptor.getValueParameters().size() > 0;
|
||||
context.trace.report(FUNCTION_CALL_EXPECTED.on(nameExpression, nameExpression, hasValueParameters));
|
||||
type = functionDescriptor != null ? functionDescriptor.getReturnType() : null;
|
||||
return TypeInfoFactoryPackage.createTypeInfo(type, context);
|
||||
return TypeInfoFactoryKt.createTypeInfo(type, context);
|
||||
}
|
||||
|
||||
temporaryForVariable.commit();
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -221,7 +219,7 @@ public class CallExpressionResolver {
|
||||
context.trace.report(FUNCTION_CALL_EXPECTED.on(callExpression, callExpression, hasValueParameters));
|
||||
}
|
||||
if (functionDescriptor == null) {
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
if (functionDescriptor instanceof ConstructorDescriptor) {
|
||||
DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration();
|
||||
@@ -252,7 +250,7 @@ public class CallExpressionResolver {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TypeInfoFactoryPackage.createTypeInfo(type, resultFlowInfo, jumpOutPossible, jumpFlowInfo);
|
||||
return TypeInfoFactoryKt.createTypeInfo(type, resultFlowInfo, jumpOutPossible, jumpFlowInfo);
|
||||
}
|
||||
|
||||
JetExpression calleeExpression = callExpression.getCalleeExpression();
|
||||
@@ -266,11 +264,11 @@ public class CallExpressionResolver {
|
||||
temporaryForVariable.commit();
|
||||
context.trace.report(FUNCTION_EXPECTED.on(calleeExpression, calleeExpression,
|
||||
type != null ? type : ErrorUtils.createErrorType("")));
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
}
|
||||
temporaryForFunction.commit();
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
|
||||
private static boolean canInstantiateAnnotationClass(@NotNull JetCallExpression expression, @NotNull BindingTrace trace) {
|
||||
@@ -306,7 +304,7 @@ public class CallExpressionResolver {
|
||||
else if (selectorExpression != null) {
|
||||
context.trace.report(ILLEGAL_SELECTOR.on(selectorExpression, selectorExpression.getText()));
|
||||
}
|
||||
return TypeInfoFactoryPackage.noTypeInfo(context);
|
||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,11 +441,11 @@ public class CallExpressionResolver {
|
||||
) {
|
||||
if (qualifierReceiver == null) return;
|
||||
JetExpression calleeExpression =
|
||||
JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()));
|
||||
JetPsiUtil.deparenthesize(CallUtilKt.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()));
|
||||
DeclarationDescriptor selectorDescriptor =
|
||||
calleeExpression instanceof JetReferenceExpression
|
||||
? context.trace.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression) : null;
|
||||
ReceiversPackage.resolveAsReceiverInQualifiedExpression(qualifierReceiver, context, symbolUsageValidator, selectorDescriptor);
|
||||
QualifierKt.resolveAsReceiverInQualifiedExpression(qualifierReceiver, context, symbolUsageValidator, selectorDescriptor);
|
||||
}
|
||||
|
||||
private static void checkNestedClassAccess(
|
||||
|
||||
@@ -31,8 +31,9 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||
@@ -45,7 +46,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors;
|
||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||
@@ -65,8 +66,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordDataFlowInfo;
|
||||
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordScope;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
|
||||
import static org.jetbrains.kotlin.resolve.calls.context.CandidateResolveMode.EXIT_ON_FIRST_ERROR;
|
||||
@@ -357,7 +356,7 @@ public class CallResolver {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor;
|
||||
Collection<ConstructorDescriptor> constructors = classDescriptor.getConstructors();
|
||||
if (constructors.isEmpty()) {
|
||||
context.trace.report(NO_CONSTRUCTOR.on(CallUtilPackage.getValueArgumentListOrElement(context.call)));
|
||||
context.trace.report(NO_CONSTRUCTOR.on(CallUtilKt.getValueArgumentListOrElement(context.call)));
|
||||
return checkArgumentTypesAndFail(context);
|
||||
}
|
||||
Collection<ResolutionCandidate<CallableDescriptor>> candidates =
|
||||
@@ -414,7 +413,7 @@ public class CallResolver {
|
||||
}
|
||||
|
||||
ClassDescriptor delegateClassDescriptor = isThisCall ? currentClassDescriptor :
|
||||
DescriptorUtilPackage.getSuperClassOrAny(currentClassDescriptor);
|
||||
DescriptorUtilsKt.getSuperClassOrAny(currentClassDescriptor);
|
||||
Collection<ConstructorDescriptor> constructors = delegateClassDescriptor.getConstructors();
|
||||
|
||||
if (!isThisCall && currentClassDescriptor.getUnsubstitutedPrimaryConstructor() != null) {
|
||||
@@ -428,7 +427,7 @@ public class CallResolver {
|
||||
}
|
||||
|
||||
if (constructors.isEmpty()) {
|
||||
context.trace.report(NO_CONSTRUCTOR.on(CallUtilPackage.getValueArgumentListOrElement(context.call)));
|
||||
context.trace.report(NO_CONSTRUCTOR.on(CallUtilKt.getValueArgumentListOrElement(context.call)));
|
||||
return checkArgumentTypesAndFail(context);
|
||||
}
|
||||
|
||||
@@ -489,8 +488,8 @@ public class CallResolver {
|
||||
TemporaryBindingTrace traceToResolveCall = TemporaryBindingTrace.create(context.trace, "trace to resolve call", call);
|
||||
BasicCallResolutionContext newContext = context.replaceBindingTrace(traceToResolveCall);
|
||||
|
||||
recordScope(newContext.trace, newContext.scope, newContext.call.getCalleeExpression());
|
||||
recordDataFlowInfo(newContext, newContext.call.getCalleeExpression());
|
||||
BindingContextUtilsKt.recordScope(newContext.trace, newContext.scope, newContext.call.getCalleeExpression());
|
||||
BindingContextUtilsKt.recordDataFlowInfo(newContext, newContext.call.getCalleeExpression());
|
||||
|
||||
OverloadResolutionResultsImpl<F> results = doResolveCall(newContext, prioritizedTasks, callTransformer, tracing);
|
||||
DelegatingBindingTrace deltasTraceForTypeInference = ((OverloadResolutionResultsImpl) results).getTrace();
|
||||
@@ -515,7 +514,7 @@ public class CallResolver {
|
||||
@NotNull OverloadResolutionResultsImpl<D> results,
|
||||
@NotNull TracingStrategy tracing
|
||||
) {
|
||||
if (CallResolverUtilPackage.isInvokeCallOnVariable(context.call)) return;
|
||||
if (CallResolverUtilKt.isInvokeCallOnVariable(context.call)) return;
|
||||
if (!results.isSingleResult()) {
|
||||
if (results.getResultCode() == INCOMPLETE_TYPE_INFERENCE) {
|
||||
argumentTypeResolver.checkTypesWithNoCallee(context, RESOLVE_FUNCTION_ARGUMENTS);
|
||||
@@ -535,7 +534,7 @@ public class CallResolver {
|
||||
@NotNull TracingStrategy tracing
|
||||
) {
|
||||
Call call = context.call;
|
||||
if (CallResolverUtilPackage.isInvokeCallOnVariable(call)) return;
|
||||
if (CallResolverUtilKt.isInvokeCallOnVariable(call)) return;
|
||||
|
||||
DelegatingBindingTrace deltasTraceToCacheResolve = new DelegatingBindingTrace(
|
||||
BindingContext.EMPTY, "delta trace for caching resolve of", context.call);
|
||||
|
||||
@@ -277,7 +277,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
this.explicitExtensionReceiver = explicitExtensionReceiver;
|
||||
this.calleeExpressionAsDispatchReceiver = calleeExpressionAsDispatchReceiver;
|
||||
this.fakeInvokeExpression =
|
||||
(JetSimpleNameExpression) JetPsiFactory(call.getCallElement())
|
||||
(JetSimpleNameExpression) JetPsiFactoryKt.JetPsiFactory(call.getCallElement())
|
||||
.createExpression(OperatorNameConventions.INVOKE.asString());
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -27,10 +27,10 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -233,7 +233,7 @@ public class ValueArgumentsToParametersMapper {
|
||||
|
||||
public void process() {
|
||||
ProcessorState state = positionedOnly;
|
||||
List<? extends ValueArgument> argumentsInParentheses = CallUtilPackage.getValueArgumentsInParentheses(call);
|
||||
List<? extends ValueArgument> argumentsInParentheses = CallUtilKt.getValueArgumentsInParentheses(call);
|
||||
for (int i = 0; i < argumentsInParentheses.size(); i++) {
|
||||
ValueArgument valueArgument = argumentsInParentheses.get(i);
|
||||
if (valueArgument.isNamed()) {
|
||||
@@ -294,7 +294,7 @@ public class ValueArgumentsToParametersMapper {
|
||||
List<ValueParameterDescriptor> valueParameters = candidateCall.getCandidateDescriptor().getValueParameters();
|
||||
for (ValueParameterDescriptor valueParameter : valueParameters) {
|
||||
if (!usedParameters.contains(valueParameter)) {
|
||||
if (DescriptorUtilPackage.hasDefaultValue(valueParameter)) {
|
||||
if (DescriptorUtilsKt.hasDefaultValue(valueParameter)) {
|
||||
candidateCall.recordValueArgument(valueParameter, DefaultValueArgument.DEFAULT);
|
||||
}
|
||||
else if (valueParameter.getVarargElementType() != null) {
|
||||
|
||||
+5
-5
@@ -25,12 +25,13 @@ import org.jetbrains.kotlin.lexer.JetToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver;
|
||||
@@ -43,7 +44,6 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.NON_LOCAL_RETURN_NOT_ALLOWED;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.USAGE_IS_NOT_INLINABLE;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.isEffectivelyPublicApi;
|
||||
import static org.jetbrains.kotlin.resolve.inline.InlineUtil.allowsNonLocalReturns;
|
||||
import static org.jetbrains.kotlin.resolve.inline.InlineUtil.checkNonLocalReturnUsage;
|
||||
|
||||
@@ -55,7 +55,7 @@ class InlineChecker implements CallChecker {
|
||||
public InlineChecker(@NotNull SimpleFunctionDescriptor descriptor) {
|
||||
assert InlineUtil.isInline(descriptor) : "This extension should be created only for inline functions: " + descriptor;
|
||||
this.descriptor = descriptor;
|
||||
this.isEffectivelyPublicApiFunction = isEffectivelyPublicApi(descriptor);
|
||||
this.isEffectivelyPublicApiFunction = DescriptorUtilsKt.isEffectivelyPublicApi(descriptor);
|
||||
|
||||
for (ValueParameterDescriptor param : descriptor.getValueParameters()) {
|
||||
if (isInlinableParameter(param)) {
|
||||
@@ -186,7 +186,7 @@ class InlineChecker implements CallChecker {
|
||||
) {
|
||||
if (!(expression instanceof JetSimpleNameExpression || expression instanceof JetThisExpression)) return null;
|
||||
|
||||
ResolvedCall<?> thisCall = CallUtilPackage.getResolvedCall(expression, context.trace.getBindingContext());
|
||||
ResolvedCall<?> thisCall = CallUtilKt.getResolvedCall(expression, context.trace.getBindingContext());
|
||||
if (unwrapVariableAsFunction && thisCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return ((VariableAsFunctionResolvedCall) thisCall).getVariableCall().getResultingDescriptor();
|
||||
}
|
||||
@@ -236,7 +236,7 @@ class InlineChecker implements CallChecker {
|
||||
}
|
||||
|
||||
private void checkVisibility(@NotNull CallableDescriptor declarationDescriptor, @NotNull JetElement expression, @NotNull BasicCallResolutionContext context){
|
||||
boolean declarationDescriptorIsPublicApi = isEffectivelyPublicApi(declarationDescriptor) || isDefinedInInlineFunction(declarationDescriptor);
|
||||
boolean declarationDescriptorIsPublicApi = DescriptorUtilsKt.isEffectivelyPublicApi(declarationDescriptor) || isDefinedInInlineFunction(declarationDescriptor);
|
||||
if (isEffectivelyPublicApiFunction && !declarationDescriptorIsPublicApi && declarationDescriptor.getVisibility() != Visibilities.LOCAL) {
|
||||
context.trace.report(Errors.INVISIBLE_MEMBER_FROM_INLINE.on(expression, declarationDescriptor, descriptor));
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ReifiedTypeParameterSubstitutionChecker implements CallChecker {
|
||||
Errors.TYPE_PARAMETER_AS_REIFIED.on(getCallElement(context), parameter)
|
||||
);
|
||||
}
|
||||
else if (TypeUtilPackage.cannotBeReified(argument)) {
|
||||
else if (TypeUtilsKt.cannotBeReified(argument)) {
|
||||
context.trace.report(Errors.REIFIED_TYPE_FORBIDDEN_SUBSTITUTION.on(getCallElement(context), argument));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.psi.Call;
|
||||
import org.jetbrains.kotlin.psi.ValueArgument;
|
||||
import org.jetbrains.kotlin.resolve.DelegatingBindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
|
||||
import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
|
||||
@@ -293,7 +293,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
||||
|
||||
@Override
|
||||
public boolean isSafeCall() {
|
||||
return CallUtilPackage.isSafeCall(call);
|
||||
return CallUtilKt.isSafeCall(call);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -306,7 +306,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
||||
public boolean hasInferredReturnType() {
|
||||
if (!completed) {
|
||||
hasInferredReturnType = constraintSystem == null ||
|
||||
CallResolverUtilPackage.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
||||
CallResolverUtilKt.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
||||
}
|
||||
assert hasInferredReturnType != null : "The property 'hasInferredReturnType' was not set when the call was completed.";
|
||||
return hasInferredReturnType;
|
||||
|
||||
+2
-2
@@ -244,8 +244,8 @@ public class OverloadingConflictResolver {
|
||||
|
||||
if (!isSubtype) return false;
|
||||
|
||||
Specificity.Relation sThanG = TypesPackage.getSpecificityRelationTo(specific, general);
|
||||
Specificity.Relation gThanS = TypesPackage.getSpecificityRelationTo(general, specific);
|
||||
Specificity.Relation sThanG = TypeCapabilitiesKt.getSpecificityRelationTo(specific, general);
|
||||
Specificity.Relation gThanS = TypeCapabilitiesKt.getSpecificityRelationTo(general, specific);
|
||||
if (sThanG == Specificity.Relation.LESS_SPECIFIC && gThanS != Specificity.Relation.LESS_SPECIFIC) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import com.google.common.collect.Sets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionTask;
|
||||
@@ -104,7 +104,7 @@ public class ResolutionResultsHandler {
|
||||
// This check is needed for the following case:
|
||||
// x.foo(unresolved) -- if there are multiple foo's, we'd report an ambiguity, and it does not make sense here
|
||||
if (task.checkArguments != CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS ||
|
||||
!CallUtilPackage.hasUnresolvedArguments(task.call, task)) {
|
||||
!CallUtilKt.hasUnresolvedArguments(task.call, task)) {
|
||||
if (allCandidatesIncomplete) {
|
||||
task.tracing.cannotCompleteResolve(task.trace, results.getResultingCalls());
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
@@ -264,7 +264,7 @@ public class DataFlowValueFactory {
|
||||
) {
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(REFERENCE_TARGET, simpleNameExpression);
|
||||
if (declarationDescriptor instanceof VariableDescriptor) {
|
||||
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(simpleNameExpression, bindingContext);
|
||||
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(simpleNameExpression, bindingContext);
|
||||
|
||||
// todo uncomment assert
|
||||
// KT-4113
|
||||
|
||||
+4
-4
@@ -28,13 +28,13 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImpl;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemStatus;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
@@ -69,7 +69,7 @@ public abstract class AbstractTracingStrategy implements TracingStrategy {
|
||||
|
||||
@Override
|
||||
public void noValueForParameter(@NotNull BindingTrace trace, @NotNull ValueParameterDescriptor valueParameter) {
|
||||
JetElement reportOn = CallUtilPackage.getValueArgumentListOrElement(call);
|
||||
JetElement reportOn = CallUtilKt.getValueArgumentListOrElement(call);
|
||||
trace.report(NO_VALUE_FOR_PARAMETER.on(reportOn, valueParameter));
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class AbstractTracingStrategy implements TracingStrategy {
|
||||
@NotNull ExplicitReceiverKind explicitReceiverKind
|
||||
) {
|
||||
if (explicitReceiverKind == ExplicitReceiverKind.NO_EXPLICIT_RECEIVER) {
|
||||
DeclarationDescriptor importableDescriptor = DescriptorUtilPackage.getImportableDescriptor(classDescriptor);
|
||||
DeclarationDescriptor importableDescriptor = DescriptorUtilsKt.getImportableDescriptor(classDescriptor);
|
||||
if (DescriptorUtils.getFqName(importableDescriptor).isSafe()) {
|
||||
FqName fqName = getFqNameFromTopLevelClass(importableDescriptor);
|
||||
String qualifiedName;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.Call.CallType;
|
||||
import org.jetbrains.kotlin.psi.debugText.DebugTextPackage;
|
||||
import org.jetbrains.kotlin.psi.debugText.DebugTextUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -326,7 +326,7 @@ public class CallMaker {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return DebugTextPackage.getDebugText(callElement);
|
||||
return DebugTextUtilKt.getDebugText(callElement);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ public class DiagnosticsWithSuppression implements Diagnostics {
|
||||
// there's no point to present such diagnostics to the user, because the user didn't write this code
|
||||
PsiFile file = element.getContainingFile();
|
||||
if (file instanceof JetFile) {
|
||||
if (PsiPackage.getDoNotAnalyze((JetFile) file) != null) return true;
|
||||
if (JetPsiFactoryKt.getDoNotAnalyze((JetFile) file) != null) return true;
|
||||
}
|
||||
|
||||
for (DiagnosticSuppressor suppressor : DIAGNOSTIC_SUPPRESSORS.get()) {
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.FunctionAnalyzerExtension;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class InlineAnalyzerExtension implements FunctionAnalyzerExtension.Analyz
|
||||
) {
|
||||
List<JetParameter> jetParameters = function.getValueParameters();
|
||||
for (ValueParameterDescriptor parameter : functionDescriptor.getValueParameters()) {
|
||||
if (DescriptorUtilPackage.hasDefaultValue(parameter)) {
|
||||
if (DescriptorUtilsKt.hasDefaultValue(parameter)) {
|
||||
JetParameter jetParameter = jetParameters.get(parameter.getIndex());
|
||||
//report not supported default only on inlinable lambda and on parameter with inherited default (there is some problems to inline it)
|
||||
if (checkInlinableParameter(parameter, jetParameter, functionDescriptor, null) || !parameter.declaresDefaultValue()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user