Minor. Unneeded getContainingJetFile() calls removed

This commit is contained in:
Andrey Breslav
2014-04-23 15:55:41 +04:00
parent 64f60b3458
commit 4bbde707c0
7 changed files with 8 additions and 8 deletions
@@ -94,7 +94,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
@NotNull
@Override
public LightClassConstructionContext getContextForClassOrObject(@NotNull JetClassOrObject classOrObject) {
ResolveSessionForBodies session = ResolvePackage.getLazyResolveSession(classOrObject.getContainingJetFile());
ResolveSessionForBodies session = ResolvePackage.getLazyResolveSession(classOrObject);
if (JetPsiUtil.isLocal(classOrObject)) {
BindingContext bindingContext = session.resolveToElement(classOrObject);
@@ -72,7 +72,7 @@ public class JetPackagesContributor extends CompletionContributor {
result = result.withPrefixMatcher(new PlainPrefixMatcher(name.substring(0, prefixLength)));
ResolveSessionForBodies resolveSession =
ResolvePackage.getLazyResolveSession(simpleNameReference.getExpression().getContainingJetFile());
ResolvePackage.getLazyResolveSession(simpleNameReference.getExpression());
BindingContext bindingContext = resolveSession.resolveToElement(simpleNameReference.getExpression());
for (LookupElement variant : DescriptorLookupConverter.collectLookupElements(
@@ -40,7 +40,7 @@ public class RemoveExplicitTypeArguments : JetSelfTargetingIntention<JetCallExpr
val context = AnalyzerFacadeWithCache.getContextForElement(element)
if (element.getTypeArguments().isEmpty()) return false
val resolveSession = element.getContainingJetFile().getLazyResolveSession()
val resolveSession = element.getLazyResolveSession()
val injector = InjectorForMacros(element.getProject(), resolveSession.getModuleDescriptor())
val scope = context[BindingContext.RESOLUTION_SCOPE, element]
@@ -29,13 +29,13 @@ fun specifyTypeExplicitly(declaration: JetNamedFunction, typeReference: JetTypeR
}
fun expressionType(expression: JetExpression): JetType? {
val resolveSession = expression.getContainingJetFile().getLazyResolveSession()
val resolveSession = expression.getLazyResolveSession()
val bindingContext = resolveSession.resolveToElement(expression)
return bindingContext.get(BindingContext.EXPRESSION_TYPE, expression)
}
fun functionReturnType(function: JetNamedFunction): JetType? {
val resolveSession = function.getContainingJetFile().getLazyResolveSession()
val resolveSession = function.getLazyResolveSession()
val bindingContext = resolveSession.resolveToElement(function)
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, function)
if (descriptor == null) return null
@@ -28,7 +28,7 @@ public final class AnalyzerFacadeWithCache {
@NotNull
public static BindingContext getContextForElement(@NotNull JetElement jetElement) {
ResolveSessionForBodies resolveSessionForBodies = ResolvePackage.getLazyResolveSession(jetElement.getContainingJetFile());
ResolveSessionForBodies resolveSessionForBodies = ResolvePackage.getLazyResolveSession(jetElement);
return resolveSessionForBodies.resolveToElement(jetElement);
}
}
@@ -93,7 +93,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
}
ResolveSessionForBodies resolveSessionForBodies =
ResolvePackage.getLazyResolveSession(element.getContainingJetFile());
ResolvePackage.getLazyResolveSession(element);
List<FqName> result = Lists.newArrayList();
if (!isSuppressedTopLevelImportInPosition(element)) {
@@ -125,7 +125,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
}
}
ResolveSessionForBodies resolveSession =
ResolvePackage.getLazyResolveSession(expression.getContainingJetFile());
ResolvePackage.getLazyResolveSession(expression);
BindingContext bindingContext = resolveSession.resolveToElement(expression);
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression); //can be null or error type
JetScope scope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, expression);