Rename: JetElement#getBindingContext() -> analyzeFully

This commit is contained in:
Pavel V. Talanov
2014-11-20 18:27:00 +03:00
parent d06628945c
commit 1cf3938f13
39 changed files with 51 additions and 52 deletions
@@ -292,7 +292,7 @@ private object KotlinResolveDataProvider {
else {
if (contextElement !is JetExpression) return BindingContext.EMPTY
val contextForElement = contextElement.getBindingContext()
val contextForElement = contextElement.analyzeFully()
scopeForContextElement = contextForElement[BindingContext.RESOLUTION_SCOPE, contextElement]
dataFlowInfo = contextForElement.getDataFlowInfo(contextElement)
@@ -49,7 +49,7 @@ public fun JetElement.getAnalysisResults(vararg extraFiles: JetFile): AnalysisRe
return KotlinCacheService.getInstance(getProject()).getAnalysisResults(listOf(this) + extraFiles.toList())
}
public fun JetElement.getBindingContext(): BindingContext {
public fun JetElement.analyzeFully(): BindingContext {
return getAnalysisResults().bindingContext
}
@@ -48,7 +48,7 @@ public class DebugInfoAnnotator implements Annotator {
if (element instanceof JetFile && !(element instanceof JetCodeFragment)) {
JetFile file = (JetFile) element;
try {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
DebugInfoUtil.markDebugAnnotations(file, bindingContext, new DebugInfoUtil.DebugInfoReporter() {
@Override
public void reportElementWithErrorType(@NotNull JetReferenceExpression expression) {
@@ -44,7 +44,7 @@ public class DuplicateJvmSignatureAnnotator implements Annotator {
PsiFile file = element.getContainingFile();
if (!(file instanceof JetFile) || TargetPlatformDetector.getPlatform((JetFile) file) != TargetPlatform.JVM) return;
Diagnostics otherDiagnostics = ResolvePackage.getBindingContext((JetElement) element).getDiagnostics();
Diagnostics otherDiagnostics = ResolvePackage.analyzeFully((JetElement) element).getDiagnostics();
GlobalSearchScope moduleScope = getModuleInfo(element).contentScope();
Diagnostics diagnostics = AsJavaPackage.getJvmSignatureDiagnostics(element, otherDiagnostics, moduleScope);
@@ -40,7 +40,7 @@ public class ShowExpressionTypeAction extends AnAction {
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
assert editor != null && psiFile != null;
JetExpression expression;
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) psiFile);
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) psiFile);
if (editor.getSelectionModel().hasSelection()) {
int startOffset = editor.getSelectionModel().getSelectionStart();
int endOffset = editor.getSelectionModel().getSelectionEnd();
@@ -40,7 +40,7 @@ public class CopyAsDiagnosticTestAction extends AnAction {
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
assert editor != null && psiFile != null;
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) psiFile);
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) psiFile);
List<Diagnostic> diagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile);
String result = CheckerTestUtil.addDiagnosticMarkersToText(psiFile, diagnostics).toString();
@@ -33,7 +33,7 @@ public class JetTypeDeclarationProvider implements TypeDeclarationProvider {
public PsiElement[] getSymbolTypeDeclarations(PsiElement symbol) {
if (symbol instanceof JetElement && symbol.getContainingFile() instanceof JetFile) {
BindingContext bindingContext =
ResolvePackage.getBindingContext((JetFile) symbol.getContainingFile());
ResolvePackage.analyzeFully((JetFile) symbol.getContainingFile());
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, symbol);
if (descriptor instanceof CallableDescriptor) {
JetType type = ((CallableDescriptor) descriptor).getReturnType();
@@ -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.getBindingContext(function)
FunctionDescriptor functionDescriptor = ResolvePackage.analyzeFully(function)
.get(BindingContext.FUNCTION, target);
if (functionDescriptor != null) {
JetType type = functionDescriptor.getReturnType();
@@ -193,7 +193,7 @@ public class DeclarationHintSupport extends AbstractProjectComponent {
DeclarationDescriptor descriptor = null;
try {
BindingContext bindingContext =
ResolvePackage.getBindingContext(jetFile);
ResolvePackage.analyzeFully(jetFile);
descriptor = bindingContext.getDiagnostics().forElement(declaration).isEmpty()
? bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)
: null;
@@ -19,7 +19,7 @@ package org.jetbrains.jet.plugin.intentions
import com.intellij.openapi.editor.Editor
import org.jetbrains.jet.lang.psi.JetFunctionLiteralArgument
import org.jetbrains.jet.plugin.util.psiModificationUtil.moveInsideParentheses
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
public class MoveLambdaInsideParenthesesIntention : JetSelfTargetingIntention<JetFunctionLiteralArgument>(
"move.lambda.inside.parentheses", javaClass()) {
@@ -27,7 +27,7 @@ public class MoveLambdaInsideParenthesesIntention : JetSelfTargetingIntention<Je
override fun isApplicableTo(element: JetFunctionLiteralArgument): Boolean = true
override fun applyTo(element: JetFunctionLiteralArgument, editor: Editor) {
element.moveInsideParentheses(element.getBindingContext())
element.moveInsideParentheses(element.analyzeFully())
}
}
@@ -19,7 +19,7 @@ package org.jetbrains.jet.plugin.intentions
import org.jetbrains.jet.lang.psi.JetCallExpression
import com.intellij.openapi.editor.Editor
import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.plugin.JetBundle
import org.jetbrains.jet.lang.psi.JetValueArgument
@@ -58,7 +58,7 @@ public open class ReplaceWithInfixFunctionCallIntention : JetSelfTargetingIntent
if (valueArguments?.getArguments()?.size() == 1 && valueArguments?.getArguments()?.first()?.isNamed() ?: false) {
val file = element.getContainingJetFile()
val bindingContext = file.getBindingContext()
val bindingContext = file.analyzeFully()
val resolvedCall = element.getResolvedCall(bindingContext)
val valueArgumentsMap = resolvedCall?.getValueArguments()
val firstArgument = valueArguments?.getArguments()?.first()
@@ -122,7 +122,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
private static boolean hasPublicMemberDiagnostic(@NotNull JetNamedDeclaration declaration) {
BindingContext bindingContext = ResolvePackage.getBindingContext(declaration.getContainingJetFile());
BindingContext bindingContext = ResolvePackage.analyzeFully(declaration.getContainingJetFile());
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
//noinspection ConstantConditions
if (Errors.PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE == diagnostic.getFactory() && declaration == diagnostic.getPsiElement()) {
@@ -134,7 +134,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
@NotNull
public static JetType getTypeForDeclaration(@NotNull JetCallableDeclaration declaration) {
BindingContext bindingContext = ResolvePackage.getBindingContext(declaration.getContainingJetFile());
BindingContext bindingContext = ResolvePackage.analyzeFully(declaration.getContainingJetFile());
CallableDescriptor descriptor = (CallableDescriptor) bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
JetType type = descriptor != null ? descriptor.getReturnType() : null;
@@ -88,7 +88,7 @@ public class ConvertMemberToExtension extends BaseIntentionAction {
JetCallableDeclaration member = getTarget(editor, file);
assert member != null : "Must be checked by isAvailable";
BindingContext bindingContext = ResolvePackage.getBindingContext(member);
BindingContext bindingContext = ResolvePackage.analyzeFully(member);
DeclarationDescriptor memberDescriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, member);
if (memberDescriptor == null) return;
@@ -16,7 +16,6 @@
package org.jetbrains.jet.plugin.quickfix;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
@@ -115,7 +114,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
@Override
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) callElement.getContainingFile());
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) callElement.getContainingFile());
runChangeSignature(project, functionDescriptor, addParameterConfiguration(), bindingContext, callElement, getText());
QuickFixUtil.shortenReferencesOfTypes(typesToShorten, file);
}
@@ -68,7 +68,7 @@ public class AddNameToArgumentFix extends JetIntentionAction<JetValueArgument> {
JetCallElement callElement = PsiTreeUtil.getParentOfType(argument, JetCallElement.class);
assert callElement != null : "The argument has to be inside a function or constructor call";
BindingContext context = ResolvePackage.getBindingContext(argument.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(argument.getContainingJetFile());
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(callElement, context);
if (resolvedCall == null) return Collections.emptyList();
@@ -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.getBindingContext(jetFile).getDiagnostics()) {
for (Diagnostic diagnostic : ResolvePackage.analyzeFully(jetFile).getDiagnostics()) {
if (diagnostic.getFactory() != Errors.VIRTUAL_MEMBER_HIDDEN) continue;
JetModifierListOwner element = (JetModifierListOwner) diagnostic.getPsiElement();
@@ -63,7 +63,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;
BindingContext context = ResolvePackage.getBindingContext((JetFile) file);
BindingContext context = ResolvePackage.analyzeFully((JetFile) file);
JetType expressionType = context.get(BindingContext.EXPRESSION_TYPE, element);
return expressionType != null && JetTypeChecker.DEFAULT.isSubtypeOf(type, expressionType);
}
@@ -55,7 +55,7 @@ public class ChangeFunctionLiteralReturnTypeFix extends JetIntentionAction<JetFu
this.type = type;
functionLiteralReturnTypeRef = functionLiteralExpression.getFunctionLiteral().getTypeReference();
BindingContext context = ResolvePackage.getBindingContext(functionLiteralExpression.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(functionLiteralExpression.getContainingJetFile());
JetType functionLiteralType = context.get(BindingContext.EXPRESSION_TYPE, functionLiteralExpression);
assert functionLiteralType != null : "Type of function literal not available in binding context";
@@ -58,7 +58,7 @@ public class ChangeFunctionLiteralSignatureFix extends ChangeFunctionSignatureFi
@Override
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
@Override
public void configure(@NotNull JetChangeSignatureData changeSignatureData, @NotNull BindingContext bindingContext) {
@@ -133,7 +133,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
@Override
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
JetMultiDeclarationEntry entry = getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
BindingContext context = ResolvePackage.getBindingContext((JetFile) entry.getContainingFile().getContainingFile());
BindingContext context = ResolvePackage.analyzeFully((JetFile) entry.getContainingFile().getContainingFile());
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
if (resolvedCall == null) return null;
JetFunction componentFunction = (JetFunction) DescriptorToSourceUtils
@@ -155,7 +155,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.getBindingContext(expression.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(expression.getContainingJetFile());
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, expression);
if (resolvedCall == null) return null;
JetFunction hasNextFunction = (JetFunction) DescriptorToSourceUtils
@@ -176,7 +176,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.getBindingContext(expression.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(expression.getContainingJetFile());
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(expression, context);
if (resolvedCall == null) return null;
PsiElement compareTo = DescriptorToSourceUtils.descriptorToDeclaration(resolvedCall.getCandidateDescriptor());
@@ -196,7 +196,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
JetFunction function = QuickFixUtil.getParentElementOfType(diagnostic, JetFunction.class);
if (function != null) {
BindingContext context = ResolvePackage.getBindingContext(function);
BindingContext context = ResolvePackage.analyzeFully(function);
JetType matchingReturnType = QuickFixUtil.findLowerBoundOfOverriddenCallablesReturnTypes(context, function);
if (matchingReturnType != null) {
actions.add(new ChangeFunctionReturnTypeFix(function, matchingReturnType));
@@ -168,7 +168,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
EXPECTED_PARAMETERS_NUMBER_MISMATCH.cast(diagnostic);
JetFunctionLiteral functionLiteral = diagnosticWithParameters.getPsiElement();
BindingContext bindingContext =
ResolvePackage.getBindingContext(functionLiteral.getContainingJetFile());
ResolvePackage.analyzeFully(functionLiteral.getContainingJetFile());
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, functionLiteral);
if (descriptor instanceof FunctionDescriptor) {
@@ -223,7 +223,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
}
BindingContext bindingContext =
ResolvePackage.getBindingContext((JetFile) context.getContainingFile());
ResolvePackage.analyzeFully((JetFile) context.getContainingFile());
if (descriptor instanceof ValueParameterDescriptor) {
return new RemoveFunctionParametersFix(context, functionDescriptor, (ValueParameterDescriptor) descriptor);
}
@@ -116,7 +116,7 @@ public class ChangeMemberFunctionSignatureFix extends JetHintAction<JetNamedFunc
return Collections.emptyList();
}
BindingContext context = ResolvePackage.getBindingContext(functionElement);
BindingContext context = ResolvePackage.analyzeFully(functionElement);
FunctionDescriptor functionDescriptor = context.get(BindingContext.FUNCTION, functionElement);
if (functionDescriptor == null) return Lists.newArrayList();
List<FunctionDescriptor> superFunctions = getPossibleSuperFunctionsDescriptors(functionDescriptor);
@@ -61,7 +61,7 @@ public class ChangeToConstructorInvocationFix extends JetIntentionAction<JetDele
}
JetTypeReference typeReference = element.getTypeReference();
BindingContext context = ResolvePackage.getBindingContext(typeReference);
BindingContext context = ResolvePackage.analyzeFully(typeReference);
JetType supertype = context.get(BindingContext.TYPE, typeReference);
if (supertype == null) return false;
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
@@ -72,7 +72,7 @@ public class ChangeVariableMutabilityFix implements IntentionAction {
if (property != null) return property;
JetSimpleNameExpression simpleNameExpression = PsiTreeUtil.getParentOfType(elementAtCaret, JetSimpleNameExpression.class);
if (simpleNameExpression != null) {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
VariableDescriptor descriptor = BindingContextUtils.extractVariableDescriptorIfAny(bindingContext, simpleNameExpression, true);
if (descriptor != null) {
PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor);
@@ -111,7 +111,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
@Override
public IntentionAction createAction(@NotNull Diagnostic diagnostic) {
JetMultiDeclarationEntry entry = ChangeFunctionReturnTypeFix.getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
BindingContext context = ResolvePackage.getBindingContext(entry.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(entry.getContainingJetFile());
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
if (resolvedCall == null) return null;
JetFunction componentFunction = (JetFunction) DescriptorToSourceUtils
@@ -133,7 +133,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
JetProperty property = QuickFixUtil.getParentElementOfType(diagnostic, JetProperty.class);
if (property != null) {
BindingContext context = ResolvePackage.getBindingContext(property.getContainingJetFile());
BindingContext context = ResolvePackage.analyzeFully(property.getContainingJetFile());
JetType lowerBoundOfOverriddenPropertiesTypes = QuickFixUtil.findLowerBoundOfOverriddenCallablesReturnTypes(context, property);
DeclarationDescriptor descriptor = context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, property);
@@ -73,7 +73,7 @@ public class ChangeVisibilityModifierFix extends JetIntentionAction<JetModifierL
@Nullable
private JetModifierKeywordToken findVisibilityChangeTo(JetFile file) {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
DeclarationDescriptor descriptor;
if (element instanceof JetParameter) {
descriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, element);
@@ -79,7 +79,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
@Override
public void invoke(@NotNull Project project, Editor editor, JetFile file) throws IncorrectOperationException {
BindingContext context = ResolvePackage.getBindingContext(file);
BindingContext context = ResolvePackage.analyzeFully(file);
Iterable<Diagnostic> diagnostics = context.getDiagnostics();
List<JetImportDirective> imports = new ArrayList<JetImportDirective>();
List<JetUserType> usages = new ArrayList<JetUserType>();
@@ -196,7 +196,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
PsiFile psiFile = diagnostic.getPsiFile();
if (!(psiFile instanceof JetFile)) return null;
BindingContext context = ResolvePackage.getBindingContext((JetFile) psiFile);
BindingContext context = ResolvePackage.analyzeFully((JetFile) psiFile);
ClassDescriptor platformClass = resolveToClass(typeExpr, context);
if (platformClass == null) return null;
@@ -46,7 +46,7 @@ public class QuickFixFactoryForTypeMismatchError extends JetIntentionActionsFact
JetExpression expression = diagnosticWithParameters.getPsiElement();
JetType expectedType = diagnosticWithParameters.getA();
JetType expressionType = diagnosticWithParameters.getB();
BindingContext context = ResolvePackage.getBindingContext((JetFile) diagnostic.getPsiFile());
BindingContext context = ResolvePackage.analyzeFully((JetFile) diagnostic.getPsiFile());
// We don't want to cast a cast or type-asserted expression:
if (!(expression instanceof JetBinaryExpressionWithTypeRHS) && !(expression.getParent() instanceof JetBinaryExpressionWithTypeRHS)) {
@@ -74,7 +74,7 @@ public class QuickFixUtil {
public static JetType getDeclarationReturnType(JetNamedDeclaration declaration) {
PsiFile file = declaration.getContainingFile();
if (!(file instanceof JetFile)) return null;
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) file);
BindingContext bindingContext = ResolvePackage.analyzeFully((JetFile) file);
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
if (!(descriptor instanceof CallableDescriptor)) return null;
JetType type = ((CallableDescriptor) descriptor).getReturnType();
@@ -54,7 +54,7 @@ public class RemoveFunctionParametersFix extends ChangeFunctionSignatureFix {
@Override
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
@Override
public void configure(
@@ -48,7 +48,7 @@ public class RenameParameterToMatchOverriddenMethodFix extends JetIntentionActio
return false;
}
BindingContext context = ResolvePackage.getBindingContext(parameter);
BindingContext context = ResolvePackage.analyzeFully(parameter);
VariableDescriptor parameterDescriptor = context.get(BindingContext.VALUE_PARAMETER, parameter);
if (parameterDescriptor == null) {
return false;
@@ -9,7 +9,7 @@ import org.jetbrains.jet.lang.psi.JetForExpression
import org.jetbrains.jet.lang.psi.JetExpression
import org.jetbrains.jet.lang.types.Variance
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.lang.types.TypeProjectionImpl
import java.util.Collections
import org.jetbrains.jet.lang.types.JetTypeImpl
@@ -24,7 +24,7 @@ object CreateIteratorFunctionActionFactory : JetSingleIntentionActionFactory() {
val iterableType = TypeInfo(iterableExpr, Variance.IN_VARIANCE)
val returnJetType = KotlinBuiltIns.getInstance().getIterator().getDefaultType()
val context = file.getBindingContext()
val context = file.analyzeFully()
val returnJetTypeParameterTypes = variableExpr.guessTypes(context, null)
if (returnJetTypeParameterTypes.size != 1) return null
@@ -13,7 +13,7 @@ import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
import org.jetbrains.jet.lang.psi.psiUtil.getQualifiedElement
import org.jetbrains.jet.lang.psi.JetClass
import org.jetbrains.jet.plugin.quickfix.createFromUsage.callableBuilder.guessTypes
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor
@@ -72,7 +72,7 @@ public class KotlinAnnotatedElementsSearcher extends AnnotatedElementsSearcher {
JetAnnotationEntry annotationEntry = (JetAnnotationEntry) elt;
BindingContext context = ResolvePackage.getBindingContext(annotationEntry);
BindingContext context = ResolvePackage.analyzeFully(annotationEntry);
AnnotationDescriptor annotationDescriptor = context.get(BindingContext.ANNOTATION, annotationEntry);
if (annotationDescriptor == null) return;
@@ -46,7 +46,7 @@ public class DirectiveBasedActionUtils {
return;
}
Collection<Diagnostic> diagnostics = ResolvePackage.getBindingContext(file).getDiagnostics().all();
Collection<Diagnostic> diagnostics = ResolvePackage.analyzeFully(file).getDiagnostics().all();
Collection<Diagnostic> errorDiagnostics = Collections2.filter(diagnostics, new Predicate<Diagnostic>() {
@Override
public boolean apply(@Nullable Diagnostic diagnostic) {
@@ -98,7 +98,7 @@ public abstract class AbstractInsertImportOnPasteTest extends JetLightCodeInsigh
}
private static void checkNoUnresolvedReferences(@NotNull final JetFile file) {
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
BindingContext bindingContext = ResolvePackage.analyzeFully(file);
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.getFactory())) {
List<TextRange> textRanges = diagnostic.getTextRanges();
@@ -26,7 +26,7 @@ import org.jetbrains.jet.cli.common.messages.MessageCollectorPlainTextToStream
import com.intellij.openapi.projectRoots.Sdk
import org.jetbrains.jet.plugin.PluginTestCaseBase
import kotlin.test.assertEquals
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.lang.diagnostics.Severity
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.jet.JetTestUtils
@@ -46,7 +46,7 @@ public class NoErrorsInStdlibTest : LightCodeInsightFixtureTestCase() {
val psiFile = psiManager.findFile(file)
if (psiFile is JetFile) {
hasAtLeastOneFile = true
val bindingContext = psiFile.getBindingContext()
val bindingContext = psiFile.analyzeFully()
val errors = bindingContext.getDiagnostics().all().filter { it.getSeverity() == Severity.ERROR }
if (errors.isNotEmpty()) {
@@ -46,7 +46,7 @@ import org.jetbrains.jet.lang.resolve.name.isSubpackageOf
import org.jetbrains.jet.getString
import org.jetbrains.jet.getNullableString
import org.jetbrains.jet.plugin.search.allScope
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.lang.resolve.DescriptorToSourceUtils
import com.intellij.refactoring.BaseRefactoringProcessor.ConflictsInTestsException
import com.intellij.refactoring.util.CommonRefactoringUtil.RefactoringErrorHintException
@@ -192,7 +192,7 @@ public abstract class AbstractRenameTest : MultiFileTestCase() {
val document = FileDocumentManager.getInstance()!!.getDocument(mainFile)!!
val jetFile = PsiDocumentManager.getInstance(context.project).getPsiFile(document) as JetFile
val bindingContext = jetFile.getBindingContext()
val bindingContext = jetFile.analyzeFully()
val classDescriptor = bindingContext.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, classFqName)!!
val psiElement = DescriptorToSourceUtils.descriptorToDeclaration(findDescriptorToRename(classDescriptor))!!
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.psi.psiUtil.parents
import com.intellij.openapi.util.TextRange
import org.jetbrains.jet.lang.psi.JetElement
import org.jetbrains.jet.plugin.util.psi.patternMatching.JetPsiUnifier
import org.jetbrains.jet.plugin.caches.resolve.getBindingContext
import org.jetbrains.jet.plugin.caches.resolve.analyzeFully
import org.jetbrains.jet.plugin.util.psi.patternMatching.toRange
import java.io.File
import org.jetbrains.jet.JetTestUtils