rename: deparenthesizeWithNoTypeResolution -> deparenthesize
This commit is contained in:
@@ -63,7 +63,7 @@ public class RangeCodegenUtil {
|
||||
// Other binary operations will succeed too, but will be filtered out later (by examining a resolvedCall)
|
||||
JetExpression rangeExpression = forExpression.getLoopRange();
|
||||
assert rangeExpression != null;
|
||||
JetExpression loopRange = JetPsiUtil.deparenthesizeWithNoTypeResolution(rangeExpression);
|
||||
JetExpression loopRange = JetPsiUtil.deparenthesize(rangeExpression);
|
||||
if (loopRange instanceof JetQualifiedExpression) {
|
||||
// a.rangeTo(b)
|
||||
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) loopRange;
|
||||
|
||||
@@ -181,7 +181,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
|
||||
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
||||
JetExpression deparenthesized = JetPsiUtil.deparenthesize(labeledExpression);
|
||||
if (deparenthesized != null) {
|
||||
generateInstructions(labeledExpression, inCondition);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
}
|
||||
else if (operationType == JetTokens.EQ) {
|
||||
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
||||
if (right != null) {
|
||||
generateInstructions(right, false);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
}
|
||||
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
||||
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
||||
if (left != null) {
|
||||
generateInstructions(left, false);
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ public class JetPsiUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetExpression deparenthesizeWithNoTypeResolution(@NotNull JetExpression expression) {
|
||||
return deparenthesizeWithNoTypeResolution(expression, true);
|
||||
public static JetExpression deparenthesize(@NotNull JetExpression expression) {
|
||||
return deparenthesize(expression, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetExpression deparenthesizeWithNoTypeResolution(
|
||||
public static JetExpression deparenthesize(
|
||||
@NotNull JetExpression expression,
|
||||
boolean deparenthesizeBinaryExpressionWithTypeRHS
|
||||
) {
|
||||
@@ -78,9 +78,9 @@ public class JetPsiUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Deprecated //Use JetPsiUtil.deparenthesizeWithNoTypeResolution() or ExpressionTypingServices.deparenthesize()
|
||||
@Deprecated //Use JetPsiUtil.deparenthesize() or ExpressionTypingServices.deparenthesize()
|
||||
public static JetExpression deparenthesizeWithResolutionStrategy(
|
||||
@NotNull JetExpression expression,
|
||||
@Nullable JetExpression expression,
|
||||
boolean deparenthesizeBinaryExpressionWithTypeRHS,
|
||||
@Nullable Function<JetTypeReference, Void> typeResolutionStrategy
|
||||
) {
|
||||
@@ -504,7 +504,7 @@ public class JetPsiUtil {
|
||||
}
|
||||
|
||||
public static boolean isNullConstant(@NotNull JetExpression expression) {
|
||||
JetExpression deparenthesized = deparenthesizeWithNoTypeResolution(expression);
|
||||
JetExpression deparenthesized = deparenthesize(expression);
|
||||
return deparenthesized instanceof JetConstantExpression && deparenthesized.getNode().getElementType() == JetNodeTypes.NULL;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ public class ArgumentTypeResolver {
|
||||
if (expression == null) {
|
||||
return JetTypeInfo.create(null, context.dataFlowInfo);
|
||||
}
|
||||
JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesizeWithNoTypeResolution(JetPsiUtil.unwrapFromBlock(expression), false);
|
||||
JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesize(JetPsiUtil.unwrapFromBlock(expression), false);
|
||||
if (deparenthesizedExpression instanceof JetFunctionLiteralExpression) {
|
||||
return getFunctionLiteralTypeInfo(expression, (JetFunctionLiteralExpression) deparenthesizedExpression, context, resolveArgumentsMode);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ public class ArgumentTypeResolver {
|
||||
BindingContextUtils.updateRecordedType(numberType, expression, context.trace, false);
|
||||
|
||||
if (!(expression instanceof JetConstantExpression)) {
|
||||
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression, false);
|
||||
JetExpression deparenthesized = JetPsiUtil.deparenthesize(expression, false);
|
||||
if (deparenthesized != expression) {
|
||||
updateNumberType(numberType, deparenthesized, context);
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public class CandidateResolver {
|
||||
) {
|
||||
JetExpression argumentExpression = valueArgument.getArgumentExpression();
|
||||
if (argumentExpression == null) return;
|
||||
JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesizeWithNoTypeResolution(
|
||||
JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesize(
|
||||
JetPsiUtil.unwrapFromBlock(argumentExpression), false);
|
||||
if (!(deparenthesizedExpression instanceof JetFunctionLiteralExpression)) return;
|
||||
JetFunctionLiteralExpression functionLiteralExpression = (JetFunctionLiteralExpression) deparenthesizedExpression;
|
||||
|
||||
+1
-1
@@ -864,7 +864,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
private static void checkLValue(@NotNull BindingTrace trace, @NotNull JetExpression expressionWithParenthesis, boolean canBeThis) {
|
||||
JetExpression expression = JetPsiUtil.deparenthesizeWithNoTypeResolution(expressionWithParenthesis);
|
||||
JetExpression expression = JetPsiUtil.deparenthesize(expressionWithParenthesis);
|
||||
if (expression instanceof JetArrayAccessExpression) {
|
||||
JetExpression arrayExpression = ((JetArrayAccessExpression) expression).getArrayExpression();
|
||||
if (arrayExpression != null) {
|
||||
|
||||
+4
-3
@@ -324,9 +324,10 @@ public class ExpressionTypingServices {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetExpression deparenthesize(
|
||||
@NotNull JetExpression expression,
|
||||
@NotNull final ExpressionTypingContext context) {
|
||||
public JetExpression deparenthesizeWithTypeResolution(
|
||||
@Nullable JetExpression expression,
|
||||
@NotNull final ExpressionTypingContext context
|
||||
) {
|
||||
return JetPsiUtil.deparenthesizeWithResolutionStrategy(expression, true, new Function<JetTypeReference, Void>() {
|
||||
@Override
|
||||
public Void apply(JetTypeReference reference) {
|
||||
|
||||
+2
-3
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.resolve.ModifiersChecker;
|
||||
import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.ContextDependency;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.TemporaryTraceAndCache;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
||||
@@ -228,7 +227,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
DataFlowInfo dataFlowInfo = leftInfo.getDataFlowInfo();
|
||||
|
||||
JetExpression right = expression.getRight();
|
||||
JetExpression left = leftOperand == null ? null : JetPsiUtil.deparenthesizeWithNoTypeResolution(leftOperand);
|
||||
JetExpression left = leftOperand == null ? null : JetPsiUtil.deparenthesize(leftOperand);
|
||||
if (right == null || left == null) {
|
||||
temporary.commit();
|
||||
return JetTypeInfo.create(null, dataFlowInfo);
|
||||
@@ -300,7 +299,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
ExpressionTypingContext context =
|
||||
contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(scope).replaceContextDependency(INDEPENDENT);
|
||||
JetExpression leftOperand = expression.getLeft();
|
||||
JetExpression left = leftOperand == null ? null : context.expressionTypingServices.deparenthesize(leftOperand, context);
|
||||
JetExpression left = context.expressionTypingServices.deparenthesizeWithTypeResolution(leftOperand, context);
|
||||
JetExpression right = expression.getRight();
|
||||
if (left instanceof JetArrayAccessExpression) {
|
||||
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class LabelResolver {
|
||||
|
||||
@NotNull
|
||||
private JetExpression getCachingExpression(@NotNull JetExpression labeledExpression) {
|
||||
JetExpression expression = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
||||
JetExpression expression = JetPsiUtil.deparenthesize(labeledExpression);
|
||||
if (expression instanceof JetFunctionLiteralExpression) {
|
||||
expression = ((JetFunctionLiteralExpression) expression).getFunctionLiteral();
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public class JetPsiMatcher {
|
||||
|
||||
private static JetElement unwrap(JetElement e) {
|
||||
if (e instanceof JetExpression) {
|
||||
return JetPsiUtil.deparenthesizeWithNoTypeResolution((JetExpression) e);
|
||||
return JetPsiUtil.deparenthesize((JetExpression) e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user