From 01826af806d0497473c53a2049edb5f1b65f0206 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Mon, 2 Sep 2013 19:04:57 +0400 Subject: [PATCH] rename: deparenthesizeWithNoTypeResolution -> deparenthesize --- .../org/jetbrains/jet/codegen/RangeCodegenUtil.java | 2 +- .../jet/lang/cfg/JetControlFlowProcessor.java | 6 +++--- .../src/org/jetbrains/jet/lang/psi/JetPsiUtil.java | 12 ++++++------ .../jet/lang/resolve/calls/ArgumentTypeResolver.java | 4 ++-- .../jet/lang/resolve/calls/CandidateResolver.java | 2 +- .../expressions/BasicExpressionTypingVisitor.java | 2 +- .../types/expressions/ExpressionTypingServices.java | 7 ++++--- .../ExpressionTypingVisitorForStatements.java | 5 ++--- .../jet/lang/types/expressions/LabelResolver.java | 2 +- .../org/jetbrains/jet/plugin/util/JetPsiMatcher.java | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/RangeCodegenUtil.java b/compiler/backend/src/org/jetbrains/jet/codegen/RangeCodegenUtil.java index ebb6ad902e0..cc5fdb02932 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/RangeCodegenUtil.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/RangeCodegenUtil.java @@ -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; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 80177d269f4..32004fb26b4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -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); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index 2cd69f28cfa..65c74a9e8e5 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -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 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; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java index 0de68454ffa..630b8e0ca1a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java @@ -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); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index dbeb8e89c32..d711cf4d019 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -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; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java index 7d09caaebea..9f90bbce94d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java @@ -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) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingServices.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingServices.java index 8cfeca61efe..589fe88d41b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingServices.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingServices.java @@ -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() { @Override public Void apply(JetTypeReference reference) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java index 9095103ea46..4a7f4785ff9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java @@ -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; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/LabelResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/LabelResolver.java index b2f6d34cf1b..addbc9957fc 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/LabelResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/LabelResolver.java @@ -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(); } diff --git a/idea/src/org/jetbrains/jet/plugin/util/JetPsiMatcher.java b/idea/src/org/jetbrains/jet/plugin/util/JetPsiMatcher.java index 62fc91e7022..e23bfcb1d25 100644 --- a/idea/src/org/jetbrains/jet/plugin/util/JetPsiMatcher.java +++ b/idea/src/org/jetbrains/jet/plugin/util/JetPsiMatcher.java @@ -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; }