Rename: analyzeWithDeclarations --> analyzeWithContent()
This commit is contained in:
+2
-2
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.idea.core.CollectingNameValidator
|
||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
|
||||
@@ -98,7 +98,7 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase<Kot
|
||||
override fun prepareMembersInfo(klass: KtClassOrObject, project: Project, editor: Editor?): Info? {
|
||||
if (klass !is KtClass) throw AssertionError("Not a class: ${klass.getElementTextWithContext()}")
|
||||
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
val classDescriptor = context.get(BindingContext.CLASS, klass) ?: return null
|
||||
|
||||
val equalsDescriptor = classDescriptor.findDeclaredEquals(false)
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.idea.core.CollectingNameValidator
|
||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
|
||||
@@ -104,7 +104,7 @@ class KotlinGenerateSecondaryConstructorAction : KotlinGenerateMemberActionBase<
|
||||
}
|
||||
|
||||
override fun prepareMembersInfo(klass: KtClassOrObject, project: Project, editor: Editor?): Info? {
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
val classDescriptor = context.get(BindingContext.CLASS, klass) ?: return null
|
||||
val superConstructors = chooseSuperConstructors(klass, classDescriptor).map { it.descriptor as ConstructorDescriptor }
|
||||
val propertiesToInitialize = choosePropertiesToInitialize(klass, context).map { it.descriptor as PropertyDescriptor }
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.idea.core.insertMembersAfter
|
||||
@@ -132,7 +132,7 @@ class KotlinGenerateToStringAction : KotlinGenerateMemberActionBase<KotlinGenera
|
||||
override fun prepareMembersInfo(klass: KtClassOrObject, project: Project, editor: Editor?): Info? {
|
||||
if (klass !is KtClass) throw AssertionError("Not a class: ${klass.getElementTextWithContext()}")
|
||||
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
val classDescriptor = context.get(BindingContext.CLASS, klass) ?: return null
|
||||
|
||||
classDescriptor.findDeclaredToString(false)?.let {
|
||||
|
||||
@@ -32,7 +32,7 @@ class CopyAsDiagnosticTestAction : AnAction() {
|
||||
val psiFile = e.getData(CommonDataKeys.PSI_FILE)
|
||||
assert(editor != null && psiFile != null)
|
||||
|
||||
val bindingContext = (psiFile as KtFile).analyzeWithDeclarations()
|
||||
val bindingContext = (psiFile as KtFile).analyzeWithContent()
|
||||
|
||||
val diagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(
|
||||
bindingContext, psiFile, false, null, null, false
|
||||
|
||||
@@ -44,7 +44,7 @@ class PlainTextPasteImportResolver(val dataForConversion: DataForConversion, val
|
||||
private val importList = file.importList!!
|
||||
private val psiElementFactory = PsiElementFactory.SERVICE.getInstance(project)
|
||||
|
||||
private val bindingContext by lazy { targetFile.analyzeWithDeclarations() }
|
||||
private val bindingContext by lazy { targetFile.analyzeWithContent() }
|
||||
private val resolutionFacade = targetFile.getResolutionFacade()
|
||||
|
||||
private val shortNameCache = PsiShortNamesCache.getInstance(project)
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.addModifier
|
||||
@@ -50,7 +50,7 @@ class AddVarianceModifierInspection : AbstractKotlinInspection() {
|
||||
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
|
||||
return classOrObjectVisitor { klass ->
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
for (typeParameter in klass.typeParameters) {
|
||||
if (typeParameter.variance != Variance.INVARIANT) continue
|
||||
val parameterDescriptor =
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.intentions
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||
import org.jetbrains.kotlin.idea.util.CommentSaver
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
@@ -59,7 +59,7 @@ class ConvertSecondaryConstructorToPrimaryIntention : SelfTargetingRangeIntentio
|
||||
val klass = element.containingClassOrObject ?: return null
|
||||
if (klass.hasPrimaryConstructor()) return null
|
||||
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
val classDescriptor = context[BindingContext.CLASS, klass] ?: return null
|
||||
val elementDescriptor = context[BindingContext.CONSTRUCTOR, element] ?: return null
|
||||
|
||||
@@ -154,7 +154,7 @@ class ConvertSecondaryConstructorToPrimaryIntention : SelfTargetingRangeIntentio
|
||||
|
||||
override fun applyTo(element: KtSecondaryConstructor, editor: Editor?) {
|
||||
val klass = element.containingClassOrObject as? KtClass ?: return
|
||||
val context = klass.analyzeWithDeclarations()
|
||||
val context = klass.analyzeWithContent()
|
||||
val factory = KtPsiFactory(klass)
|
||||
val constructorCommentSaver = CommentSaver(element)
|
||||
val constructorInClass = klass.createPrimaryConstructorIfAbsent()
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||
@@ -61,7 +61,7 @@ class MapPlatformClassToKotlinFix(
|
||||
override fun getFamilyName() = "Change to Kotlin class"
|
||||
|
||||
public override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||
val bindingContext = file.analyzeWithDeclarations()
|
||||
val bindingContext = file.analyzeWithContent()
|
||||
|
||||
val imports = ArrayList<KtImportDirective>()
|
||||
val usages = ArrayList<KtUserType>()
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil
|
||||
import org.jetbrains.kotlin.idea.util.approximateWithResolvableType
|
||||
@@ -51,7 +51,7 @@ class QuickFixFactoryForTypeMismatchError : KotlinIntentionActionsFactory() {
|
||||
override fun doCreateActions(diagnostic: Diagnostic): List<IntentionAction> {
|
||||
val actions = LinkedList<IntentionAction>()
|
||||
|
||||
val context = (diagnostic.psiFile as KtFile).analyzeWithDeclarations()
|
||||
val context = (diagnostic.psiFile as KtFile).analyzeWithContent()
|
||||
|
||||
val diagnosticElement = diagnostic.psiElement
|
||||
if (diagnosticElement !is KtExpression) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithDeclarations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.core.overrideImplement.OverrideMemberChooserObject
|
||||
import org.jetbrains.kotlin.idea.core.overrideImplement.generateMember
|
||||
@@ -44,7 +44,7 @@ class SpecifyOverrideExplicitlyFix(
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||
val element = element ?: return
|
||||
val context = element.analyzeWithDeclarations()
|
||||
val context = element.analyzeWithContent()
|
||||
val delegatedDescriptor = context.diagnostics.forElement(element).mapNotNull {
|
||||
if (it.factory == Errors.DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE)
|
||||
Errors.DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE.cast(it).a
|
||||
|
||||
Reference in New Issue
Block a user