Minor. Unneeded getContainingJetFile() calls removed
This commit is contained in:
+1
-1
@@ -94,7 +94,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public LightClassConstructionContext getContextForClassOrObject(@NotNull JetClassOrObject classOrObject) {
|
public LightClassConstructionContext getContextForClassOrObject(@NotNull JetClassOrObject classOrObject) {
|
||||||
ResolveSessionForBodies session = ResolvePackage.getLazyResolveSession(classOrObject.getContainingJetFile());
|
ResolveSessionForBodies session = ResolvePackage.getLazyResolveSession(classOrObject);
|
||||||
|
|
||||||
if (JetPsiUtil.isLocal(classOrObject)) {
|
if (JetPsiUtil.isLocal(classOrObject)) {
|
||||||
BindingContext bindingContext = session.resolveToElement(classOrObject);
|
BindingContext bindingContext = session.resolveToElement(classOrObject);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class JetPackagesContributor extends CompletionContributor {
|
|||||||
result = result.withPrefixMatcher(new PlainPrefixMatcher(name.substring(0, prefixLength)));
|
result = result.withPrefixMatcher(new PlainPrefixMatcher(name.substring(0, prefixLength)));
|
||||||
|
|
||||||
ResolveSessionForBodies resolveSession =
|
ResolveSessionForBodies resolveSession =
|
||||||
ResolvePackage.getLazyResolveSession(simpleNameReference.getExpression().getContainingJetFile());
|
ResolvePackage.getLazyResolveSession(simpleNameReference.getExpression());
|
||||||
BindingContext bindingContext = resolveSession.resolveToElement(simpleNameReference.getExpression());
|
BindingContext bindingContext = resolveSession.resolveToElement(simpleNameReference.getExpression());
|
||||||
|
|
||||||
for (LookupElement variant : DescriptorLookupConverter.collectLookupElements(
|
for (LookupElement variant : DescriptorLookupConverter.collectLookupElements(
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class RemoveExplicitTypeArguments : JetSelfTargetingIntention<JetCallExpr
|
|||||||
val context = AnalyzerFacadeWithCache.getContextForElement(element)
|
val context = AnalyzerFacadeWithCache.getContextForElement(element)
|
||||||
if (element.getTypeArguments().isEmpty()) return false
|
if (element.getTypeArguments().isEmpty()) return false
|
||||||
|
|
||||||
val resolveSession = element.getContainingJetFile().getLazyResolveSession()
|
val resolveSession = element.getLazyResolveSession()
|
||||||
val injector = InjectorForMacros(element.getProject(), resolveSession.getModuleDescriptor())
|
val injector = InjectorForMacros(element.getProject(), resolveSession.getModuleDescriptor())
|
||||||
|
|
||||||
val scope = context[BindingContext.RESOLUTION_SCOPE, element]
|
val scope = context[BindingContext.RESOLUTION_SCOPE, element]
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ fun specifyTypeExplicitly(declaration: JetNamedFunction, typeReference: JetTypeR
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun expressionType(expression: JetExpression): JetType? {
|
fun expressionType(expression: JetExpression): JetType? {
|
||||||
val resolveSession = expression.getContainingJetFile().getLazyResolveSession()
|
val resolveSession = expression.getLazyResolveSession()
|
||||||
val bindingContext = resolveSession.resolveToElement(expression)
|
val bindingContext = resolveSession.resolveToElement(expression)
|
||||||
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 resolveSession = function.getContainingJetFile().getLazyResolveSession()
|
val resolveSession = function.getLazyResolveSession()
|
||||||
val bindingContext = resolveSession.resolveToElement(function)
|
val bindingContext = resolveSession.resolveToElement(function)
|
||||||
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
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public final class AnalyzerFacadeWithCache {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static BindingContext getContextForElement(@NotNull JetElement jetElement) {
|
public static BindingContext getContextForElement(@NotNull JetElement jetElement) {
|
||||||
ResolveSessionForBodies resolveSessionForBodies = ResolvePackage.getLazyResolveSession(jetElement.getContainingJetFile());
|
ResolveSessionForBodies resolveSessionForBodies = ResolvePackage.getLazyResolveSession(jetElement);
|
||||||
return resolveSessionForBodies.resolveToElement(jetElement);
|
return resolveSessionForBodies.resolveToElement(jetElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResolveSessionForBodies resolveSessionForBodies =
|
ResolveSessionForBodies resolveSessionForBodies =
|
||||||
ResolvePackage.getLazyResolveSession(element.getContainingJetFile());
|
ResolvePackage.getLazyResolveSession(element);
|
||||||
|
|
||||||
List<FqName> result = Lists.newArrayList();
|
List<FqName> result = Lists.newArrayList();
|
||||||
if (!isSuppressedTopLevelImportInPosition(element)) {
|
if (!isSuppressedTopLevelImportInPosition(element)) {
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ResolveSessionForBodies resolveSession =
|
ResolveSessionForBodies resolveSession =
|
||||||
ResolvePackage.getLazyResolveSession(expression.getContainingJetFile());
|
ResolvePackage.getLazyResolveSession(expression);
|
||||||
BindingContext bindingContext = resolveSession.resolveToElement(expression);
|
BindingContext bindingContext = resolveSession.resolveToElement(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);
|
||||||
|
|||||||
Reference in New Issue
Block a user