Minor. getAnalysisResults(x).getBindingContext() replaced by getBindingContext(x)
This commit is contained in:
@@ -43,7 +43,7 @@ public class CopyAsDiagnosticTestAction extends AnAction {
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
assert editor != null && psiFile != null;
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults((JetFile) psiFile).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) psiFile);
|
||||
|
||||
List<Diagnostic> diagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile);
|
||||
String result = CheckerTestUtil.addDiagnosticMarkersToText(psiFile, diagnostics).toString();
|
||||
|
||||
@@ -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.getAnalysisResults((JetFile) psiFile).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) psiFile);
|
||||
if (editor.getSelectionModel().hasSelection()) {
|
||||
int startOffset = editor.getSelectionModel().getSelectionStart();
|
||||
int endOffset = editor.getSelectionModel().getSelectionEnd();
|
||||
|
||||
@@ -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.getAnalysisResults((JetFile) symbol.getContainingFile()).getBindingContext();
|
||||
ResolvePackage.getBindingContext((JetFile) symbol.getContainingFile());
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, symbol);
|
||||
if (descriptor instanceof CallableDescriptor) {
|
||||
JetType type = ((CallableDescriptor) descriptor).getReturnType();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DebugInfoAnnotator implements Annotator {
|
||||
if (element instanceof JetFile && !(element instanceof JetCodeFragmentImpl)) {
|
||||
JetFile file = (JetFile) element;
|
||||
try {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
DebugInfoUtil.markDebugAnnotations(file, bindingContext, new DebugInfoUtil.DebugInfoReporter() {
|
||||
@Override
|
||||
public void reportElementWithErrorType(@NotNull JetReferenceExpression expression) {
|
||||
|
||||
@@ -195,7 +195,7 @@ public class DeclarationHintSupport extends AbstractProjectComponent {
|
||||
DeclarationDescriptor descriptor = null;
|
||||
try {
|
||||
BindingContext bindingContext =
|
||||
ResolvePackage.getAnalysisResults(jetFile).getBindingContext();
|
||||
ResolvePackage.getBindingContext(jetFile);
|
||||
descriptor = bindingContext.getDiagnostics().forElement(declaration).isEmpty()
|
||||
? bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)
|
||||
: null;
|
||||
|
||||
@@ -328,7 +328,7 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
JetFile file = (JetFile)element.getContainingFile();
|
||||
if (file == null) return "";
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
|
||||
if (!(descriptor instanceof CallableMemberDescriptor)) {
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
|
||||
|
||||
private static boolean hasPublicMemberDiagnostic(@NotNull JetNamedDeclaration declaration) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(declaration.getContainingJetFile()).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(declaration.getContainingJetFile());
|
||||
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
|
||||
//noinspection ConstantConditions
|
||||
if (Errors.PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE == diagnostic.getFactory() && declaration == diagnostic.getPsiElement()) {
|
||||
@@ -152,7 +152,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
|
||||
@NotNull
|
||||
public static JetType getTypeForDeclaration(@NotNull JetNamedDeclaration declaration) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(declaration.getContainingJetFile()).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(declaration.getContainingJetFile());
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
|
||||
|
||||
JetType type;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ResolveToolWindow extends JPanel implements Disposable {
|
||||
int startOffset = requestInfo.getStartOffset();
|
||||
int endOffset = requestInfo.getEndOffset();
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(jetFile).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(jetFile);
|
||||
|
||||
PsiElement elementAtOffset;
|
||||
if (startOffset == endOffset) {
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults((JetFile) callElement.getContainingFile()).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) callElement.getContainingFile());
|
||||
runChangeSignature(project, functionDescriptor, addParameterConfiguration(), bindingContext, callElement, getText());
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class AddNameToArgumentFix extends JetIntentionAction<JetValueArgument> {
|
||||
JetExpression callee = callElement.getCalleeExpression();
|
||||
if (!(callee instanceof JetReferenceExpression)) return Collections.emptyList();
|
||||
|
||||
BindingContext context = ResolvePackage.getAnalysisResults(argument.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(argument.getContainingJetFile());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, (JetReferenceExpression) callee);
|
||||
if (resolvedCall == null) return Collections.emptyList();
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class AddOverrideToEqualsHashCodeToStringFix extends JetIntentionAction<P
|
||||
Collection<JetFile> files = PluginJetFilesProvider.allFilesInProject(file);
|
||||
|
||||
for (JetFile jetFile : files) {
|
||||
for (Diagnostic diagnostic : ResolvePackage.getAnalysisResults(jetFile).getBindingContext().getDiagnostics()) {
|
||||
for (Diagnostic diagnostic : ResolvePackage.getBindingContext(jetFile).getDiagnostics()) {
|
||||
if (diagnostic.getFactory() != Errors.VIRTUAL_MEMBER_HIDDEN) continue;
|
||||
|
||||
PsiElement element = diagnostic.getPsiElement();
|
||||
|
||||
@@ -59,7 +59,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.getAnalysisResults((JetFile) file).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext((JetFile) file);
|
||||
JetType expressionType = context.get(BindingContext.EXPRESSION_TYPE, element);
|
||||
return expressionType != null && JetTypeChecker.INSTANCE.isSubtypeOf(type, expressionType);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ChangeFunctionLiteralReturnTypeFix extends JetIntentionAction<JetFu
|
||||
renderedType = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(type);
|
||||
functionLiteralReturnTypeRef = element.getFunctionLiteral().getReturnTypeRef();
|
||||
|
||||
BindingContext context = ResolvePackage.getAnalysisResults(element.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(element.getContainingJetFile());
|
||||
JetType functionLiteralType = context.get(BindingContext.EXPRESSION_TYPE, element);
|
||||
assert functionLiteralType != null : "Type of function literal not available in binding context";
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ChangeFunctionLiteralSignatureFix extends ChangeFunctionSignatureFi
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull final Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
|
||||
@Override
|
||||
public void configure(@NotNull JetChangeSignatureData changeSignatureData, @NotNull BindingContext bindingContext) {
|
||||
|
||||
@@ -142,8 +142,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
@Override
|
||||
public IntentionAction createAction(Diagnostic diagnostic) {
|
||||
JetMultiDeclarationEntry entry = getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
|
||||
BindingContext context = ResolvePackage.getAnalysisResults((JetFile) entry.getContainingFile().getContainingFile())
|
||||
.getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext((JetFile) entry.getContainingFile().getContainingFile());
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction componentFunction = (JetFunction) BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
@@ -164,7 +163,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
public IntentionAction createAction(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.getAnalysisResults(expression.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(expression.getContainingJetFile());
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, expression);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction hasNextFunction = (JetFunction) BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
@@ -184,7 +183,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
public IntentionAction createAction(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.getAnalysisResults(expression.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(expression.getContainingJetFile());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
if (resolvedCall == null) return null;
|
||||
PsiElement compareTo = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
return false;
|
||||
}
|
||||
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults((JetFile) file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) file);
|
||||
List<PsiElement> declarations = BindingContextUtils.callableDescriptorToDeclarations(bindingContext, functionDescriptor);
|
||||
if (declarations.isEmpty()) {
|
||||
return false;
|
||||
@@ -164,7 +164,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
(DiagnosticWithParameters2<JetFunctionLiteral, Integer, List<JetType>>) diagnostic;
|
||||
JetFunctionLiteral functionLiteral = diagnosticWithParameters.getPsiElement();
|
||||
BindingContext bindingContext =
|
||||
ResolvePackage.getAnalysisResults(functionLiteral.getContainingJetFile()).getBindingContext();
|
||||
ResolvePackage.getBindingContext(functionLiteral.getContainingJetFile());
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, functionLiteral);
|
||||
|
||||
if (descriptor instanceof FunctionDescriptor) {
|
||||
@@ -219,7 +219,7 @@ public abstract class ChangeFunctionSignatureFix extends JetIntentionAction<PsiE
|
||||
}
|
||||
|
||||
BindingContext bindingContext =
|
||||
ResolvePackage.getAnalysisResults((JetFile) context.getContainingFile()).getBindingContext();
|
||||
ResolvePackage.getBindingContext((JetFile) context.getContainingFile());
|
||||
if (descriptor instanceof ValueParameterDescriptor) {
|
||||
return new RemoveFunctionParametersFix(context, functionDescriptor, (ValueParameterDescriptor) descriptor);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ChangeVariableMutabilityFix implements IntentionAction {
|
||||
if (property != null) return property;
|
||||
JetSimpleNameExpression simpleNameExpression = PsiTreeUtil.getParentOfType(elementAtCaret, JetSimpleNameExpression.class);
|
||||
if (simpleNameExpression != null) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
VariableDescriptor descriptor = BindingContextUtils.extractVariableDescriptorIfAny(bindingContext, simpleNameExpression, true);
|
||||
if (descriptor != null) {
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(bindingContext, descriptor);
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
|
||||
@Override
|
||||
public IntentionAction createAction(Diagnostic diagnostic) {
|
||||
JetMultiDeclarationEntry entry = ChangeFunctionReturnTypeFix.getMultiDeclarationEntryThatTypeMismatchComponentFunction(diagnostic);
|
||||
BindingContext context = ResolvePackage.getAnalysisResults(entry.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(entry.getContainingJetFile());
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry);
|
||||
if (resolvedCall == null) return null;
|
||||
JetFunction componentFunction = (JetFunction) BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
@@ -130,7 +130,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
|
||||
|
||||
JetProperty property = QuickFixUtil.getParentElementOfType(diagnostic, JetProperty.class);
|
||||
if (property != null) {
|
||||
BindingContext context = ResolvePackage.getAnalysisResults(property.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(property.getContainingJetFile());
|
||||
JetType lowerBoundOfOverriddenPropertiesTypes = QuickFixUtil.findLowerBoundOfOverriddenCallablesReturnTypes(context, property);
|
||||
|
||||
DeclarationDescriptor descriptor = context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, property);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ChangeVisibilityModifierFix extends JetIntentionAction<JetModifierL
|
||||
}
|
||||
|
||||
private JetKeywordToken findVisibilityChangeTo(JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
DeclarationDescriptor descriptor;
|
||||
if (element instanceof JetParameter) {
|
||||
descriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, element);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class QuickFixFactoryForTypeMismatchError implements JetIntentionActionsF
|
||||
JetExpression expression = diagnosticWithParameters.getPsiElement();
|
||||
JetType expectedType = diagnosticWithParameters.getA();
|
||||
JetType expressionType = diagnosticWithParameters.getB();
|
||||
BindingContext context = ResolvePackage.getAnalysisResults((JetFile) diagnostic.getPsiFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext((JetFile) diagnostic.getPsiFile());
|
||||
|
||||
// We don't want to cast a cast or type-asserted expression:
|
||||
if (!(expression instanceof JetBinaryExpressionWithTypeRHS) && !(expression.getParent() instanceof JetBinaryExpressionWithTypeRHS)) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class QuickFixUtil {
|
||||
public static JetType getDeclarationReturnType(JetNamedDeclaration declaration) {
|
||||
PsiFile file = declaration.getContainingFile();
|
||||
if (!(file instanceof JetFile)) return null;
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults((JetFile) file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext((JetFile) file);
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
|
||||
if (!(descriptor instanceof CallableDescriptor)) return null;
|
||||
JetType type = ((CallableDescriptor) descriptor).getReturnType();
|
||||
@@ -106,7 +106,7 @@ public class QuickFixUtil {
|
||||
|
||||
@Nullable
|
||||
public static JetParameterList getParameterListOfCallee(@NotNull JetCallExpression callExpression) {
|
||||
BindingContext context = ResolvePackage.getAnalysisResults(callExpression.getContainingJetFile()).getBindingContext();
|
||||
BindingContext context = ResolvePackage.getBindingContext(callExpression.getContainingJetFile());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, callExpression.getCalleeExpression());
|
||||
if (resolvedCall == null) return null;
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class RemoveFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
|
||||
@Override
|
||||
protected void invoke(@NotNull Project project, Editor editor, JetFile file) {
|
||||
BindingContext bindingContext = ResolvePackage.getAnalysisResults(file).getBindingContext();
|
||||
BindingContext bindingContext = ResolvePackage.getBindingContext(file);
|
||||
runChangeSignature(project, functionDescriptor, new JetChangeSignatureConfiguration() {
|
||||
@Override
|
||||
public void configure(
|
||||
|
||||
@@ -119,7 +119,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
||||
public TreeElement[] getChildren() {
|
||||
if (myElement instanceof JetFile) {
|
||||
JetFile jetFile = (JetFile) myElement;
|
||||
context = ResolvePackage.getAnalysisResults(jetFile).getBindingContext();
|
||||
context = ResolvePackage.getBindingContext(jetFile);
|
||||
return wrapDeclarations(jetFile.getDeclarations());
|
||||
}
|
||||
else if (myElement instanceof JetClass) {
|
||||
|
||||
Reference in New Issue
Block a user