mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-17 20:11:25 +07:00
[pycharm] restrict analysis in order to improve completion performance
GitOrigin-RevId: 1c2427d1dbb07d88672347311ec5d6f362881847
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2eff1b56c4
commit
1aaaf77781
@@ -87,9 +87,9 @@ public final class PyDefUseUtil {
|
||||
return ControlFlowUtil.Operation.CONTINUE;
|
||||
}
|
||||
// not a back edge
|
||||
if (instruction.num() < startNum && context.getOrigin() != null) {
|
||||
// switch back to code analysis, since all other analyses are too aggressive
|
||||
var newContext = TypeEvalContext.codeAnalysis(context.getOrigin().getProject(), context.getOrigin());
|
||||
if (instruction.num() < startNum && context.getOrigin() == callInstruction.getElement().getContainingFile()) {
|
||||
var newContext = TypeEvalContext.codeAnalysis(context.getOrigin().getProject(),
|
||||
context.getOrigin());
|
||||
if (callInstruction.isNoReturnCall(newContext)) return ControlFlowUtil.Operation.CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -98,9 +98,9 @@ public final class PyDefUseUtil {
|
||||
if (acceptTypeAssertions
|
||||
&& instruction instanceof ConditionalInstruction conditionalInstruction
|
||||
&& instruction.num() < startNum) {
|
||||
if (conditionalInstruction.getCondition() instanceof PyTypedElement typedElement && context.getOrigin() != null) {
|
||||
// switch back to code analysis, since all other analyses are too aggressive
|
||||
TypeEvalContext newContext = TypeEvalContext.codeAnalysis(context.getOrigin().getProject(), context.getOrigin());
|
||||
if (conditionalInstruction.getCondition() instanceof PyTypedElement typedElement && context.getOrigin() == typedElement.getContainingFile()) {
|
||||
var newContext = TypeEvalContext.codeAnalysis(context.getOrigin().getProject(),
|
||||
context.getOrigin());
|
||||
if (newContext.getType(typedElement) instanceof PyNarrowedType narrowedType) {
|
||||
if (narrowedType.getQname().equals(varName)) {
|
||||
pendingTypeGuard.put(narrowedType.getOriginal(), conditionalInstruction);
|
||||
|
||||
Reference in New Issue
Block a user