org.jetbrains.jet.lang.types.expressions
Class ExpressionTypingUtils
java.lang.Object
org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils
public class ExpressionTypingUtils
- extends java.lang.Object
|
Method Summary |
static void |
checkCapturingInClosure(JetSimpleNameExpression expression,
BindingTrace trace,
JetScope scope)
|
static boolean |
checkIsExtensionCallable(ReceiverValue receiverArgument,
CallableDescriptor callableDescriptor,
boolean isInfixCall,
BindingContext bindingContext,
DataFlowInfo dataFlowInfo)
|
static void |
checkVariableShadowing(ExpressionTypingContext context,
VariableDescriptor variableDescriptor,
VariableDescriptor oldDescriptor)
|
static JetExpression |
createFakeExpressionOfType(com.intellij.openapi.project.Project project,
BindingTrace trace,
java.lang.String argumentName,
JetType argumentType)
|
void |
defineLocalVariablesFromMultiDeclaration(WritableScope writableScope,
JetMultiDeclaration multiDeclaration,
ReceiverValue receiver,
JetExpression reportErrorsOn,
ExpressionTypingContext context)
|
static boolean |
dependsOnExpectedType(JetExpression expression)
|
static boolean |
ensureBooleanResult(JetExpression operationSign,
Name name,
JetType resultType,
ExpressionTypingContext context)
|
static boolean |
ensureBooleanResultWithCustomSubject(JetExpression operationSign,
JetType resultType,
java.lang.String subjectName,
ExpressionTypingContext context)
|
static JetType |
getDefaultType(com.intellij.psi.tree.IElementType constantType)
|
protected static ExpressionReceiver |
getExpressionReceiver(ExpressionTypingFacade facade,
JetExpression expression,
ExpressionTypingContext context)
|
protected static ExpressionReceiver |
getExpressionReceiver(JetExpression expression,
JetType type)
|
static JetTypeInfo |
getTypeInfoOrNullType(JetExpression expression,
ExpressionTypingContext context,
org.jetbrains.jet.lang.types.expressions.ExpressionTypingInternals facade)
|
static java.util.List<JetType> |
getValueParametersTypes(java.util.List<ValueParameterDescriptor> valueParameters)
|
static boolean |
isBinaryExpressionDependentOnExpectedType(JetBinaryExpression expression)
|
static boolean |
isBoolean(JetType type)
|
static boolean |
isLocal(DeclarationDescriptor containerOfTheCurrentLocality,
DeclarationDescriptor candidate)
The primary case for local extensions is the following:
I had a locally declared extension function or a local variable of function type called foo
And I called it on my x
Now, someone added function foo() to the class of x
My code should not change
thus
local extension prevail over members (and members prevail over all non-local extensions) |
static boolean |
isUnaryExpressionDependentOnExpectedType(JetUnaryExpression expression)
|
com.intellij.openapi.util.Pair<Call,OverloadResolutionResults<FunctionDescriptor>> |
makeAndResolveFakeCall(ReceiverValue receiver,
ExpressionTypingContext context,
java.util.List<JetExpression> valueArguments,
Name name)
|
static ObservableBindingTrace |
makeTraceInterceptingTypeMismatch(BindingTrace trace,
JetElement expressionToWatch,
boolean[] mismatchFound)
|
static WritableScopeImpl |
newWritableScopeImpl(ExpressionTypingContext context,
java.lang.String scopeDebugName)
|
OverloadResolutionResults<FunctionDescriptor> |
resolveFakeCall(ExpressionTypingContext context,
ReceiverValue receiver,
Name name)
|
OverloadResolutionResults<FunctionDescriptor> |
resolveFakeCall(ExpressionTypingContext context,
ReceiverValue receiver,
Name name,
JetType... argumentTypes)
|
OverloadResolutionResults<FunctionDescriptor> |
resolveFakeCall(ReceiverValue receiver,
ExpressionTypingContext context,
java.util.List<JetExpression> valueArguments,
Name name)
|
protected static ExpressionReceiver |
safeGetExpressionReceiver(ExpressionTypingFacade facade,
JetExpression expression,
ExpressionTypingContext context)
|
static JetType |
safeGetType(JetTypeInfo typeInfo)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExpressionTypingUtils
public ExpressionTypingUtils(@NotNull
ExpressionTypingServices expressionTypingServices,
@NotNull
CallResolver resolver)
getExpressionReceiver
@Nullable
protected static ExpressionReceiver getExpressionReceiver(@NotNull
JetExpression expression,
@Nullable
JetType type)
getExpressionReceiver
@Nullable
protected static ExpressionReceiver getExpressionReceiver(@NotNull
ExpressionTypingFacade facade,
@NotNull
JetExpression expression,
ExpressionTypingContext context)
safeGetExpressionReceiver
@NotNull
protected static ExpressionReceiver safeGetExpressionReceiver(@NotNull
ExpressionTypingFacade facade,
@NotNull
JetExpression expression,
ExpressionTypingContext context)
safeGetType
@NotNull
public static JetType safeGetType(@NotNull
JetTypeInfo typeInfo)
newWritableScopeImpl
@NotNull
public static WritableScopeImpl newWritableScopeImpl(ExpressionTypingContext context,
@NotNull
java.lang.String scopeDebugName)
isBoolean
public static boolean isBoolean(@NotNull
JetType type)
ensureBooleanResult
public static boolean ensureBooleanResult(JetExpression operationSign,
Name name,
JetType resultType,
ExpressionTypingContext context)
ensureBooleanResultWithCustomSubject
public static boolean ensureBooleanResultWithCustomSubject(JetExpression operationSign,
JetType resultType,
java.lang.String subjectName,
ExpressionTypingContext context)
getDefaultType
@NotNull
public static JetType getDefaultType(com.intellij.psi.tree.IElementType constantType)
checkCapturingInClosure
public static void checkCapturingInClosure(JetSimpleNameExpression expression,
BindingTrace trace,
JetScope scope)
checkIsExtensionCallable
public static boolean checkIsExtensionCallable(@NotNull
ReceiverValue receiverArgument,
@NotNull
CallableDescriptor callableDescriptor,
boolean isInfixCall,
@NotNull
BindingContext bindingContext,
@NotNull
DataFlowInfo dataFlowInfo)
resolveFakeCall
@NotNull
public OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(@NotNull
ExpressionTypingContext context,
@NotNull
ReceiverValue receiver,
@NotNull
Name name,
@NotNull
JetType... argumentTypes)
createFakeExpressionOfType
public static JetExpression createFakeExpressionOfType(@NotNull
com.intellij.openapi.project.Project project,
@NotNull
BindingTrace trace,
@NotNull
java.lang.String argumentName,
@NotNull
JetType argumentType)
resolveFakeCall
@NotNull
public OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(@NotNull
ExpressionTypingContext context,
@NotNull
ReceiverValue receiver,
@NotNull
Name name)
resolveFakeCall
@NotNull
public OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(@NotNull
ReceiverValue receiver,
@NotNull
ExpressionTypingContext context,
@NotNull
java.util.List<JetExpression> valueArguments,
@NotNull
Name name)
makeAndResolveFakeCall
@NotNull
public com.intellij.openapi.util.Pair<Call,OverloadResolutionResults<FunctionDescriptor>> makeAndResolveFakeCall(@NotNull
ReceiverValue receiver,
@NotNull
ExpressionTypingContext context,
@NotNull
java.util.List<JetExpression> valueArguments,
@NotNull
Name name)
defineLocalVariablesFromMultiDeclaration
public void defineLocalVariablesFromMultiDeclaration(@NotNull
WritableScope writableScope,
@NotNull
JetMultiDeclaration multiDeclaration,
@NotNull
ReceiverValue receiver,
@NotNull
JetExpression reportErrorsOn,
@NotNull
ExpressionTypingContext context)
checkVariableShadowing
public static void checkVariableShadowing(@NotNull
ExpressionTypingContext context,
@NotNull
VariableDescriptor variableDescriptor,
VariableDescriptor oldDescriptor)
makeTraceInterceptingTypeMismatch
public static ObservableBindingTrace makeTraceInterceptingTypeMismatch(@NotNull
BindingTrace trace,
@NotNull
JetElement expressionToWatch,
@NotNull
boolean[] mismatchFound)
getTypeInfoOrNullType
@NotNull
public static JetTypeInfo getTypeInfoOrNullType(@Nullable
JetExpression expression,
@NotNull
ExpressionTypingContext context,
@NotNull
org.jetbrains.jet.lang.types.expressions.ExpressionTypingInternals facade)
isBinaryExpressionDependentOnExpectedType
public static boolean isBinaryExpressionDependentOnExpectedType(@NotNull
JetBinaryExpression expression)
isUnaryExpressionDependentOnExpectedType
public static boolean isUnaryExpressionDependentOnExpectedType(@NotNull
JetUnaryExpression expression)
getValueParametersTypes
@NotNull
public static java.util.List<JetType> getValueParametersTypes(@NotNull
java.util.List<ValueParameterDescriptor> valueParameters)
isLocal
public static boolean isLocal(DeclarationDescriptor containerOfTheCurrentLocality,
DeclarationDescriptor candidate)
- The primary case for local extensions is the following:
I had a locally declared extension function or a local variable of function type called foo
And I called it on my x
Now, someone added function foo() to the class of x
My code should not change
thus
local extension prevail over members (and members prevail over all non-local extensions)
dependsOnExpectedType
public static boolean dependsOnExpectedType(@Nullable
JetExpression expression)