Rename: deparenthesizeArgument -> getLastElementDeparenthesized
This commit is contained in:
@@ -148,7 +148,7 @@ public class ArgumentTypeResolver {
|
|||||||
private static JetFunctionLiteralExpression getFunctionLiteralArgumentIfAny(
|
private static JetFunctionLiteralExpression getFunctionLiteralArgumentIfAny(
|
||||||
@NotNull JetExpression expression, @NotNull ResolutionContext context
|
@NotNull JetExpression expression, @NotNull ResolutionContext context
|
||||||
) {
|
) {
|
||||||
JetExpression deparenthesizedExpression = deparenthesizeArgument(expression, context);
|
JetExpression deparenthesizedExpression = getLastElementDeparenthesized(expression, context);
|
||||||
if (deparenthesizedExpression instanceof JetFunctionLiteralExpression) {
|
if (deparenthesizedExpression instanceof JetFunctionLiteralExpression) {
|
||||||
return (JetFunctionLiteralExpression) deparenthesizedExpression;
|
return (JetFunctionLiteralExpression) deparenthesizedExpression;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ public class ArgumentTypeResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JetExpression deparenthesizeArgument(
|
public static JetExpression getLastElementDeparenthesized(
|
||||||
@Nullable JetExpression expression,
|
@Nullable JetExpression expression,
|
||||||
@NotNull ResolutionContext context
|
@NotNull ResolutionContext context
|
||||||
) {
|
) {
|
||||||
@@ -169,7 +169,7 @@ public class ArgumentTypeResolver {
|
|||||||
// (no arguments and no receiver) and therefore analyze them straight away (not in the 'complete' phase).
|
// (no arguments and no receiver) and therefore analyze them straight away (not in the 'complete' phase).
|
||||||
JetElement lastStatementInABlock = ResolvePackage.getLastStatementInABlock(context.partialBodyResolveProvider, blockExpression);
|
JetElement lastStatementInABlock = ResolvePackage.getLastStatementInABlock(context.partialBodyResolveProvider, blockExpression);
|
||||||
if (lastStatementInABlock instanceof JetExpression) {
|
if (lastStatementInABlock instanceof JetExpression) {
|
||||||
return deparenthesizeArgument((JetExpression) lastStatementInABlock, context);
|
return getLastElementDeparenthesized((JetExpression) lastStatementInABlock, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return deparenthesizedExpression;
|
return deparenthesizedExpression;
|
||||||
@@ -291,7 +291,7 @@ public class ArgumentTypeResolver {
|
|||||||
BindingContextUtils.updateRecordedType(numberType, expression, context.trace, false);
|
BindingContextUtils.updateRecordedType(numberType, expression, context.trace, false);
|
||||||
|
|
||||||
if (!(expression instanceof JetConstantExpression)) {
|
if (!(expression instanceof JetConstantExpression)) {
|
||||||
JetExpression deparenthesized = deparenthesizeArgument(expression, context);
|
JetExpression deparenthesized = getLastElementDeparenthesized(expression, context);
|
||||||
if (deparenthesized != expression) {
|
if (deparenthesized != expression) {
|
||||||
updateNumberType(numberType, deparenthesized, context);
|
updateNumberType(numberType, deparenthesized, context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class CallCompleter(
|
|||||||
if (valueArgument.isExternal()) return
|
if (valueArgument.isExternal()) return
|
||||||
|
|
||||||
val expression = valueArgument.getArgumentExpression()
|
val expression = valueArgument.getArgumentExpression()
|
||||||
val deparenthesized = ArgumentTypeResolver.deparenthesizeArgument(expression, context as ResolutionContext<*>)
|
val deparenthesized = ArgumentTypeResolver.getLastElementDeparenthesized(expression, context as ResolutionContext<*>)
|
||||||
if (deparenthesized == null) return
|
if (deparenthesized == null) return
|
||||||
|
|
||||||
val recordedType = context.trace[BindingContext.EXPRESSION_TYPE, expression]
|
val recordedType = context.trace[BindingContext.EXPRESSION_TYPE, expression]
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.diagnostics.Errors.PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT;
|
import static org.jetbrains.kotlin.diagnostics.Errors.PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT;
|
||||||
import static org.jetbrains.kotlin.diagnostics.Errors.SUPER_CANT_BE_EXTENSION_RECEIVER;
|
import static org.jetbrains.kotlin.diagnostics.Errors.SUPER_CANT_BE_EXTENSION_RECEIVER;
|
||||||
import static org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver.deparenthesizeArgument;
|
import static org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver.getLastElementDeparenthesized;
|
||||||
import static org.jetbrains.kotlin.resolve.calls.CallResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
|
import static org.jetbrains.kotlin.resolve.calls.CallResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
|
||||||
import static org.jetbrains.kotlin.resolve.calls.CallResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
|
import static org.jetbrains.kotlin.resolve.calls.CallResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
|
||||||
import static org.jetbrains.kotlin.resolve.calls.CallTransformer.CallForImplicitInvoke;
|
import static org.jetbrains.kotlin.resolve.calls.CallTransformer.CallForImplicitInvoke;
|
||||||
@@ -436,7 +436,7 @@ public class CandidateResolver {
|
|||||||
@Nullable JetExpression argumentExpression,
|
@Nullable JetExpression argumentExpression,
|
||||||
@NotNull ResolutionContext context
|
@NotNull ResolutionContext context
|
||||||
) {
|
) {
|
||||||
JetExpression deparenthesizedArgument = deparenthesizeArgument(argumentExpression, context);
|
JetExpression deparenthesizedArgument = getLastElementDeparenthesized(argumentExpression, context);
|
||||||
if (deparenthesizedArgument == null || type == null) return type;
|
if (deparenthesizedArgument == null || type == null) return type;
|
||||||
|
|
||||||
DataFlowValue dataFlowValue = DataFlowValueFactory.createDataFlowValue(deparenthesizedArgument, type, context.trace.getBindingContext());
|
DataFlowValue dataFlowValue = DataFlowValueFactory.createDataFlowValue(deparenthesizedArgument, type, context.trace.getBindingContext());
|
||||||
|
|||||||
Reference in New Issue
Block a user