Minor, removed Contract from deparenthesize
and added some asserts
This commit is contained in:
@@ -2761,7 +2761,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StackValue generateExpressionWithNullFallback(@NotNull JetExpression expression, @NotNull Label ifnull) {
|
private StackValue generateExpressionWithNullFallback(@NotNull JetExpression expression, @NotNull Label ifnull) {
|
||||||
expression = JetPsiUtil.deparenthesize(expression);
|
JetExpression deparenthesized = JetPsiUtil.deparenthesize(expression);
|
||||||
|
assert deparenthesized != null : "Unexpected empty expression";
|
||||||
|
|
||||||
|
expression = deparenthesized;
|
||||||
Type type = expressionType(expression);
|
Type type = expressionType(expression);
|
||||||
|
|
||||||
if (expression instanceof JetSafeQualifiedExpression && !isPrimitive(type)) {
|
if (expression instanceof JetSafeQualifiedExpression && !isPrimitive(type)) {
|
||||||
@@ -2849,6 +2852,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
|
|
||||||
private StackValue generateIn(final StackValue leftValue, JetExpression rangeExpression, final JetSimpleNameExpression operationReference) {
|
private StackValue generateIn(final StackValue leftValue, JetExpression rangeExpression, final JetSimpleNameExpression operationReference) {
|
||||||
final JetExpression deparenthesized = JetPsiUtil.deparenthesize(rangeExpression);
|
final JetExpression deparenthesized = JetPsiUtil.deparenthesize(rangeExpression);
|
||||||
|
|
||||||
|
assert deparenthesized != null : "For with empty range expression";
|
||||||
|
|
||||||
return StackValue.operation(Type.BOOLEAN_TYPE, new Function1<InstructionAdapter, Unit>() {
|
return StackValue.operation(Type.BOOLEAN_TYPE, new Function1<InstructionAdapter, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public Unit invoke(InstructionAdapter v) {
|
public Unit invoke(InstructionAdapter v) {
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class JetPsiUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Contract("!null -> !null")
|
|
||||||
public static JetExpression deparenthesize(@Nullable JetExpression expression) {
|
public static JetExpression deparenthesize(@Nullable JetExpression expression) {
|
||||||
return deparenthesize(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ true);
|
return deparenthesize(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user