rename deparenthesize -> deparenthesizeWithNoTypeResolution
This commit is contained in:
@@ -56,7 +56,7 @@ public class RangeCodegenUtil {
|
|||||||
// Other binary operations will succeed too, but will be filtered out later (by examining a resolvedCall)
|
// Other binary operations will succeed too, but will be filtered out later (by examining a resolvedCall)
|
||||||
JetExpression rangeExpression = forExpression.getLoopRange();
|
JetExpression rangeExpression = forExpression.getLoopRange();
|
||||||
assert rangeExpression != null;
|
assert rangeExpression != null;
|
||||||
JetExpression loopRange = JetPsiUtil.deparenthesize(rangeExpression);
|
JetExpression loopRange = JetPsiUtil.deparenthesizeWithNoTypeResolution(rangeExpression);
|
||||||
if (loopRange instanceof JetQualifiedExpression) {
|
if (loopRange instanceof JetQualifiedExpression) {
|
||||||
// a.rangeTo(b)
|
// a.rangeTo(b)
|
||||||
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) loopRange;
|
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) loopRange;
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
|
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
|
||||||
JetExpression deparenthesized = JetPsiUtil.deparenthesize(labeledExpression);
|
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
||||||
if (deparenthesized != null) {
|
if (deparenthesized != null) {
|
||||||
value(labeledExpression, inCondition);
|
value(labeledExpression, inCondition);
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (operationType == JetTokens.EQ) {
|
else if (operationType == JetTokens.EQ) {
|
||||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, false);
|
value(right, false);
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
||||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
if (left != null) {
|
if (left != null) {
|
||||||
value(left, false);
|
value(left, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class JetPsiUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JetExpression deparenthesize(@NotNull JetExpression expression) {
|
public static JetExpression deparenthesizeWithNoTypeResolution(@NotNull JetExpression expression) {
|
||||||
if (expression instanceof JetBinaryExpressionWithTypeRHS) {
|
if (expression instanceof JetBinaryExpressionWithTypeRHS) {
|
||||||
JetSimpleNameExpression operationSign = ((JetBinaryExpressionWithTypeRHS) expression).getOperationSign();
|
JetSimpleNameExpression operationSign = ((JetBinaryExpressionWithTypeRHS) expression).getOperationSign();
|
||||||
if (JetTokens.COLON.equals(operationSign.getReferencedNameElementType())) {
|
if (JetTokens.COLON.equals(operationSign.getReferencedNameElementType())) {
|
||||||
@@ -68,7 +68,7 @@ public class JetPsiUtil {
|
|||||||
}
|
}
|
||||||
if (expression instanceof JetParenthesizedExpression) {
|
if (expression instanceof JetParenthesizedExpression) {
|
||||||
JetExpression innerExpression = ((JetParenthesizedExpression) expression).getExpression();
|
JetExpression innerExpression = ((JetParenthesizedExpression) expression).getExpression();
|
||||||
return innerExpression != null ? deparenthesize(innerExpression) : null;
|
return innerExpression != null ? deparenthesizeWithNoTypeResolution(innerExpression) : null;
|
||||||
}
|
}
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ public class JetPsiUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNullConstant(@NotNull JetExpression expression) {
|
public static boolean isNullConstant(@NotNull JetExpression expression) {
|
||||||
JetExpression deparenthesized = deparenthesize(expression);
|
JetExpression deparenthesized = deparenthesizeWithNoTypeResolution(expression);
|
||||||
return deparenthesized instanceof JetConstantExpression && deparenthesized.getNode().getElementType() == JetNodeTypes.NULL;
|
return deparenthesized instanceof JetConstantExpression && deparenthesized.getNode().getElementType() == JetNodeTypes.NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1039,7 +1039,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkLValue(BindingTrace trace, JetExpression expressionWithParenthesis, boolean canBeThis) {
|
private void checkLValue(BindingTrace trace, JetExpression expressionWithParenthesis, boolean canBeThis) {
|
||||||
JetExpression expression = JetPsiUtil.deparenthesize(expressionWithParenthesis);
|
JetExpression expression = JetPsiUtil.deparenthesizeWithNoTypeResolution(expressionWithParenthesis);
|
||||||
if (expression instanceof JetArrayAccessExpression) {
|
if (expression instanceof JetArrayAccessExpression) {
|
||||||
checkLValue(trace, ((JetArrayAccessExpression) expression).getArrayExpression(), true);
|
checkLValue(trace, ((JetArrayAccessExpression) expression).getArrayExpression(), true);
|
||||||
return;
|
return;
|
||||||
|
|||||||
+2
-2
@@ -202,7 +202,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
JetType leftType = facade.getTypeInfo(expression.getLeft(), context).getType();
|
JetType leftType = facade.getTypeInfo(expression.getLeft(), context).getType();
|
||||||
|
|
||||||
JetExpression right = expression.getRight();
|
JetExpression right = expression.getRight();
|
||||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
if (right == null || left == null) {
|
if (right == null || left == null) {
|
||||||
temporaryBindingTrace.commit();
|
temporaryBindingTrace.commit();
|
||||||
return null;
|
return null;
|
||||||
@@ -262,7 +262,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
|
|
||||||
protected JetType visitAssignment(JetBinaryExpression expression, ExpressionTypingContext contextWithExpectedType) {
|
protected JetType visitAssignment(JetBinaryExpression expression, ExpressionTypingContext contextWithExpectedType) {
|
||||||
ExpressionTypingContext context = contextWithExpectedType.replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE);
|
ExpressionTypingContext context = contextWithExpectedType.replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE);
|
||||||
JetExpression left = JetPsiUtil.deparenthesize(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
JetExpression right = expression.getRight();
|
JetExpression right = expression.getRight();
|
||||||
if (left instanceof JetArrayAccessExpression) {
|
if (left instanceof JetArrayAccessExpression) {
|
||||||
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
|
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class LabelResolver {
|
|||||||
public LabelResolver() {}
|
public LabelResolver() {}
|
||||||
|
|
||||||
public void enterLabeledElement(@NotNull LabelName labelName, @NotNull JetExpression labeledExpression) {
|
public void enterLabeledElement(@NotNull LabelName labelName, @NotNull JetExpression labeledExpression) {
|
||||||
JetExpression deparenthesized = JetPsiUtil.deparenthesize(labeledExpression);
|
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
||||||
if (deparenthesized != null) {
|
if (deparenthesized != null) {
|
||||||
Stack<JetElement> stack = labeledElements.get(labelName);
|
Stack<JetElement> stack = labeledElements.get(labelName);
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
@@ -53,7 +53,7 @@ public class LabelResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void exitLabeledElement(@NotNull JetExpression expression) {
|
public void exitLabeledElement(@NotNull JetExpression expression) {
|
||||||
JetExpression deparenthesized = JetPsiUtil.deparenthesize(expression);
|
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression);
|
||||||
// TODO : really suboptimal
|
// TODO : really suboptimal
|
||||||
for (Iterator<Map.Entry<LabelName,Stack<JetElement>>> mapIter = labeledElements.entrySet().iterator(); mapIter.hasNext(); ) {
|
for (Iterator<Map.Entry<LabelName,Stack<JetElement>>> mapIter = labeledElements.entrySet().iterator(); mapIter.hasNext(); ) {
|
||||||
Map.Entry<LabelName, Stack<JetElement>> entry = mapIter.next();
|
Map.Entry<LabelName, Stack<JetElement>> entry = mapIter.next();
|
||||||
|
|||||||
Reference in New Issue
Block a user