Make creating resolve context with explicit type eval context shorter

GitOrigin-RevId: 7dce0f1869ca114d729f8368273291940eda21ef
This commit is contained in:
Semyon Proshev
2021-06-11 18:56:40 +03:00
committed by intellij-monorepo-bot
parent ee5a2bf513
commit 7b8b5bb12f
65 changed files with 118 additions and 100 deletions

View File

@@ -45,6 +45,11 @@ public final class PyResolveContext {
return ourDefaultContext;
}
@NotNull
public static PyResolveContext defaultContext(@NotNull TypeEvalContext context) {
return ourDefaultContext.withTypeEvalContext(context);
}
/**
* Allow searching for dynamic usages based on duck typing and guesses during resolve.
*
@@ -55,11 +60,26 @@ public final class PyResolveContext {
return ourImplicitsContext;
}
/**
* Allow searching for dynamic usages based on duck typing and guesses during resolve.
*
* Note that this resolve context is slower than the default one. Use it only for one-off user actions.
*/
@NotNull
public static PyResolveContext implicitContext(@NotNull TypeEvalContext context) {
return ourImplicitsContext.withTypeEvalContext(context);
}
@NotNull
public static PyResolveContext noProperties() {
return ourNoPropertiesContext;
}
@NotNull
public static PyResolveContext noProperties(@NotNull TypeEvalContext context) {
return ourNoPropertiesContext.withTypeEvalContext(context);
}
@NotNull
public PyResolveContext withTypeEvalContext(@NotNull TypeEvalContext context) {
return new PyResolveContext(myAllowImplicits, myAllowProperties, myAllowRemote, context);