Rename: resolveToElement() -> analyze
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ public class KotlinCacheService(val project: Project) {
|
|||||||
public fun getResolutionFacade(elements: List<JetElement>): ResolutionFacade {
|
public fun getResolutionFacade(elements: List<JetElement>): ResolutionFacade {
|
||||||
val cache = getCacheToAnalyzeFiles(elements.map { it.getContainingJetFile() })
|
val cache = getCacheToAnalyzeFiles(elements.map { it.getContainingJetFile() })
|
||||||
return object : ResolutionFacade {
|
return object : ResolutionFacade {
|
||||||
override fun resolveToElement(element: JetElement): BindingContext {
|
override fun analyze(element: JetElement): BindingContext {
|
||||||
return cache.getLazyResolveSession(element).resolveToElement(element)
|
return cache.getLazyResolveSession(element).resolveToElement(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.psi.JetDeclaration
|
|||||||
|
|
||||||
public trait ResolutionFacade {
|
public trait ResolutionFacade {
|
||||||
|
|
||||||
public fun resolveToElement(element: JetElement): BindingContext
|
public fun analyze(element: JetElement): BindingContext
|
||||||
|
|
||||||
public fun resolveToDescriptor(declaration: JetDeclaration): DeclarationDescriptor
|
public fun resolveToDescriptor(declaration: JetDeclaration): DeclarationDescriptor
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public fun JetDeclaration.resolveToDescriptor(): DeclarationDescriptor {
|
|||||||
return getLazyResolveSession().resolveToDescriptor(this)
|
return getLazyResolveSession().resolveToDescriptor(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun JetElement.resolveToElement(): BindingContext {
|
public fun JetElement.analyze(): BindingContext {
|
||||||
return getLazyResolveSession().resolveToElement(this)
|
return getLazyResolveSession().analyze(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun JetElement.getModuleDescriptorForElement(): ModuleDescriptor {
|
public fun JetElement.getModuleDescriptorForElement(): ModuleDescriptor {
|
||||||
|
|||||||
+4
-4
@@ -71,27 +71,27 @@ object JetFileReferencesResolver {
|
|||||||
if (resolveShortNames || userType.getQualifier() != null) {
|
if (resolveShortNames || userType.getQualifier() != null) {
|
||||||
val referenceExpression = userType.getReferenceExpression()
|
val referenceExpression = userType.getReferenceExpression()
|
||||||
if (referenceExpression != null) {
|
if (referenceExpression != null) {
|
||||||
resolveMap[referenceExpression] = resolveSession.resolveToElement(referenceExpression)
|
resolveMap[referenceExpression] = resolveSession.analyze(referenceExpression)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitQualifiedExpression(expression: JetQualifiedExpression) {
|
override fun visitQualifiedExpression(expression: JetQualifiedExpression) {
|
||||||
val receiverExpression = expression.getReceiverExpression()
|
val receiverExpression = expression.getReceiverExpression()
|
||||||
if (resolveQualifiers || resolveSession.resolveToElement(expression)[BindingContext.QUALIFIER, receiverExpression] == null) {
|
if (resolveQualifiers || resolveSession.analyze(expression)[BindingContext.QUALIFIER, receiverExpression] == null) {
|
||||||
receiverExpression.accept(this)
|
receiverExpression.accept(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
val referenceExpression = expression.getSelectorExpression()?.referenceExpression()
|
val referenceExpression = expression.getSelectorExpression()?.referenceExpression()
|
||||||
if (referenceExpression != null) {
|
if (referenceExpression != null) {
|
||||||
resolveMap[referenceExpression] = resolveSession.resolveToElement(referenceExpression)
|
resolveMap[referenceExpression] = resolveSession.analyze(referenceExpression)
|
||||||
}
|
}
|
||||||
expression.getSelectorExpression()?.accept(this)
|
expression.getSelectorExpression()?.accept(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitSimpleNameExpression(expression: JetSimpleNameExpression) {
|
override fun visitSimpleNameExpression(expression: JetSimpleNameExpression) {
|
||||||
if (resolveShortNames) {
|
if (resolveShortNames) {
|
||||||
resolveMap[expression] = resolveSession.resolveToElement(expression)
|
resolveMap[expression] = resolveSession.analyze(expression)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public object ShortenReferences {
|
|||||||
protected val elementsToShorten: MutableSet<T> = LinkedHashSet()
|
protected val elementsToShorten: MutableSet<T> = LinkedHashSet()
|
||||||
|
|
||||||
protected fun bindingContext(element: JetElement): BindingContext
|
protected fun bindingContext(element: JetElement): BindingContext
|
||||||
= resolveMap[element] ?: resolveSession.resolveToElement(element)
|
= resolveMap[element] ?: resolveSession.analyze(element)
|
||||||
|
|
||||||
protected abstract fun getShortenedElement(element: T): JetElement?
|
protected abstract fun getShortenedElement(element: T): JetElement?
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ public object ShortenReferences {
|
|||||||
if (target == null) return false
|
if (target == null) return false
|
||||||
|
|
||||||
val typeReference = PsiTreeUtil.getParentOfType(userType, javaClass<JetTypeReference>())!!
|
val typeReference = PsiTreeUtil.getParentOfType(userType, javaClass<JetTypeReference>())!!
|
||||||
val scope = resolveSession.resolveToElement(typeReference)[BindingContext.TYPE_RESOLUTION_SCOPE, typeReference]!!
|
val scope = resolveSession.analyze(typeReference)[BindingContext.TYPE_RESOLUTION_SCOPE, typeReference]!!
|
||||||
val name = target.getName()
|
val name = target.getName()
|
||||||
val targetByName = scope.getClassifier(name)
|
val targetByName = scope.getClassifier(name)
|
||||||
if (targetByName == null) {
|
if (targetByName == null) {
|
||||||
|
|||||||
+1
-1
@@ -28,6 +28,6 @@ public final class AnalyzerFacadeWithCache {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static BindingContext getContextForElement(@NotNull JetElement jetElement) {
|
public static BindingContext getContextForElement(@NotNull JetElement jetElement) {
|
||||||
return ResolvePackage.resolveToElement(jetElement);
|
return ResolvePackage.analyze(jetElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class KotlinIndicesHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun getTopLevelCallablesByName(name: String, context: JetExpression /*TODO: to be dropped*/): Collection<CallableDescriptor> {
|
public fun getTopLevelCallablesByName(name: String, context: JetExpression /*TODO: to be dropped*/): Collection<CallableDescriptor> {
|
||||||
val jetScope = resolveSession.resolveToElement(context).get(BindingContext.RESOLUTION_SCOPE, context) ?: return listOf()
|
val jetScope = resolveSession.analyze(context).get(BindingContext.RESOLUTION_SCOPE, context) ?: return listOf()
|
||||||
|
|
||||||
val result = HashSet<CallableDescriptor>()
|
val result = HashSet<CallableDescriptor>()
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public class KotlinIndicesHelper(
|
|||||||
val sourceNames = JetTopLevelFunctionsFqnNameIndex.getInstance().getAllKeys(project).stream() + JetTopLevelPropertiesFqnNameIndex.getInstance().getAllKeys(project).stream()
|
val sourceNames = JetTopLevelFunctionsFqnNameIndex.getInstance().getAllKeys(project).stream() + JetTopLevelPropertiesFqnNameIndex.getInstance().getAllKeys(project).stream()
|
||||||
val allFqNames = sourceNames.map { FqName(it) } + JetFromJavaDescriptorHelper.getTopLevelCallableFqNames(project, scope, false).stream()
|
val allFqNames = sourceNames.map { FqName(it) } + JetFromJavaDescriptorHelper.getTopLevelCallableFqNames(project, scope, false).stream()
|
||||||
|
|
||||||
val jetScope = resolveSession.resolveToElement(context).get(BindingContext.RESOLUTION_SCOPE, context) ?: return listOf()
|
val jetScope = resolveSession.analyze(context).get(BindingContext.RESOLUTION_SCOPE, context) ?: return listOf()
|
||||||
|
|
||||||
return allFqNames.filter { nameFilter(it.shortName().asString()) }
|
return allFqNames.filter { nameFilter(it.shortName().asString()) }
|
||||||
.toSet()
|
.toSet()
|
||||||
@@ -135,7 +135,7 @@ public class KotlinIndicesHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun getCallableExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> {
|
public fun getCallableExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> {
|
||||||
val bindingContext = resolveSession.resolveToElement(expression)
|
val bindingContext = resolveSession.analyze(expression)
|
||||||
val dataFlowInfo = bindingContext.getDataFlowInfo(expression)
|
val dataFlowInfo = bindingContext.getDataFlowInfo(expression)
|
||||||
|
|
||||||
val functionsIndex = JetTopLevelFunctionsFqnNameIndex.getInstance()
|
val functionsIndex = JetTopLevelFunctionsFqnNameIndex.getInstance()
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ abstract class CompletionSessionBase(protected val configuration: CompletionSess
|
|||||||
private val file = position.getContainingFile() as JetFile
|
private val file = position.getContainingFile() as JetFile
|
||||||
protected val resolveSession: ResolutionFacade = file.getLazyResolveSession()
|
protected val resolveSession: ResolutionFacade = file.getLazyResolveSession()
|
||||||
protected val moduleDescriptor: ModuleDescriptor = resolveSession.getModuleDescriptorForElement(file)
|
protected val moduleDescriptor: ModuleDescriptor = resolveSession.getModuleDescriptorForElement(file)
|
||||||
protected val bindingContext: BindingContext? = jetReference?.let { resolveSession.resolveToElement(it.expression) }
|
protected val bindingContext: BindingContext? = jetReference?.let { resolveSession.analyze(it.expression) }
|
||||||
protected val inDescriptor: DeclarationDescriptor? = jetReference?.let { bindingContext!!.get(BindingContext.RESOLUTION_SCOPE, it.expression)?.getContainingDeclaration() }
|
protected val inDescriptor: DeclarationDescriptor? = jetReference?.let { bindingContext!!.get(BindingContext.RESOLUTION_SCOPE, it.expression)?.getContainingDeclaration() }
|
||||||
|
|
||||||
// set prefix matcher here to override default one which relies on CompletionUtil.findReferencePrefix()
|
// set prefix matcher here to override default one which relies on CompletionUtil.findReferencePrefix()
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ object PackageDirectiveCompletion {
|
|||||||
val result = result.withPrefixMatcher(prefixMatcher)
|
val result = result.withPrefixMatcher(prefixMatcher)
|
||||||
|
|
||||||
val resolveSession = ref.expression.getLazyResolveSession()
|
val resolveSession = ref.expression.getLazyResolveSession()
|
||||||
val bindingContext = resolveSession.resolveToElement(ref.expression)
|
val bindingContext = resolveSession.analyze(ref.expression)
|
||||||
|
|
||||||
val variants = ReferenceVariantsHelper(bindingContext, { true }).getPackageReferenceVariants(ref.expression, prefixMatcher.asNameFilter())
|
val variants = ReferenceVariantsHelper(bindingContext, { true }).getPackageReferenceVariants(ref.expression, prefixMatcher.asNameFilter())
|
||||||
for (variant in variants) {
|
for (variant in variants) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ private fun needExplicitParameterTypes(context: InsertionContext, placeholderRan
|
|||||||
if (expression == null) return false
|
if (expression == null) return false
|
||||||
|
|
||||||
val resolveSession = file.getLazyResolveSession()
|
val resolveSession = file.getLazyResolveSession()
|
||||||
val bindingContext = resolveSession.resolveToElement(expression)
|
val bindingContext = resolveSession.analyze(expression)
|
||||||
val expectedInfos = ExpectedInfos(bindingContext, resolveSession).calculate(expression) ?: return false
|
val expectedInfos = ExpectedInfos(bindingContext, resolveSession).calculate(expression) ?: return false
|
||||||
val functionTypes = expectedInfos.map { it.type }.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it) }.toSet()
|
val functionTypes = expectedInfos.map { it.type }.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it) }.toSet()
|
||||||
if (functionTypes.size <= 1) return false
|
if (functionTypes.size <= 1) return false
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
val visibilityFilter: (DeclarationDescriptor) -> Boolean,
|
val visibilityFilter: (DeclarationDescriptor) -> Boolean,
|
||||||
val originalFile: JetFile,
|
val originalFile: JetFile,
|
||||||
val boldImmediateLookupElementFactory: LookupElementFactory) {
|
val boldImmediateLookupElementFactory: LookupElementFactory) {
|
||||||
private val bindingContext = resolveSession.resolveToElement(expression)
|
private val bindingContext = resolveSession.analyze(expression)
|
||||||
private val project = expression.getProject()
|
private val project = expression.getProject()
|
||||||
|
|
||||||
public data class Result(val declarationFilter: ((DeclarationDescriptor) -> Collection<LookupElement>)?,
|
public data class Result(val declarationFilter: ((DeclarationDescriptor) -> Collection<LookupElement>)?,
|
||||||
@@ -185,7 +185,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
if (operationToken == JetTokens.EQ || operationToken == JetTokens.EQEQ || operationToken == JetTokens.EXCLEQ) {
|
if (operationToken == JetTokens.EQ || operationToken == JetTokens.EQEQ || operationToken == JetTokens.EXCLEQ) {
|
||||||
val left = parent.getLeft()
|
val left = parent.getLeft()
|
||||||
if (left is JetReferenceExpression) {
|
if (left is JetReferenceExpression) {
|
||||||
return resolveSession.resolveToElement(left)[BindingContext.REFERENCE_TARGET, left].toSet()
|
return resolveSession.analyze(left)[BindingContext.REFERENCE_TARGET, left].toSet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ public class JetPositionManager implements PositionManager {
|
|||||||
|
|
||||||
GenerationState state = new GenerationState(file.getProject(), ClassBuilderFactories.THROW_EXCEPTION,
|
GenerationState state = new GenerationState(file.getProject(), ClassBuilderFactories.THROW_EXCEPTION,
|
||||||
resolveSession.getModuleDescriptorForElement(element),
|
resolveSession.getModuleDescriptorForElement(element),
|
||||||
resolveSession.resolveToElement(element),
|
resolveSession.analyze(element),
|
||||||
Collections.singletonList(file)
|
Collections.singletonList(file)
|
||||||
);
|
);
|
||||||
state.beforeCompile();
|
state.beforeCompile();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lang.psi.JetBinaryExpression
|
|||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
||||||
import org.jetbrains.jet.lang.psi.JetParenthesizedExpression
|
import org.jetbrains.jet.lang.psi.JetParenthesizedExpression
|
||||||
import org.jetbrains.jet.lang.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.jet.lang.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.jet.plugin.caches.resolve.resolveToElement
|
import org.jetbrains.jet.plugin.caches.resolve.analyze
|
||||||
|
|
||||||
public class ConvertToForEachLoopIntention : JetSelfTargetingIntention<JetExpression>("convert.to.for.each.loop.intention", javaClass()) {
|
public class ConvertToForEachLoopIntention : JetSelfTargetingIntention<JetExpression>("convert.to.for.each.loop.intention", javaClass()) {
|
||||||
private fun getFunctionLiteralArgument(element: JetExpression): JetFunctionLiteralExpression? {
|
private fun getFunctionLiteralArgument(element: JetExpression): JetFunctionLiteralExpression? {
|
||||||
@@ -78,7 +78,7 @@ public class ConvertToForEachLoopIntention : JetSelfTargetingIntention<JetExpres
|
|||||||
isWellFormedFunctionLiteral(functionLiteral) &&
|
isWellFormedFunctionLiteral(functionLiteral) &&
|
||||||
checkTotalNumberOfArguments(element)) {
|
checkTotalNumberOfArguments(element)) {
|
||||||
|
|
||||||
val context = element.resolveToElement()
|
val context = element.analyze()
|
||||||
val resolvedCall = element.getResolvedCall(context)
|
val resolvedCall = element.getResolvedCall(context)
|
||||||
val functionFqName = if (resolvedCall != null) DescriptorUtils.getFqName(resolvedCall.getResultingDescriptor()).toString() else null
|
val functionFqName = if (resolvedCall != null) DescriptorUtils.getFqName(resolvedCall.getResultingDescriptor()).toString() else null
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.plugin.codeInsight.ShortenReferences
|
|||||||
import org.jetbrains.jet.JetNodeTypes
|
import org.jetbrains.jet.JetNodeTypes
|
||||||
import org.jetbrains.jet.lexer.JetTokens
|
import org.jetbrains.jet.lexer.JetTokens
|
||||||
import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers
|
import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers
|
||||||
import org.jetbrains.jet.plugin.caches.resolve.resolveToElement
|
import org.jetbrains.jet.plugin.caches.resolve.analyze
|
||||||
|
|
||||||
fun specifyTypeExplicitly(declaration: JetNamedFunction, typeText: String) {
|
fun specifyTypeExplicitly(declaration: JetNamedFunction, typeText: String) {
|
||||||
specifyTypeExplicitly(declaration, JetPsiFactory(declaration).createType(typeText))
|
specifyTypeExplicitly(declaration, JetPsiFactory(declaration).createType(typeText))
|
||||||
@@ -44,12 +44,12 @@ fun specifyTypeExplicitly(declaration: JetNamedFunction, typeReference: JetTypeR
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun expressionType(expression: JetExpression): JetType? {
|
fun expressionType(expression: JetExpression): JetType? {
|
||||||
val bindingContext = expression.resolveToElement()
|
val bindingContext = expression.analyze()
|
||||||
return bindingContext.get(BindingContext.EXPRESSION_TYPE, expression)
|
return bindingContext.get(BindingContext.EXPRESSION_TYPE, expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun functionReturnType(function: JetNamedFunction): JetType? {
|
fun functionReturnType(function: JetNamedFunction): JetType? {
|
||||||
val bindingContext = function.resolveToElement()
|
val bindingContext = function.analyze()
|
||||||
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, function)
|
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, function)
|
||||||
if (descriptor == null) return null
|
if (descriptor == null) return null
|
||||||
return (descriptor as FunctionDescriptor).getReturnType()
|
return (descriptor as FunctionDescriptor).getReturnType()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public abstract class BaseJetVariableMacro extends Macro {
|
|||||||
|
|
||||||
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession((JetFile) psiFile);
|
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession((JetFile) psiFile);
|
||||||
|
|
||||||
BindingContext bindingContext = resolveSession.resolveToElement(contextExpression);
|
BindingContext bindingContext = resolveSession.analyze(contextExpression);
|
||||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, contextExpression);
|
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, contextExpression);
|
||||||
if (scope == null) {
|
if (scope == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+2
-2
@@ -239,7 +239,7 @@ public class JetFunctionParameterInfoHandler implements ParameterInfoHandlerWith
|
|||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
PsiElement owner = context.getParameterOwner();
|
PsiElement owner = context.getParameterOwner();
|
||||||
BindingContext bindingContext = resolveSession.resolveToElement((JetElement) owner);
|
BindingContext bindingContext = resolveSession.analyze((JetElement) owner);
|
||||||
|
|
||||||
for (int i = 0; i < valueParameters.size(); ++i) {
|
for (int i = 0; i < valueParameters.size(); ++i) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -383,7 +383,7 @@ public class JetFunctionParameterInfoHandler implements ParameterInfoHandlerWith
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession(callNameExpression.getContainingJetFile());
|
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession(callNameExpression.getContainingJetFile());
|
||||||
BindingContext bindingContext = resolveSession.resolveToElement(callNameExpression);
|
BindingContext bindingContext = resolveSession.analyze(callNameExpression);
|
||||||
|
|
||||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, callNameExpression);
|
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, callNameExpression);
|
||||||
final DeclarationDescriptor placeDescriptor;
|
final DeclarationDescriptor placeDescriptor;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class AutoImportFix(element: JetSimpleNameExpression) : JetHintAction<Jet
|
|||||||
|
|
||||||
val searchScope = file.getResolveScope()
|
val searchScope = file.getResolveScope()
|
||||||
|
|
||||||
val bindingContext = resolveSession.resolveToElement(element)
|
val bindingContext = resolveSession.analyze(element)
|
||||||
|
|
||||||
val diagnostics = bindingContext.getDiagnostics().forElement(element)
|
val diagnostics = bindingContext.getDiagnostics().forElement(element)
|
||||||
if (!diagnostics.any { it.getFactory() in ERRORS }) return listOf()
|
if (!diagnostics.any { it.getFactory() in ERRORS }) return listOf()
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
|||||||
@NotNull ResolutionFacade resolveSessionForBodies
|
@NotNull ResolutionFacade resolveSessionForBodies
|
||||||
) {
|
) {
|
||||||
JetFunctionLiteral functionLiteral = functionLiteralExpression.getFunctionLiteral();
|
JetFunctionLiteral functionLiteral = functionLiteralExpression.getFunctionLiteral();
|
||||||
BindingContext context = resolveSessionForBodies.resolveToElement(functionLiteralExpression);
|
BindingContext context = resolveSessionForBodies.analyze(functionLiteralExpression);
|
||||||
for (Diagnostic diagnostic : context.getDiagnostics()) {
|
for (Diagnostic diagnostic : context.getDiagnostics()) {
|
||||||
DiagnosticFactory<?> factory = diagnostic.getFactory();
|
DiagnosticFactory<?> factory = diagnostic.getFactory();
|
||||||
PsiElement element = diagnostic.getPsiElement();
|
PsiElement element = diagnostic.getPsiElement();
|
||||||
@@ -324,7 +324,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
|||||||
|
|
||||||
ResolutionFacade resolveSessionForBodies = ResolvePackage.getLazyResolveSession(containingFile);
|
ResolutionFacade resolveSessionForBodies = ResolvePackage.getLazyResolveSession(containingFile);
|
||||||
for (JetExpression inlinedExpression : inlinedExpressions) {
|
for (JetExpression inlinedExpression : inlinedExpressions) {
|
||||||
BindingContext context = resolveSessionForBodies.resolveToElement(inlinedExpression);
|
BindingContext context = resolveSessionForBodies.analyze(inlinedExpression);
|
||||||
Call call = CallUtilPackage.getCallWithAssert(inlinedExpression, context);
|
Call call = CallUtilPackage.getCallWithAssert(inlinedExpression, context);
|
||||||
|
|
||||||
JetElement callElement = call.getCallElement();
|
JetElement callElement = call.getCallElement();
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession(expression);
|
ResolutionFacade resolveSession = ResolvePackage.getLazyResolveSession(expression);
|
||||||
final BindingContext bindingContext = resolveSession.resolveToElement(expression);
|
final BindingContext bindingContext = resolveSession.analyze(expression);
|
||||||
ModuleDescriptor moduleDescriptorForElement = resolveSession.getModuleDescriptorForElement(expression);
|
ModuleDescriptor moduleDescriptorForElement = resolveSession.getModuleDescriptorForElement(expression);
|
||||||
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression); //can be null or error type
|
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression); //can be null or error type
|
||||||
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, expression);
|
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, expression);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ import org.jetbrains.jet.renderer.DescriptorRenderer
|
|||||||
import com.intellij.openapi.util.text.StringUtil
|
import com.intellij.openapi.util.text.StringUtil
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
import org.jetbrains.jet.plugin.util.string.collapseSpaces
|
import org.jetbrains.jet.plugin.util.string.collapseSpaces
|
||||||
import org.jetbrains.jet.plugin.caches.resolve.resolveToElement
|
import org.jetbrains.jet.plugin.caches.resolve.analyze
|
||||||
|
|
||||||
fun <T: Any> PsiElement.getAndRemoveCopyableUserData(key: Key<T>): T? {
|
fun <T: Any> PsiElement.getAndRemoveCopyableUserData(key: Key<T>): T? {
|
||||||
val data = getCopyableUserData(key)
|
val data = getCopyableUserData(key)
|
||||||
@@ -273,7 +273,7 @@ public fun JetElement.getContextForContainingDeclarationBody(): BindingContext?
|
|||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
return bodyElement?.let { it.resolveToElement() }
|
return bodyElement?.let { it.analyze() }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun chooseContainerElement<T>(
|
public fun chooseContainerElement<T>(
|
||||||
|
|||||||
Reference in New Issue
Block a user