Minor: replace some usages of (old) package facade with new package parts
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("FuzzyTypeUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("ImportsUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.imports
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("TypeUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("ExtensionUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
@@ -129,4 +131,4 @@ public fun ReceiverValue.getThisReceiverOwner(bindingContext: BindingContext): D
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("ScopeUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
@@ -39,4 +41,4 @@ public fun JetScope.getVariableFromImplicitReceivers(name: Name): VariableDescri
|
||||
it.type.memberScope.getProperties(name, NoLookupLocation.FROM_IDE).singleOrNull()?.let { return it }
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("JavaResolutionUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.caches.resolve
|
||||
|
||||
import com.intellij.psi.*
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("ResolutionUtils")
|
||||
|
||||
package org.jetbrains.kotlin.idea.caches.resolve
|
||||
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
@@ -97,4 +99,4 @@ public fun getResolveScope(file: JetFile): GlobalSearchScope {
|
||||
|
||||
public fun ResolutionFacade.getFileTopLevelScope(file: JetFile): LazyFileScope {
|
||||
return frontendService<FileScopeProvider>().getFileScope(file)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class KotlinJavaScriptMetaFileDecompiler extends ClassFileDecompilers.Ful
|
||||
@NotNull
|
||||
@Override
|
||||
public FileViewProvider createFileViewProvider(@NotNull VirtualFile file, @NotNull PsiManager manager, boolean physical) {
|
||||
return new KotlinJavascriptMetaFileViewProvider(manager, file, physical, DecompilerPackage.isKotlinJavaScriptInternalCompiledFile(
|
||||
return new KotlinJavascriptMetaFileViewProvider(manager, file, physical, DecompiledUtilsKt.isKotlinJavaScriptInternalCompiledFile(
|
||||
file));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.decompiler.DecompilerPackage;
|
||||
import org.jetbrains.kotlin.idea.decompiler.DecompiledUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.decompiler.KotlinClsFileBase;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetSourceFilterScope;
|
||||
import org.jetbrains.kotlin.idea.vfilefinder.JsVirtualFileFinderFactory;
|
||||
@@ -59,8 +59,8 @@ public final class DecompiledNavigationUtils {
|
||||
VirtualFile virtualFile = findVirtualFileContainingDescriptor(project, referencedDescriptor);
|
||||
|
||||
if (virtualFile == null ||
|
||||
!DecompilerPackage.isKotlinJvmCompiledFile(virtualFile) &&
|
||||
!DecompilerPackage.isKotlinJsMetaFile(virtualFile)) return null;
|
||||
!DecompiledUtilsKt.isKotlinJvmCompiledFile(virtualFile) &&
|
||||
!DecompiledUtilsKt.isKotlinJsMetaFile(virtualFile)) return null;
|
||||
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
|
||||
if (!(psiFile instanceof KotlinClsFileBase)) {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.checkers.DebugInfoUtil;
|
||||
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
|
||||
import org.jetbrains.kotlin.psi.JetCodeFragment;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
@@ -48,7 +48,7 @@ public class DebugInfoAnnotator implements Annotator {
|
||||
if (element instanceof JetFile && !(element instanceof JetCodeFragment)) {
|
||||
JetFile file = (JetFile) element;
|
||||
try {
|
||||
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
|
||||
BindingContext bindingContext = ResolutionUtils.analyzeFully(file);
|
||||
DebugInfoUtil.markDebugAnnotations(file, bindingContext, new DebugInfoUtil.DebugInfoReporter() {
|
||||
@Override
|
||||
public void reportElementWithErrorType(@NotNull JetReferenceExpression expression) {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.asJava.AsJavaPackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector;
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
|
||||
import org.jetbrains.kotlin.psi.JetDeclaration;
|
||||
@@ -43,7 +43,7 @@ public class DuplicateJvmSignatureAnnotator implements Annotator {
|
||||
PsiFile file = element.getContainingFile();
|
||||
if (!(file instanceof JetFile) || TargetPlatformDetector.getPlatform((JetFile) file) != JvmPlatform.INSTANCE$) return;
|
||||
|
||||
Diagnostics otherDiagnostics = ResolvePackage.analyzeFully((JetElement) element).getDiagnostics();
|
||||
Diagnostics otherDiagnostics = ResolutionUtils.analyzeFully((JetElement) element).getDiagnostics();
|
||||
GlobalSearchScope moduleScope = getModuleInfo(element).contentScope();
|
||||
Diagnostics diagnostics = AsJavaPackage.getJvmSignatureDiagnostics(element, otherDiagnostics, moduleScope);
|
||||
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -138,7 +138,7 @@ public class JetStructureViewElement implements StructureViewTreeElement, Querya
|
||||
@Override
|
||||
public DeclarationDescriptor compute() {
|
||||
if (!DumbService.isDumb(element.getProject())) {
|
||||
return ResolvePackage.resolveToDescriptor(declaration);
|
||||
return ResolutionUtils.resolveToDescriptor(declaration);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.psi.JetClassOrObject;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.stubs.*;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.StubIndexService;
|
||||
import org.jetbrains.kotlin.util.UtilPackage;
|
||||
import org.jetbrains.kotlin.util.TypeIndexUtilKt;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -113,7 +113,7 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
if (name != null) {
|
||||
sink.occurrence(JetFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (UtilPackage.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
if (TypeIndexUtilKt.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
sink.occurrence(JetProbablyNothingFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
if (name != null) {
|
||||
sink.occurrence(JetPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (UtilPackage.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
if (TypeIndexUtilKt.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
sink.occurrence(JetProbablyNothingPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.references.BuiltInsReferenceResolver;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
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.ResolvedCall;
|
||||
import org.jetbrains.kotlin.types.DeferredType;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
@@ -61,7 +61,7 @@ public class QuickFixUtil {
|
||||
public static JetType getDeclarationReturnType(JetNamedDeclaration declaration) {
|
||||
PsiFile file = declaration.getContainingFile();
|
||||
if (!(file instanceof JetFile)) return null;
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(declaration);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(declaration);
|
||||
if (!(descriptor instanceof CallableDescriptor)) return null;
|
||||
JetType type = ((CallableDescriptor) descriptor).getReturnType();
|
||||
if (type instanceof DeferredType) {
|
||||
@@ -104,7 +104,7 @@ public class QuickFixUtil {
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
@Nullable ValueArgument valueArgument
|
||||
) {
|
||||
PsiElement declaration = safeGetDeclaration(CallUtilPackage.getParameterForArgument(resolvedCall, valueArgument));
|
||||
PsiElement declaration = safeGetDeclaration(CallUtilKt.getParameterForArgument(resolvedCall, valueArgument));
|
||||
return declaration instanceof JetParameter ? (JetParameter) declaration : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.caches.JarUserDataManager;
|
||||
import org.jetbrains.kotlin.idea.debugger.filter.FilterPackage;
|
||||
import org.jetbrains.kotlin.idea.debugger.filter.DebuggerFiltersUtilKt;
|
||||
import org.jetbrains.kotlin.idea.decompiler.HasCompiledKotlinInJar;
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinJavaScriptLibraryDetectionUtil;
|
||||
import org.jetbrains.kotlin.rmi.kotlinr.KotlinCompilerClient;
|
||||
@@ -42,7 +42,7 @@ public class PluginStartupComponent implements ApplicationComponent {
|
||||
JarUserDataManager.INSTANCE$.register(KotlinJavaScriptLibraryDetectionUtil.HasKotlinJSMetadataInJar.INSTANCE$);
|
||||
JarUserDataManager.INSTANCE$.register(HasCompiledKotlinInJar.INSTANCE$);
|
||||
|
||||
FilterPackage.addKotlinStdlibDebugFilterIfNeeded();
|
||||
DebuggerFiltersUtilKt.addKotlinStdlibDebugFilterIfNeeded();
|
||||
}
|
||||
|
||||
private static void registerPathVariable() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.kotlin.checkers.CheckerTestUtil;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CopyAsDiagnosticTestAction extends AnAction {
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
assert editor != null && psiFile != null;
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) psiFile);
|
||||
BindingContext bindingContext = ResolutionUtils.analyzeFully((JetFile) psiFile);
|
||||
|
||||
List<Diagnostic> diagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null);
|
||||
String result = CheckerTestUtil.addDiagnosticMarkersToText(psiFile, diagnostics).toString();
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -74,7 +74,7 @@ public class CodeInsightUtils {
|
||||
|
||||
JetExpression expression = (JetExpression) element;
|
||||
|
||||
BindingContext context = ResolvePackage.analyze(expression);
|
||||
BindingContext context = ResolutionUtils.analyze(expression);
|
||||
|
||||
Qualifier qualifier = context.get(BindingContext.QUALIFIER, expression);
|
||||
if (qualifier != null) {
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver;
|
||||
@@ -61,7 +61,7 @@ public class GotoSuperActionHandler implements CodeInsightActionHandler {
|
||||
JetObjectDeclaration.class);
|
||||
if (declaration == null) return;
|
||||
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(declaration);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(declaration);
|
||||
|
||||
List<PsiElement> superDeclarations = findSuperDeclarations(descriptor);
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.codeInsight;
|
||||
import com.intellij.ide.util.DefaultPsiElementCellRenderer;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetNamedFunction;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class JetFunctionPsiElementCellRenderer extends DefaultPsiElementCellRend
|
||||
public String getElementText(PsiElement element) {
|
||||
if (element instanceof JetNamedFunction) {
|
||||
JetNamedFunction function = (JetNamedFunction) element;
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(function);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(function);
|
||||
return DescriptorRenderer.SHORT_NAMES_IN_TYPES.render(descriptor);
|
||||
}
|
||||
return super.getElementText(element);
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetElement;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -32,7 +32,7 @@ public class JetTypeDeclarationProvider implements TypeDeclarationProvider {
|
||||
@Override
|
||||
public PsiElement[] getSymbolTypeDeclarations(PsiElement symbol) {
|
||||
if (symbol instanceof JetElement && symbol.getContainingFile() instanceof JetFile) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze((JetElement)symbol);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze((JetElement)symbol);
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, symbol);
|
||||
if (descriptor instanceof CallableDescriptor) {
|
||||
JetType type = ((CallableDescriptor) descriptor).getReturnType();
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
@@ -117,7 +117,7 @@ public class MoveDeclarationsOutHelper {
|
||||
|
||||
@NotNull
|
||||
private static JetType getPropertyType(@NotNull JetProperty property) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(property, BodyResolveMode.PARTIAL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(property, BodyResolveMode.PARTIAL);
|
||||
|
||||
VariableDescriptor propertyDescriptor = bindingContext.get(BindingContext.VARIABLE, property);
|
||||
assert propertyDescriptor != null : "Couldn't resolve property to property descriptor " + property.getText();
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetCallExpression;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.JetQualifiedExpression;
|
||||
@@ -44,7 +44,7 @@ public abstract class KotlinExpressionSurrounder implements Surrounder {
|
||||
if (expression instanceof JetCallExpression && expression.getParent() instanceof JetQualifiedExpression) {
|
||||
return false;
|
||||
}
|
||||
JetType type = ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
JetType type = ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
if (type == null || isUnit(type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.JetParenthesizedExpression;
|
||||
import org.jetbrains.kotlin.psi.JetPrefixExpression;
|
||||
@@ -41,7 +41,7 @@ public class KotlinNotSurrounder extends KotlinExpressionSurrounder {
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull JetExpression expression) {
|
||||
JetType type = ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
JetType type = ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
return type != null && KotlinBuiltIns.isBoolean(type);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -26,12 +26,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.JetWhenCondition;
|
||||
import org.jetbrains.kotlin.psi.JetWhenEntry;
|
||||
import org.jetbrains.kotlin.psi.JetWhenExpression;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
@@ -70,7 +69,7 @@ public class KotlinWhenSurrounder extends KotlinExpressionSurrounder {
|
||||
}
|
||||
|
||||
private String getCodeTemplate(JetExpression expression) {
|
||||
JetType type = ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
JetType type = ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
|
||||
if (type != null) {
|
||||
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
if (descriptor instanceof ClassDescriptor && ((ClassDescriptor) descriptor).getKind() == ClassKind.ENUM_CLASS) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.decompiler.navigation.JetSourceNavigationHelper;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetClassShortNameIndex;
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
|
||||
@@ -69,7 +69,7 @@ public class KotlinTypeHierarchyProvider extends JavaTypeHierarchyProvider {
|
||||
else if (target instanceof JetNamedFunction) {
|
||||
JetNamedFunction function = (JetNamedFunction) target;
|
||||
String functionName = function.getName();
|
||||
FunctionDescriptor functionDescriptor = ResolvePackage.analyze(function)
|
||||
FunctionDescriptor functionDescriptor = ResolutionUtils.analyze(function)
|
||||
.get(BindingContext.FUNCTION, target);
|
||||
if (functionDescriptor != null) {
|
||||
JetType type = functionDescriptor.getReturnType();
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -163,7 +163,7 @@ public class KotlinCallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
|
||||
elementText = ((JetFile) element).getName();
|
||||
}
|
||||
else if (element instanceof JetNamedDeclaration) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
|
||||
if (descriptor == null) return null;
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightMethod;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.references.ReferencesPackage;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||
@@ -89,7 +89,7 @@ public class KotlinCalleeMethodsTreeStructure extends KotlinCallTreeStructure {
|
||||
final Map<PsiReference, PsiElement> referencesToCalleeElements = new HashMap<PsiReference, PsiElement>();
|
||||
for (JetElement element : elementsToAnalyze) {
|
||||
element.accept(
|
||||
new CalleeReferenceVisitorBase(ResolvePackage.analyze(element, BodyResolveMode.FULL), false) {
|
||||
new CalleeReferenceVisitorBase(ResolutionUtils.analyze(element, BodyResolveMode.FULL), false) {
|
||||
@Override
|
||||
protected void processDeclaration(JetSimpleNameExpression reference, PsiElement declaration) {
|
||||
referencesToCalleeElements.put(ReferencesPackage.getMainReference(reference), declaration);
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ import com.intellij.util.containers.HashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.asJava.LightClassUtil;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.hierarchy.HierarchyUtils;
|
||||
import org.jetbrains.kotlin.idea.references.JetReference;
|
||||
import org.jetbrains.kotlin.idea.references.ReferencesPackage;
|
||||
@@ -71,7 +71,7 @@ public class KotlinCallerMethodsTreeStructure extends KotlinCallTreeStructure {
|
||||
|
||||
JetElement codeBlockForLocalDeclaration = getEnclosingElementForLocalDeclaration(element);
|
||||
if (codeBlockForLocalDeclaration != null) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
|
||||
final Map<PsiReference, PsiElement> referencesToElements = new HashMap<PsiReference, PsiElement>();
|
||||
codeBlockForLocalDeclaration.accept(new CalleeReferenceVisitorBase(bindingContext, true) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
||||
import org.jetbrains.kotlin.idea.util.DebuggerUtils;
|
||||
import org.jetbrains.kotlin.idea.util.InfinitePeriodicalTask;
|
||||
@@ -51,7 +51,7 @@ import org.jetbrains.kotlin.psi.JetClassOrObject;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetScript;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -197,7 +197,7 @@ public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
|
||||
GenerationState state;
|
||||
DiagnosticSink.CollectAll sink = new DiagnosticSink.CollectAll();
|
||||
try {
|
||||
ResolutionFacade resolutionFacade = ResolvePackage.getResolutionFacade(jetFile);
|
||||
ResolutionFacade resolutionFacade = ResolutionUtils.getResolutionFacade(jetFile);
|
||||
|
||||
BindingContext bindingContextForFile = resolutionFacade.analyzeFullyAndGetResult(Collections.singletonList(jetFile)).getBindingContext();
|
||||
|
||||
@@ -259,7 +259,7 @@ public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
|
||||
for (Diagnostic diagnostic : diagnostics) {
|
||||
answer.append("// Error at ")
|
||||
.append(diagnostic.getPsiFile().getName())
|
||||
.append(UtilsPackage.join(diagnostic.getTextRanges(), ","))
|
||||
.append(StringsKt.join(diagnostic.getTextRanges(), ","))
|
||||
.append(": ")
|
||||
.append(DefaultErrorMessages.render(diagnostic))
|
||||
.append("\n");
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind;
|
||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.overrideImplement.ImplementMembersHandler;
|
||||
import org.jetbrains.kotlin.psi.JetReferenceExpression;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -61,7 +61,7 @@ class AnonymousTemplateEditingListener extends TemplateEditingAdapter {
|
||||
PsiElement name = psiFile.findElementAt(variableRange.getStartOffset());
|
||||
if (name != null && name.getParent() instanceof JetReferenceExpression) {
|
||||
JetReferenceExpression ref = (JetReferenceExpression) name.getParent();
|
||||
DeclarationDescriptor descriptor = ResolvePackage.analyze(ref, BodyResolveMode.FULL).get(BindingContext.REFERENCE_TARGET, ref);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.analyze(ref, BodyResolveMode.FULL).get(BindingContext.REFERENCE_TARGET, ref);
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
classRef = ref;
|
||||
classDescriptor = (ClassDescriptor) descriptor;
|
||||
|
||||
@@ -34,10 +34,10 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.IterableTypesDetection;
|
||||
import org.jetbrains.kotlin.idea.core.IterableTypesDetector;
|
||||
import org.jetbrains.kotlin.idea.util.UtilPackage;
|
||||
import org.jetbrains.kotlin.idea.util.ExtensionUtils;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
@@ -64,7 +64,7 @@ public abstract class BaseJetVariableMacro extends Macro {
|
||||
JetExpression contextExpression = findContextExpression(psiFile, context.getStartOffset());
|
||||
if (contextExpression == null) return null;
|
||||
|
||||
ResolutionFacade resolutionFacade = ResolvePackage.getResolutionFacade(contextExpression);
|
||||
ResolutionFacade resolutionFacade = ResolutionUtils.getResolutionFacade(contextExpression);
|
||||
|
||||
BindingContext bindingContext = resolutionFacade.analyze(contextExpression, BodyResolveMode.FULL);
|
||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, contextExpression);
|
||||
@@ -82,7 +82,7 @@ public abstract class BaseJetVariableMacro extends Macro {
|
||||
VariableDescriptor variableDescriptor = (VariableDescriptor) declarationDescriptor;
|
||||
|
||||
if (variableDescriptor.getExtensionReceiverParameter() != null
|
||||
&& UtilPackage.substituteExtensionIfCallableWithImplicitReceiver(
|
||||
&& ExtensionUtils.substituteExtensionIfCallableWithImplicitReceiver(
|
||||
variableDescriptor, scope, bindingContext, dataFlowInfo).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -92,7 +92,7 @@ public class JetAnonymousSuperMacro extends Macro {
|
||||
JetExpression expression = PsiTreeUtil.getParentOfType(psiFile.findElementAt(context.getStartOffset()), JetExpression.class);
|
||||
if (expression == null) return null;
|
||||
|
||||
BindingContext bc = ResolvePackage.analyze(expression, BodyResolveMode.FULL);
|
||||
BindingContext bc = ResolutionUtils.analyze(expression, BodyResolveMode.FULL);
|
||||
JetScope scope = bc.get(BindingContext.RESOLUTION_SCOPE, expression);
|
||||
if (scope == null) return null;
|
||||
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.ReferenceVariantsHelper;
|
||||
import org.jetbrains.kotlin.idea.core.CorePackage;
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
||||
@@ -384,7 +384,7 @@ public class JetFunctionParameterInfoHandler implements ParameterInfoHandlerWith
|
||||
return null;
|
||||
}
|
||||
|
||||
ResolutionFacade resolutionFacade = ResolvePackage.getResolutionFacade(callNameExpression.getContainingJetFile());
|
||||
ResolutionFacade resolutionFacade = ResolutionUtils.getResolutionFacade(callNameExpression.getContainingJetFile());
|
||||
final BindingContext bindingContext = resolutionFacade.analyze(callNameExpression, BodyResolveMode.FULL);
|
||||
|
||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, callNameExpression);
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.CollectingNameValidator;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.*;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
@@ -113,7 +113,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) callElement.getContainingFile());
|
||||
BindingContext bindingContext = ResolutionUtils.analyzeFully((JetFile) callElement.getContainingFile());
|
||||
runChangeSignature(project, functionDescriptor, addParameterConfiguration(), bindingContext, callElement, getText());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.actions.JetAddFunctionToClassifierAction;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
@@ -52,7 +52,7 @@ public class AddFunctionToSupertypeFix extends JetHintAction<JetNamedFunction> {
|
||||
}
|
||||
|
||||
private static List<FunctionDescriptor> generateFunctionsToAdd(JetNamedFunction functionElement) {
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolvePackage.resolveToDescriptor(functionElement);
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolutionUtils.resolveToDescriptor(functionElement);
|
||||
|
||||
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
|
||||
if (!(containingDeclaration instanceof ClassDescriptor)) return Collections.emptyList();
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.project.PluginJetFilesProvider;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class AddOverrideToEqualsHashCodeToStringFix extends JetIntentionAction<P
|
||||
Collection<JetFile> files = PluginJetFilesProvider.allFilesInProject(file.getProject());
|
||||
|
||||
for (JetFile jetFile : files) {
|
||||
for (Diagnostic diagnostic : ResolvePackage.analyzeFully(jetFile).getDiagnostics()) {
|
||||
for (Diagnostic diagnostic : ResolutionUtils.analyzeFully(jetFile).getDiagnostics()) {
|
||||
if (diagnostic.getFactory() != Errors.VIRTUAL_MEMBER_HIDDEN) continue;
|
||||
|
||||
JetModifierListOwner element = (JetModifierListOwner) diagnostic.getPsiElement();
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -65,7 +65,7 @@ public class CastExpressionFix extends JetIntentionAction<JetExpression> {
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
if (!super.isAvailable(project, editor, file)) return false;
|
||||
JetType expressionType = ResolvePackage.analyze(element).getType(element);
|
||||
JetType expressionType = ResolutionUtils.analyze(element).getType(element);
|
||||
return expressionType != null
|
||||
&& (
|
||||
JetTypeChecker.DEFAULT.isSubtypeOf(type, expressionType) // downcast
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
@@ -57,7 +57,7 @@ public class ChangeFunctionLiteralReturnTypeFix extends JetIntentionAction<JetFu
|
||||
this.type = type;
|
||||
functionLiteralReturnTypeRef = functionLiteralExpression.getFunctionLiteral().getTypeReference();
|
||||
|
||||
BindingContext context = ResolvePackage.analyzeFully(functionLiteralExpression.getContainingJetFile());
|
||||
BindingContext context = ResolutionUtils.analyzeFully(functionLiteralExpression.getContainingJetFile());
|
||||
JetType functionLiteralType = context.getType(functionLiteralExpression);
|
||||
assert functionLiteralType != null : "Type of function literal not available in binding context";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.CollectingNameValidator;
|
||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.*;
|
||||
@@ -57,7 +57,7 @@ public class ChangeFunctionLiteralSignatureFix extends ChangeFunctionSignatureFi
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
|
||||
BindingContext bindingContext = ResolutionUtils.analyzeFully(file);
|
||||
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
@@ -137,7 +137,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
@Override
|
||||
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
|
||||
JetMultiDeclarationEntry entry = getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
|
||||
BindingContext context = ResolvePackage.analyze(entry);
|
||||
BindingContext context = ResolutionUtils.analyze(entry);
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction componentFunction = (JetFunction) DescriptorToSourceUtils
|
||||
@@ -159,7 +159,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
|
||||
JetExpression expression = QuickFixUtil.getParentElementOfType(diagnostic, JetExpression.class);
|
||||
assert expression != null : "HAS_NEXT_FUNCTION_TYPE_MISMATCH reported on element that is not within any expression";
|
||||
BindingContext context = ResolvePackage.analyze(expression);
|
||||
BindingContext context = ResolutionUtils.analyze(expression);
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, expression);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction hasNextFunction = (JetFunction) DescriptorToSourceUtils
|
||||
@@ -180,7 +180,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
|
||||
JetBinaryExpression expression = QuickFixUtil.getParentElementOfType(diagnostic, JetBinaryExpression.class);
|
||||
assert expression != null : "COMPARE_TO_TYPE_MISMATCH reported on element that is not within any expression";
|
||||
BindingContext context = ResolvePackage.analyze(expression);
|
||||
BindingContext context = ResolutionUtils.analyze(expression);
|
||||
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(expression, context);
|
||||
if (resolvedCall == null) return null;
|
||||
PsiElement compareTo = DescriptorToSourceUtils.descriptorToDeclaration(resolvedCall.getCandidateDescriptor());
|
||||
@@ -200,7 +200,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
|
||||
JetFunction function = QuickFixUtil.getParentElementOfType(diagnostic, JetFunction.class);
|
||||
if (function != null) {
|
||||
FunctionDescriptor descriptor = (FunctionDescriptor)ResolvePackage.resolveToDescriptor(function);
|
||||
FunctionDescriptor descriptor = (FunctionDescriptor) ResolutionUtils.resolveToDescriptor(function);
|
||||
|
||||
JetType matchingReturnType = QuickFixUtil.findLowerBoundOfOverriddenCallablesReturnTypes(descriptor);
|
||||
if (matchingReturnType != null) {
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde;
|
||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
@@ -106,7 +106,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
return KotlinNameSuggester.INSTANCE$.suggestNameByName(argumentName.getAsName().asString(), validator);
|
||||
}
|
||||
else if (expression != null) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL);
|
||||
return KotlinNameSuggester.INSTANCE$.suggestNamesByExpressionAndType(expression, bindingContext, validator, "param").iterator().next();
|
||||
}
|
||||
else {
|
||||
@@ -175,7 +175,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
DiagnosticWithParameters2<JetFunction, Integer, List<JetType>> diagnosticWithParameters =
|
||||
EXPECTED_PARAMETERS_NUMBER_MISMATCH.cast(diagnostic);
|
||||
JetFunction functionLiteral = diagnosticWithParameters.getPsiElement();
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(functionLiteral);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(functionLiteral);
|
||||
|
||||
if (descriptor instanceof FunctionDescriptor && functionLiteral instanceof JetFunctionLiteral) {
|
||||
return new ChangeFunctionLiteralSignatureFix((JetFunctionLiteral) functionLiteral, (FunctionDescriptor) descriptor,
|
||||
@@ -236,7 +236,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
List<? extends ValueArgument> arguments = callElement.getValueArguments();
|
||||
|
||||
if (arguments.size() > parameters.size()) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(callElement);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(callElement);
|
||||
boolean hasTypeMismatches = hasTypeMismatches(parameters, arguments, bindingContext);
|
||||
return new AddFunctionParametersFix(callElement, functionDescriptor, hasTypeMismatches);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
@@ -128,7 +128,7 @@ public class ChangeMemberFunctionSignatureFix extends JetHintAction<JetNamedFunc
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolvePackage.resolveToDescriptor(functionElement);
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolutionUtils.resolveToDescriptor(functionElement);
|
||||
List<FunctionDescriptor> superFunctions = getPossibleSuperFunctionsDescriptors(functionDescriptor);
|
||||
final Map<String, FunctionDescriptor> possibleSignatures = Maps.newHashMap();
|
||||
for (FunctionDescriptor superFunction : superFunctions) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
@@ -116,7 +116,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
|
||||
@Override
|
||||
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
|
||||
JetMultiDeclarationEntry entry = ChangeFunctionReturnTypeFix.getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
|
||||
BindingContext context = ResolvePackage.analyze(entry);
|
||||
BindingContext context = ResolutionUtils.analyze(entry);
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction componentFunction = (JetFunction) DescriptorToSourceUtils
|
||||
@@ -138,7 +138,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
|
||||
|
||||
if (diagnostic.getPsiElement() instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) diagnostic.getPsiElement();
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(property);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(property);
|
||||
if (!(descriptor instanceof PropertyDescriptor)) return actions;
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.Visibilities;
|
||||
import org.jetbrains.kotlin.descriptors.Visibility;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
@@ -69,7 +69,7 @@ public class ChangeVisibilityModifierFix extends JetIntentionAction<JetModifierL
|
||||
|
||||
@Nullable
|
||||
private JetModifierKeywordToken findVisibilityChangeTo(JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(element);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(element);
|
||||
DeclarationDescriptor descriptor;
|
||||
if (element instanceof JetParameter) {
|
||||
descriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, element);
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.psi.JetCallableDeclaration;
|
||||
import org.jetbrains.kotlin.psi.JetDeclaration;
|
||||
@@ -61,7 +61,7 @@ public class MakeOverriddenMemberOpenFix extends JetIntentionAction<JetDeclarati
|
||||
overriddenNonOverridableMembers.clear();
|
||||
containingDeclarationsNames.clear();
|
||||
|
||||
DeclarationDescriptor descriptor = ResolvePackage.resolveToDescriptor(element);
|
||||
DeclarationDescriptor descriptor = ResolutionUtils.resolveToDescriptor(element);
|
||||
if (!(descriptor instanceof CallableMemberDescriptor)) return false;
|
||||
|
||||
for (CallableMemberDescriptor overriddenDescriptor : getAllDeclaredNonOverridableOverriddenDescriptors(
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
@@ -80,7 +80,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, JetFile file) throws IncorrectOperationException {
|
||||
BindingContext context = ResolvePackage.analyzeFully(file);
|
||||
BindingContext context = ResolutionUtils.analyzeFully(file);
|
||||
Iterable<Diagnostic> diagnostics = context.getDiagnostics();
|
||||
List<JetImportDirective> imports = new ArrayList<JetImportDirective>();
|
||||
List<JetUserType> usages = new ArrayList<JetUserType>();
|
||||
@@ -194,7 +194,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
|
||||
JetReferenceExpression typeExpr = getImportOrUsageFromDiagnostic(diagnostic);
|
||||
if (typeExpr == null) return null;
|
||||
|
||||
BindingContext context = ResolvePackage.analyze(typeExpr);
|
||||
BindingContext context = ResolutionUtils.analyze(typeExpr);
|
||||
ClassDescriptor platformClass = resolveToClass(typeExpr, context);
|
||||
if (platformClass == null) return null;
|
||||
|
||||
|
||||
+12
-11
@@ -28,10 +28,10 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.CorePackage;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.idea.util.UtilPackage;
|
||||
import org.jetbrains.kotlin.idea.util.TypeUtils;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
|
||||
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@@ -54,7 +54,7 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
|
||||
protected List<IntentionAction> doCreateActions(@NotNull Diagnostic diagnostic) {
|
||||
List<IntentionAction> actions = new LinkedList<IntentionAction>();
|
||||
|
||||
BindingContext context = ResolvePackage.analyzeFully((JetFile) diagnostic.getPsiFile());
|
||||
BindingContext context = ResolutionUtils.analyzeFully((JetFile) diagnostic.getPsiFile());
|
||||
|
||||
PsiElement diagnosticElement = diagnostic.getPsiElement();
|
||||
if (!(diagnosticElement instanceof JetExpression)) {
|
||||
@@ -75,7 +75,7 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
|
||||
DiagnosticWithParameters1<JetConstantExpression, JetType> diagnosticWithParameters =
|
||||
Errors.NULL_FOR_NONNULL_TYPE.cast(diagnostic);
|
||||
expectedType = diagnosticWithParameters.getA();
|
||||
expressionType = TypeUtilPackage.makeNullable(expectedType);
|
||||
expressionType = TypeUtilsKt.makeNullable(expectedType);
|
||||
}
|
||||
else if (diagnostic.getFactory() == Errors.CONSTANT_EXPECTED_TYPE_MISMATCH) {
|
||||
DiagnosticWithParameters2<JetConstantExpression, String, JetType> diagnosticWithParameters =
|
||||
@@ -104,8 +104,8 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
|
||||
JetExpression initializer = property.getInitializer();
|
||||
if (QuickFixUtil.canEvaluateTo(initializer, expression) ||
|
||||
(getter != null && QuickFixUtil.canFunctionOrGetterReturnExpression(property.getGetter(), expression))) {
|
||||
LexicalScope scope = CorePackage.getResolutionScope(property, context, ResolvePackage.getResolutionFacade(property));
|
||||
JetType typeToInsert = UtilPackage.approximateWithResolvableType(expressionType, scope, false);
|
||||
LexicalScope scope = CorePackage.getResolutionScope(property, context, ResolutionUtils.getResolutionFacade(property));
|
||||
JetType typeToInsert = TypeUtils.approximateWithResolvableType(expressionType, scope, false);
|
||||
actions.add(new ChangeVariableTypeFix(property, typeToInsert));
|
||||
}
|
||||
}
|
||||
@@ -118,8 +118,8 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
|
||||
? BindingContextUtilPackage.getTargetFunction((JetReturnExpression) expressionParent, context)
|
||||
: PsiTreeUtil.getParentOfType(expression, JetFunction.class, true);
|
||||
if (function instanceof JetFunction && QuickFixUtil.canFunctionOrGetterReturnExpression(function, expression)) {
|
||||
LexicalScope scope = CorePackage.getResolutionScope(function, context, ResolvePackage.getResolutionFacade(function));
|
||||
JetType typeToInsert = UtilPackage.approximateWithResolvableType(expressionType, scope, false);
|
||||
LexicalScope scope = CorePackage.getResolutionScope(function, context, ResolutionUtils.getResolutionFacade(function));
|
||||
JetType typeToInsert = TypeUtils.approximateWithResolvableType(expressionType, scope, false);
|
||||
actions.add(new ChangeFunctionReturnTypeFix((JetFunction) function, typeToInsert));
|
||||
}
|
||||
|
||||
@@ -159,8 +159,9 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
|
||||
: context.getType(valueArgument.getArgumentExpression());
|
||||
if (correspondingParameter != null && valueArgumentType != null) {
|
||||
JetCallableDeclaration callable = PsiTreeUtil.getParentOfType(correspondingParameter, JetCallableDeclaration.class, true);
|
||||
LexicalScope scope = callable != null ? CorePackage.getResolutionScope(callable, context, ResolvePackage.getResolutionFacade(callable)) : null;
|
||||
JetType typeToInsert = UtilPackage.approximateWithResolvableType(valueArgumentType, scope, true);
|
||||
LexicalScope scope = callable != null ? CorePackage.getResolutionScope(callable, context, ResolutionUtils
|
||||
.getResolutionFacade(callable)) : null;
|
||||
JetType typeToInsert = TypeUtils.approximateWithResolvableType(valueArgumentType, scope, true);
|
||||
actions.add(new ChangeParameterTypeFix(correspondingParameter, typeToInsert));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ChangeSignaturePackage;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.JetChangeSignatureConfiguration;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.JetMethodDescriptor;
|
||||
@@ -57,7 +57,7 @@ public class RemoveFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
|
||||
BindingContext bindingContext = ResolutionUtils.analyzeFully(file);
|
||||
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetParameter;
|
||||
@@ -49,7 +49,7 @@ public class RenameParameterToMatchOverriddenMethodFix extends JetIntentionActio
|
||||
return false;
|
||||
}
|
||||
|
||||
BindingContext context = ResolvePackage.analyze(parameter);
|
||||
BindingContext context = ResolutionUtils.analyze(parameter);
|
||||
VariableDescriptor parameterDescriptor = context.get(BindingContext.VALUE_PARAMETER, parameter);
|
||||
if (parameterDescriptor == null) {
|
||||
return false;
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
@@ -127,7 +127,7 @@ public class JetRefactoringUtil {
|
||||
@Nullable Collection<PsiElement> ignore,
|
||||
@NotNull String actionStringKey
|
||||
) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(declaration, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(declaration, BodyResolveMode.FULL);
|
||||
|
||||
CallableDescriptor declarationDescriptor =
|
||||
(CallableDescriptor)bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
|
||||
@@ -262,7 +262,7 @@ public class JetRefactoringUtil {
|
||||
PsiElement originalDeclaration = AsJavaPackage.getUnwrapped(method);
|
||||
if (originalDeclaration instanceof JetDeclaration) {
|
||||
JetDeclaration jetDeclaration = (JetDeclaration) originalDeclaration;
|
||||
BindingContext bindingContext = ResolvePackage.analyze(jetDeclaration, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(jetDeclaration, BodyResolveMode.FULL);
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, jetDeclaration);
|
||||
|
||||
if (descriptor != null) return formatFunctionDescriptor(descriptor);
|
||||
@@ -272,7 +272,7 @@ public class JetRefactoringUtil {
|
||||
|
||||
@NotNull
|
||||
public static String formatClass(@NotNull JetClassOrObject classOrObject) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(classOrObject, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(classOrObject, BodyResolveMode.FULL);
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, classOrObject);
|
||||
|
||||
if (descriptor instanceof ClassDescriptor) return formatClassDescriptor(descriptor);
|
||||
@@ -422,7 +422,7 @@ public class JetRefactoringUtil {
|
||||
}
|
||||
if (addExpression) {
|
||||
JetExpression expression = (JetExpression)element;
|
||||
BindingContext bindingContext = ResolvePackage.analyze(expression, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(expression, BodyResolveMode.FULL);
|
||||
JetType expressionType = bindingContext.getType(expression);
|
||||
if (expressionType == null || !KotlinBuiltIns.isUnit(expressionType)) {
|
||||
expressions.add(expression);
|
||||
|
||||
+20
-19
@@ -47,7 +47,8 @@ import org.jetbrains.kotlin.asJava.KotlinLightMethod;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.JetFileType;
|
||||
import org.jetbrains.kotlin.idea.analysis.AnalysisPackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.JetFileReferencesResolver;
|
||||
import org.jetbrains.kotlin.idea.core.refactoring.RefactoringPackage;
|
||||
@@ -56,7 +57,7 @@ import org.jetbrains.kotlin.idea.references.JetSimpleNameReference;
|
||||
import org.jetbrains.kotlin.idea.references.ReferencesPackage;
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearchPackage;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.UtilPackage;
|
||||
import org.jetbrains.kotlin.idea.util.ScopeUtils;
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocName;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -73,7 +74,7 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
import java.util.*;
|
||||
@@ -199,8 +200,8 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
}
|
||||
);
|
||||
if (body != null) {
|
||||
final DeclarationDescriptor callerDescriptor = ResolvePackage.resolveToDescriptor(element);
|
||||
final BindingContext context = ResolvePackage.analyze(body);
|
||||
final DeclarationDescriptor callerDescriptor = ResolutionUtils.resolveToDescriptor(element);
|
||||
final BindingContext context = ResolutionUtils.analyze(body);
|
||||
body.accept(
|
||||
new JetTreeVisitorVoid() {
|
||||
@Override
|
||||
@@ -352,12 +353,12 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
JetFunction jetFunction = (JetFunction) functionUsageInfo.getDeclaration();
|
||||
JetExpression body = jetFunction.getBodyExpression();
|
||||
if (body != null) {
|
||||
body.accept(visitor, ResolvePackage.analyze(body, BodyResolveMode.FULL));
|
||||
body.accept(visitor, ResolutionUtils.analyze(body, BodyResolveMode.FULL));
|
||||
}
|
||||
for (JetParameter parameter : jetFunction.getValueParameters()) {
|
||||
JetExpression defaultValue = parameter.getDefaultValue();
|
||||
if (defaultValue != null) {
|
||||
defaultValue.accept(visitor, ResolvePackage.analyze(defaultValue, BodyResolveMode.FULL));
|
||||
defaultValue.accept(visitor, ResolutionUtils.analyze(defaultValue, BodyResolveMode.FULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -433,7 +434,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
PsiElement method = changeInfo.getMethod();
|
||||
if (!RefactoringPackage.isTrueJavaMethod(method)) return;
|
||||
|
||||
FunctionDescriptor methodDescriptor = ResolvePackage.getJavaMethodDescriptor((PsiMethod) method);
|
||||
FunctionDescriptor methodDescriptor = JavaResolutionUtils.getJavaMethodDescriptor((PsiMethod) method);
|
||||
assert methodDescriptor != null;
|
||||
|
||||
DeclarationDescriptor containingDescriptor = methodDescriptor.getContainingDeclaration();
|
||||
@@ -457,7 +458,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
JetExpression argExpression = arguments.get(0).getArgumentExpression();
|
||||
if (!(argExpression instanceof JetFunctionLiteralExpression)) continue;
|
||||
|
||||
BindingContext context = ResolvePackage.analyze(callExpression, BodyResolveMode.FULL);
|
||||
BindingContext context = ResolutionUtils.analyze(callExpression, BodyResolveMode.FULL);
|
||||
|
||||
JetFunctionLiteral functionLiteral = ((JetFunctionLiteralExpression) argExpression).getFunctionLiteral();
|
||||
FunctionDescriptor functionDescriptor = context.get(BindingContext.FUNCTION, functionLiteral);
|
||||
@@ -501,7 +502,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
if (!(unwrappedElement instanceof JetNamedFunction)) continue;
|
||||
|
||||
JetNamedFunction function = (JetNamedFunction) unwrappedElement;
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolvePackage.resolveToDescriptor(function);
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) ResolutionUtils.resolveToDescriptor(function);
|
||||
|
||||
result.add(new DeferredJavaMethodOverrideOrSAMUsage(function, functionDescriptor, null));
|
||||
|
||||
@@ -603,13 +604,13 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
JetChangeInfo changeInfo = (JetChangeInfo) info;
|
||||
PsiElement function = info.getMethod();
|
||||
PsiElement element = function != null ? function : changeInfo.getContext();
|
||||
BindingContext bindingContext = ResolvePackage.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
CallableDescriptor oldDescriptor = ChangeSignaturePackage.getOriginalBaseFunctionDescriptor(changeInfo);
|
||||
DeclarationDescriptor containingDeclaration = oldDescriptor.getContainingDeclaration();
|
||||
|
||||
JetScope parametersScope = null;
|
||||
if (oldDescriptor instanceof ConstructorDescriptor && containingDeclaration instanceof ClassDescriptorWithResolutionScopes)
|
||||
parametersScope = UtilsPackage.asJetScope(((ClassDescriptorWithResolutionScopes) containingDeclaration).getScopeForInitializerResolution());
|
||||
parametersScope = ScopeUtilsKt.asJetScope(((ClassDescriptorWithResolutionScopes) containingDeclaration).getScopeForInitializerResolution());
|
||||
else if (function instanceof JetFunction)
|
||||
parametersScope = org.jetbrains.kotlin.idea.refactoring.RefactoringPackage.getBodyScope((JetFunction) function, bindingContext);
|
||||
|
||||
@@ -619,8 +620,8 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
if (!kind.getIsConstructor() && callableScope != null && !info.getNewName().isEmpty()) {
|
||||
Name newName = Name.identifier(info.getNewName());
|
||||
Collection<? extends CallableDescriptor> conflicts = oldDescriptor instanceof FunctionDescriptor
|
||||
? UtilPackage.getAllAccessibleFunctions(callableScope, newName)
|
||||
: UtilPackage.getAllAccessibleVariables(callableScope, newName);
|
||||
? ScopeUtils.getAllAccessibleFunctions(callableScope, newName)
|
||||
: ScopeUtils.getAllAccessibleVariables(callableScope, newName);
|
||||
for (CallableDescriptor conflict : conflicts) {
|
||||
if (conflict == oldDescriptor) continue;
|
||||
|
||||
@@ -643,7 +644,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
}
|
||||
if (parametersScope != null) {
|
||||
if (kind == JetMethodDescriptor.Kind.PRIMARY_CONSTRUCTOR && valOrVar != JetValVar.None) {
|
||||
for (VariableDescriptor property : UtilPackage.getVariablesFromImplicitReceivers(parametersScope, Name.identifier(parameterName))) {
|
||||
for (VariableDescriptor property : ScopeUtils.getVariablesFromImplicitReceivers(parametersScope, Name.identifier(parameterName))) {
|
||||
PsiElement propertyDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(property);
|
||||
|
||||
if (propertyDeclaration != null && !(propertyDeclaration.getParent() instanceof JetParameterList)) {
|
||||
@@ -675,7 +676,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
if (!(usageInfo instanceof KotlinCallerUsage)) continue;
|
||||
|
||||
JetNamedDeclaration caller = (JetNamedDeclaration) usageInfo.getElement();
|
||||
DeclarationDescriptor callerDescriptor = ResolvePackage.resolveToDescriptor(caller);
|
||||
DeclarationDescriptor callerDescriptor = ResolutionUtils.resolveToDescriptor(caller);
|
||||
|
||||
findParameterDuplicationInCaller(result, changeInfo, caller, callerDescriptor);
|
||||
}
|
||||
@@ -729,7 +730,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
if (usageInfo.getElement() instanceof KDocName) continue; // TODO support converting parameter to receiver in KDoc
|
||||
|
||||
JetExpression originalExpr = (JetExpression) usageInfo.getElement();
|
||||
JetScope scope = ResolvePackage.analyze(originalExpr, BodyResolveMode.FULL)
|
||||
JetScope scope = ResolutionUtils.analyze(originalExpr, BodyResolveMode.FULL)
|
||||
.get(BindingContext.RESOLUTION_SCOPE, originalExpr);
|
||||
if (scope == null) continue;
|
||||
|
||||
@@ -808,7 +809,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
JetTypeReference receiverTypeRef = psiFactory.createType(newReceiverInfo.getCurrentTypeText());
|
||||
TypeRefHelpersPackage.setReceiverTypeReference(functionWithReceiver, receiverTypeRef);
|
||||
//noinspection ConstantConditions
|
||||
BindingContext newContext = ResolvePackage.analyze(functionWithReceiver.getBodyExpression(), BodyResolveMode.FULL);
|
||||
BindingContext newContext = ResolutionUtils.analyze(functionWithReceiver.getBodyExpression(), BodyResolveMode.FULL);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
int originalOffset = ((JetNamedFunction) callable).getBodyExpression().getTextOffset();
|
||||
@@ -1001,7 +1002,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
||||
OriginalJavaMethodDescriptorWrapper descriptorWrapper = getOriginalJavaMethodDescriptorWrapper(usages);
|
||||
if (descriptorWrapper == null || descriptorWrapper.originalJavaMethodDescriptor != null) return true;
|
||||
|
||||
FunctionDescriptor methodDescriptor = ResolvePackage.getJavaMethodDescriptor((PsiMethod) method);
|
||||
FunctionDescriptor methodDescriptor = JavaResolutionUtils.getJavaMethodDescriptor((PsiMethod) method);
|
||||
assert methodDescriptor != null;
|
||||
descriptorWrapper.originalJavaMethodDescriptor =
|
||||
new JetChangeSignatureData(methodDescriptor, method, Collections.singletonList(methodDescriptor));
|
||||
|
||||
+8
-8
@@ -30,7 +30,8 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.shorten.ShortenPackage;
|
||||
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ChangeSignaturePackage;
|
||||
@@ -48,8 +49,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
import org.jetbrains.kotlin.types.TypesPackage;
|
||||
import org.jetbrains.kotlin.types.substitutions.SubstitutionsPackage;
|
||||
import org.jetbrains.kotlin.types.substitutions.SubstitutionUtilsKt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class JetCallableDefinitionUsage<T extends PsiElement> extends JetUsageIn
|
||||
if (!(parent instanceof JetFunctionLiteralExpression)) return false;
|
||||
|
||||
JetFunctionLiteralExpression expression = (JetFunctionLiteralExpression) parent;
|
||||
return ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL).get(BindingContext.EXPECTED_EXPRESSION_TYPE, expression) != null;
|
||||
return ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL).get(BindingContext.EXPECTED_EXPRESSION_TYPE, expression) != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -126,7 +126,7 @@ public class JetCallableDefinitionUsage<T extends PsiElement> extends JetUsageIn
|
||||
|
||||
if (!(classDescriptor instanceof ClassDescriptor)) return null;
|
||||
|
||||
typeSubstitutor = SubstitutionsPackage.getTypeSubstitutor(
|
||||
typeSubstitutor = SubstitutionUtilsKt.getTypeSubstitutor(
|
||||
((ClassDescriptor) classDescriptor).getDefaultType(),
|
||||
samCallType
|
||||
);
|
||||
@@ -154,13 +154,13 @@ public class JetCallableDefinitionUsage<T extends PsiElement> extends JetUsageIn
|
||||
PsiElement element = getDeclaration();
|
||||
|
||||
if (element instanceof JetFunction || element instanceof JetProperty || element instanceof JetParameter) {
|
||||
currentCallableDescriptor = (CallableDescriptor) ResolvePackage.resolveToDescriptor((JetDeclaration) element);
|
||||
currentCallableDescriptor = (CallableDescriptor) ResolutionUtils.resolveToDescriptor((JetDeclaration) element);
|
||||
}
|
||||
else if (element instanceof JetClass) {
|
||||
currentCallableDescriptor = ((ClassDescriptor) ResolvePackage.resolveToDescriptor((JetClass) element)).getUnsubstitutedPrimaryConstructor();
|
||||
currentCallableDescriptor = ((ClassDescriptor) ResolutionUtils.resolveToDescriptor((JetClass) element)).getUnsubstitutedPrimaryConstructor();
|
||||
}
|
||||
else if (element instanceof PsiMethod) {
|
||||
currentCallableDescriptor = ResolvePackage.getJavaMethodDescriptor((PsiMethod) element);
|
||||
currentCallableDescriptor = JavaResolutionUtils.getJavaMethodDescriptor((PsiMethod) element);
|
||||
}
|
||||
}
|
||||
return currentCallableDescriptor;
|
||||
|
||||
+2
-4
@@ -30,9 +30,8 @@ import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.PropertyCodegen;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.shorten.ShortenPackage;
|
||||
import org.jetbrains.kotlin.idea.core.CorePackage;
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ChangeSignaturePackage;
|
||||
@@ -43,7 +42,6 @@ import org.jetbrains.kotlin.idea.refactoring.introduce.introduceVariable.KotlinI
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
|
||||
@@ -86,7 +84,7 @@ public class JetFunctionCallUsage extends JetUsageInfo<JetCallElement> {
|
||||
public JetFunctionCallUsage(@NotNull JetCallElement element, JetCallableDefinitionUsage callee) {
|
||||
super(element);
|
||||
this.callee = callee;
|
||||
this.context = ResolvePackage.analyze(element, BodyResolveMode.FULL);
|
||||
this.context = ResolutionUtils.analyze(element, BodyResolveMode.FULL);
|
||||
this.resolvedCall = CallUtilPackage.getResolvedCall(element, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.idea.JetLanguage;
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
@@ -251,7 +251,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
BindingContext context = ResolvePackage.analyze(initializer, BodyResolveMode.FULL);
|
||||
BindingContext context = ResolutionUtils.analyze(initializer, BodyResolveMode.FULL);
|
||||
SimpleFunctionDescriptor fun = context.get(BindingContext.FUNCTION, functionLiteralExpression.getFunctionLiteral());
|
||||
if (fun == null || ErrorUtils.containsErrorType(fun)) {
|
||||
return null;
|
||||
@@ -281,7 +281,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
JetFile containingFile = inlinedExpressions.get(0).getContainingJetFile();
|
||||
List<JetFunctionLiteralExpression> functionsToAddParameters = Lists.newArrayList();
|
||||
|
||||
ResolutionFacade resolutionFacade = ResolvePackage.getResolutionFacade(containingFile);
|
||||
ResolutionFacade resolutionFacade = ResolutionUtils.getResolutionFacade(containingFile);
|
||||
for (JetExpression inlinedExpression : inlinedExpressions) {
|
||||
JetFunctionLiteralExpression functionLiteralExpression = getFunctionLiteralExpression(inlinedExpression);
|
||||
assert functionLiteralExpression != null : "can't find function literal expression for " + inlinedExpression.getText();
|
||||
@@ -342,7 +342,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
JetFile containingFile = inlinedExpressions.get(0).getContainingJetFile();
|
||||
List<JetCallExpression> callsToAddArguments = Lists.newArrayList();
|
||||
|
||||
ResolutionFacade resolutionFacade = ResolvePackage.getResolutionFacade(containingFile);
|
||||
ResolutionFacade resolutionFacade = ResolutionUtils.getResolutionFacade(containingFile);
|
||||
for (JetExpression inlinedExpression : inlinedExpressions) {
|
||||
BindingContext context = resolutionFacade.analyze(inlinedExpression, BodyResolveMode.FULL);
|
||||
Call call = CallUtilPackage.getCallWithAssert(inlinedExpression, context);
|
||||
@@ -363,7 +363,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
|
||||
@Nullable
|
||||
private static String getTypeArgumentsStringForCall(@NotNull JetExpression initializer) {
|
||||
BindingContext context = ResolvePackage.analyze(initializer, BodyResolveMode.FULL);
|
||||
BindingContext context = ResolutionUtils.analyze(initializer, BodyResolveMode.FULL);
|
||||
ResolvedCall<?> call = CallUtilPackage.getResolvedCall(initializer, context);
|
||||
if (call == null) return null;
|
||||
|
||||
|
||||
+3
-3
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
import org.jetbrains.kotlin.idea.analysis.AnalysisPackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
||||
import org.jetbrains.kotlin.idea.core.CorePackage;
|
||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester;
|
||||
@@ -137,7 +137,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
AnalysisResult analysisResult = ResolvePackage.analyzeAndGetResult(expression);
|
||||
AnalysisResult analysisResult = ResolutionUtils.analyzeAndGetResult(expression);
|
||||
final BindingContext bindingContext = analysisResult.getBindingContext();
|
||||
final JetType expressionType = bindingContext.getType(expression); //can be null or error type
|
||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, expression);
|
||||
@@ -208,7 +208,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
|
||||
NewDeclarationNameValidator.Target.VARIABLES
|
||||
);
|
||||
final Collection<String> suggestedNames = KotlinNameSuggester.INSTANCE$.suggestNamesByExpressionAndType(
|
||||
expression, ResolvePackage.analyze(expression, BodyResolveMode.PARTIAL), validator, "value");
|
||||
expression, ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL), validator, "value");
|
||||
final Ref<JetProperty> propertyRef = new Ref<JetProperty>();
|
||||
final ArrayList<JetExpression> references = new ArrayList<JetExpression>();
|
||||
final Ref<JetExpression> reference = new Ref<JetExpression>();
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetBundle;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil;
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||
import org.jetbrains.kotlin.psi.JetElement;
|
||||
@@ -94,7 +94,7 @@ class KotlinOverridingDialog extends DialogWrapper {
|
||||
private static String formatElement(PsiElement element) {
|
||||
element = JetPsiUtil.ascendIfPropertyAccessor(element);
|
||||
if (element instanceof JetNamedFunction || element instanceof JetProperty) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze((JetElement) element, BodyResolveMode.FULL);
|
||||
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
|
||||
if (declarationDescriptor instanceof CallableMemberDescriptor) {
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForExplicitDeclaration;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightMethod;
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetDeclaration;
|
||||
@@ -325,7 +325,7 @@ public class JetRunConfiguration extends ModuleBasedConfiguration<RunConfigurati
|
||||
@Nullable
|
||||
private static JetNamedFunction findMainFun(@NotNull PsiClass psiClass) {
|
||||
for (JetNamedFunction function : getMainFunCandidates(psiClass)) {
|
||||
BindingContext bindingContext = ResolvePackage.analyze(function, BodyResolveMode.FULL);
|
||||
BindingContext bindingContext = ResolutionUtils.analyze(function, BodyResolveMode.FULL);
|
||||
MainFunctionDetector mainFunctionDetector = new MainFunctionDetector(bindingContext);
|
||||
if (mainFunctionDetector.isMain(function)) return function;
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,14 +27,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources;
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.test.util.UtilPackage;
|
||||
import org.jetbrains.kotlin.test.util.JetTestUtilsKt;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractJetQuickDocProviderTest extends JetLightCodeInsightFixtureTestCase {
|
||||
public void doTest(@NotNull String path) throws Exception {
|
||||
UtilPackage.configureWithExtraFile(myFixture, path, "_Data");
|
||||
JetTestUtilsKt.configureWithExtraFile(myFixture, path, "_Data");
|
||||
|
||||
PsiElement element = myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset());
|
||||
assertNotNull("Can't find element at caret in file: " + path, element);
|
||||
|
||||
@@ -22,7 +22,7 @@ import kotlin.jvm.functions.Function0;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||
import org.jetbrains.kotlin.idea.test.AstAccessControl;
|
||||
import org.jetbrains.kotlin.idea.test.JetWithJdkAndRuntimeLightProjectDescriptor;
|
||||
import org.jetbrains.kotlin.idea.test.KotlinCodeInsightTestCase;
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractResolveByStubTest extends KotlinCodeInsightTestCas
|
||||
|
||||
private void performTest(@NotNull String path, boolean checkPrimaryConstructors, boolean checkPropertyAccessors) {
|
||||
JetFile file = (JetFile) getFile();
|
||||
ModuleDescriptor module = ResolvePackage.findModuleDescriptor(file);
|
||||
ModuleDescriptor module = ResolutionUtils.findModuleDescriptor(file);
|
||||
PackageViewDescriptor packageViewDescriptor = module.getPackage(new FqName("test"));
|
||||
Assert.assertFalse(packageViewDescriptor.isEmpty());
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.google.dart.compiler.backend.js.ast.AstPackage.JsObjectScope;
|
||||
import static com.google.dart.compiler.backend.js.ast.JsScopesKt.JsObjectScope;
|
||||
|
||||
/**
|
||||
* A scope is a factory for creating and allocating
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:JvmName("MetadataProperties")
|
||||
|
||||
package com.google.dart.compiler.backend.js.ast.metadata
|
||||
|
||||
@@ -39,4 +40,4 @@ public var JsInvocation.typeCheck: TypeCheck? by MetadataProperty(default = null
|
||||
public enum class TypeCheck {
|
||||
TYPEOF,
|
||||
INSTANCEOF
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.js.inline;
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataPackage;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataProperties;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -231,14 +231,14 @@ public class JsInliner extends JsVisitorWithContextImpl {
|
||||
}
|
||||
|
||||
private void reportInlineCycle(@NotNull JsInvocation call, @NotNull JsFunction calledFunction) {
|
||||
MetadataPackage.setInlineStrategy(call, InlineStrategy.NOT_INLINE);
|
||||
MetadataProperties.setInlineStrategy(call, InlineStrategy.NOT_INLINE);
|
||||
Iterator<JsCallInfo> it = inlineCallInfos.descendingIterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
JsCallInfo callInfo = it.next();
|
||||
PsiElement psiElement = MetadataPackage.getPsiElement(callInfo.call);
|
||||
PsiElement psiElement = MetadataProperties.getPsiElement(callInfo.call);
|
||||
|
||||
CallableDescriptor descriptor = MetadataPackage.getDescriptor(callInfo.call);
|
||||
CallableDescriptor descriptor = MetadataProperties.getDescriptor(callInfo.call);
|
||||
if (psiElement != null && descriptor != null) {
|
||||
trace.report(Errors.INLINE_CALL_CYCLE.on(psiElement, descriptor));
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class JsInliner extends JsVisitorWithContextImpl {
|
||||
}
|
||||
|
||||
public boolean hasToBeInlined(@NotNull JsInvocation call) {
|
||||
InlineStrategy strategy = MetadataPackage.getInlineStrategy(call);
|
||||
InlineStrategy strategy = MetadataProperties.getInlineStrategy(call);
|
||||
if (strategy == null || !strategy.isInline()) return false;
|
||||
|
||||
return getFunctionContext().hasFunctionDefinition(call);
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.js.inline.util.UtilPackage.collectNamedFunctions;
|
||||
import static org.jetbrains.kotlin.js.inline.util.UtilPackage.collectJsProperties;
|
||||
import static org.jetbrains.kotlin.js.inline.util.CollectUtilsKt.collectNamedFunctions;
|
||||
import static org.jetbrains.kotlin.js.inline.util.CollectUtilsKt.collectJsProperties;
|
||||
|
||||
public class AstSearchUtil {
|
||||
@NotNull
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.js.translate.expression.InlineMetadata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.js.inline.util.UtilPackage.collectInstances;
|
||||
import static org.jetbrains.kotlin.js.inline.util.CollectUtilsKt.collectInstances;
|
||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.findLinesWithPrefixesRemoved;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.DiagnosticUtils.hasError;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.UtilsPackage.expandIsCalls;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.ExpandIsCallsKt.expandIsCalls;
|
||||
|
||||
/**
|
||||
* An entry point of translator.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.js.translate.context;
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataPackage;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataProperties;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.TypeCheck;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.google.dart.compiler.backend.js.ast.AstPackage.JsObjectScope;
|
||||
import static com.google.dart.compiler.backend.js.ast.JsScopesKt.JsObjectScope;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.JsDescriptorUtils.getModuleName;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.ManglingUtils.getStableMangledNameForDescriptor;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.ManglingUtils.getSuggestedName;
|
||||
@@ -396,14 +396,14 @@ public final class Namer {
|
||||
@NotNull
|
||||
public JsExpression isTypeOf(@NotNull JsExpression type) {
|
||||
JsInvocation invocation = new JsInvocation(kotlin("isTypeOf"), type);
|
||||
MetadataPackage.setTypeCheck(invocation, TypeCheck.TYPEOF);
|
||||
MetadataProperties.setTypeCheck(invocation, TypeCheck.TYPEOF);
|
||||
return invocation;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JsExpression isInstanceOf(@NotNull JsExpression type) {
|
||||
JsInvocation invocation = new JsInvocation(kotlin("isInstanceOf"), type);
|
||||
MetadataPackage.setTypeCheck(invocation, TypeCheck.INSTANCEOF);
|
||||
MetadataProperties.setTypeCheck(invocation, TypeCheck.INSTANCEOF);
|
||||
return invocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.name.Name;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.dart.compiler.backend.js.ast.AstPackage.JsObjectScope;
|
||||
import static com.google.dart.compiler.backend.js.ast.JsScopesKt.JsObjectScope;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.TasksPackage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,6 +43,7 @@ import static org.jetbrains.kotlin.js.translate.utils.JsDescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.ManglingUtils.getMangledName;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.ManglingUtils.getSuggestedName;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isExtension;
|
||||
import static org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallsKt.isDynamic;
|
||||
|
||||
/**
|
||||
* Aggregates all the static parts of the context.
|
||||
@@ -237,7 +237,7 @@ public final class StaticContext {
|
||||
@Override
|
||||
@Nullable
|
||||
public JsName apply(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (TasksPackage.isDynamic(descriptor)) {
|
||||
if (isDynamic(descriptor)) {
|
||||
String name = descriptor.getName().asString();
|
||||
return JsDynamicScope.INSTANCE$.declareName(name);
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.js.translate.context.ContextPackage.getNameForCapturedDescriptor;
|
||||
import static org.jetbrains.kotlin.js.translate.context.UsageTrackerKt.getNameForCapturedDescriptor;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.BindingUtils.getDescriptorForElement;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.Modality;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.js.translate.context.TranslationContext;
|
||||
import org.jetbrains.kotlin.js.translate.declaration.propertyTranslator.PropertyTranslatorPackage;
|
||||
import org.jetbrains.kotlin.js.translate.declaration.propertyTranslator.PropertyTranslatorKt;
|
||||
import org.jetbrains.kotlin.js.translate.general.Translation;
|
||||
import org.jetbrains.kotlin.js.translate.general.TranslatorVisitor;
|
||||
import org.jetbrains.kotlin.js.translate.initializer.ClassInitializerTranslator;
|
||||
@@ -117,7 +117,7 @@ public class DeclarationBodyVisitor extends TranslatorVisitor<Void> {
|
||||
@Override
|
||||
public Void visitProperty(@NotNull JetProperty expression, TranslationContext context) {
|
||||
PropertyDescriptor propertyDescriptor = BindingUtils.getPropertyDescriptor(context.bindingContext(), expression);
|
||||
PropertyTranslatorPackage.translateAccessors(propertyDescriptor, expression, result, context);
|
||||
PropertyTranslatorKt.translateAccessors(propertyDescriptor, expression, result, context);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -17,7 +17,8 @@
|
||||
package org.jetbrains.kotlin.js.translate.expression;
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataPackage;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataProperties;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataProperty;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -27,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.kotlin.js.translate.context.Namer;
|
||||
import org.jetbrains.kotlin.js.translate.context.TranslationContext;
|
||||
import org.jetbrains.kotlin.js.translate.declaration.ClassTranslator;
|
||||
import org.jetbrains.kotlin.js.translate.expression.loopTranslator.LoopTranslatorPackage;
|
||||
import org.jetbrains.kotlin.js.translate.expression.loopTranslator.LoopTranslator;
|
||||
import org.jetbrains.kotlin.js.translate.general.Translation;
|
||||
import org.jetbrains.kotlin.js.translate.general.TranslatorVisitor;
|
||||
import org.jetbrains.kotlin.js.translate.operation.BinaryOperationTranslator;
|
||||
@@ -244,13 +245,13 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
||||
@Override
|
||||
@NotNull
|
||||
public JsNode visitWhileExpression(@NotNull JetWhileExpression expression, @NotNull TranslationContext context) {
|
||||
return LoopTranslatorPackage.createWhile(false, expression, context);
|
||||
return LoopTranslator.createWhile(false, expression, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JsNode visitDoWhileExpression(@NotNull JetDoWhileExpression expression, @NotNull TranslationContext context) {
|
||||
return LoopTranslatorPackage.createWhile(true, expression, context);
|
||||
return LoopTranslator.createWhile(true, expression, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -421,7 +422,7 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
||||
FunctionDescriptor descriptor = getFunctionDescriptor(context.bindingContext(), expression);
|
||||
JsName name = context.getNameForDescriptor(descriptor);
|
||||
if (InlineUtil.isInline(descriptor)) {
|
||||
MetadataPackage.setStaticRef(name, alias);
|
||||
MetadataProperties.setStaticRef(name, alias);
|
||||
}
|
||||
|
||||
boolean isExpression = BindingContextUtilPackage.isUsedAsExpression(expression, context.bindingContext());
|
||||
@@ -459,7 +460,7 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
||||
@NotNull
|
||||
public JsNode visitForExpression(@NotNull JetForExpression expression,
|
||||
@NotNull TranslationContext context) {
|
||||
return LoopTranslatorPackage.translateForExpression(expression, context).source(expression);
|
||||
return LoopTranslator.translateForExpression(expression, context).source(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.js.translate.expression;
|
||||
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataPackage;
|
||||
import com.google.dart.compiler.backend.js.ast.metadata.MetadataProperties;
|
||||
import com.intellij.util.SmartList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -149,7 +149,7 @@ public final class FunctionTranslator extends AbstractTranslator {
|
||||
public static void addParameters(List<JsParameter> list, FunctionDescriptor descriptor, TranslationContext context) {
|
||||
for (ValueParameterDescriptor valueParameter : descriptor.getValueParameters()) {
|
||||
JsParameter jsParameter = new JsParameter(context.getNameForDescriptor(valueParameter));
|
||||
MetadataPackage.setHasDefaultValue(jsParameter, DescriptorUtilPackage.hasDefaultValue(valueParameter));
|
||||
MetadataProperties.setHasDefaultValue(jsParameter, DescriptorUtilPackage.hasDefaultValue(valueParameter));
|
||||
list.add(jsParameter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("LoopTranslator")
|
||||
|
||||
package org.jetbrains.kotlin.js.translate.expression.loopTranslator
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.js.translate.utils.UtilsPackage.setInlineCallMetadata;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.InlineUtils.setInlineCallMetadata;
|
||||
|
||||
public class MultiDeclarationTranslator extends AbstractTranslator {
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.js.resolve.diagnostics.JsCallChecker.isJsCall;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.PsiUtils.getFunctionDescriptor;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.UtilsPackage.setInlineCallMetadata;
|
||||
import static org.jetbrains.kotlin.js.translate.utils.InlineUtils.setInlineCallMetadata;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getFunctionResolvedCallWithAssert;
|
||||
import static org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator.getConstant;
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("InlineUtils")
|
||||
|
||||
package org.jetbrains.kotlin.js.translate.utils
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*
|
||||
|
||||
Reference in New Issue
Block a user