mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fast stub only TypeEvalContext for checking intentions availability and for resolve
This commit is contained in:
+4
-2
@@ -145,10 +145,12 @@ public class ImportFromToImportIntention implements IntentionAction {
|
||||
PyReferenceExpression ref = import_element.getImportReferenceExpression();
|
||||
if (ref != null && ref.isValid()) {
|
||||
PsiElement target = ref.getReference().resolve();
|
||||
if (target instanceof PyExpression && TypeEvalContext.fast().getType((PyExpression)target) instanceof PyModuleType) return false;
|
||||
final TypeEvalContext context = TypeEvalContext.fastStubOnly(file);
|
||||
if (target instanceof PyExpression && context.getType((PyExpression)target) instanceof PyModuleType) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (info.myModuleReference != null) {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class PyDictConstructorToLiteralFormIntention extends BaseIntentionAction
|
||||
PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PyCallExpression.class);
|
||||
|
||||
if (expression != null && expression.isCalleeText("dict")) {
|
||||
final TypeEvalContext context = TypeEvalContext.fast();
|
||||
final TypeEvalContext context = TypeEvalContext.fastStubOnly(file);
|
||||
PyType type = context.getType(expression);
|
||||
if (type != null && type.isBuiltin(context)) {
|
||||
PyExpression[] argumentList = expression.getArguments();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class CallArgumentsMappingImpl implements CallArgumentsMapping {
|
||||
@Nullable TypeEvalContext type_context
|
||||
) {
|
||||
PyExpression[] arguments = myArgumentList.getArguments();
|
||||
if (type_context == null) type_context = TypeEvalContext.fast();
|
||||
if (type_context == null) type_context = TypeEvalContext.fastStubOnly(null);
|
||||
myMarkedCallee = resolved_callee;
|
||||
List<PyExpression> unmatched_args = new LinkedList<PyExpression>();
|
||||
Collections.addAll(unmatched_args, arguments);
|
||||
|
||||
@@ -271,7 +271,7 @@ public class ResolveImportUtil {
|
||||
dir = (PsiDirectory)parent;
|
||||
}
|
||||
else if (parent != null) {
|
||||
PyType refType = PyReferenceExpressionImpl.getReferenceTypeFromProviders(parent, TypeEvalContext.fast(), null);
|
||||
PyType refType = PyReferenceExpressionImpl.getReferenceTypeFromProviders(parent, TypeEvalContext.fastStubOnly(null), null);
|
||||
if (refType != null) {
|
||||
final List<? extends RatedResolveResult> result = refType.resolveMember(referencedName, null, AccessDirection.READ,
|
||||
PyResolveContext.defaultContext());
|
||||
|
||||
Reference in New Issue
Block a user