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