AnalysisStartingPoint (@NotNull PsiElement expression, @NotNull DfType origType) { AnalysisStartingPoint analysis = null; if (origType == DfTypes.TRUE) { analysis = fromCondition((PsiExpression)expression); } else if (origType == DfTypes.FALSE) { analysis = tryNegate(fromCondition((PsiExpression)expression)); } DfIntegralType dfType = ObjectUtils.tryCast(origType, DfIntegralType.class); if (dfType != null) { LongRangeType lrType = dfType.getLongRangeType(); LongRangeSet origRange = dfType.getRange(); LongRangeSet newRange = null; PsiExpression anchor = null; if (expression instanceof PsiPrefixExpression) { anchor = ((PsiPrefixExpression)expression).getOperand(); IElementType type = ((PsiPrefixExpression)expression).getOperationTokenType(); if (type.equals(JavaTokenType.MINUS)) { newRange = origRange.negate(lrType); } else if (type.equals(JavaTokenType.TILDE)) { newRange = origRange.negate(lrType).minus(LongRangeSet.point(1), lrType); } } if (expression instanceof PsiBinaryExpression binOp) { IElementType type = binOp.getOperationTokenType(); LongRangeSet leftRange = CommonDataflow.getExpressionRange(binOp.getLOperand()); LongRangeSet rightRange = CommonDataflow.getExpressionRange(binOp.getROperand()); Long left = leftRange == null ? null : leftRange.getConstantValue(); Long right = rightRange == null ? null : rightRange.getConstantValue(); if (type.equals(JavaTokenType.PERC)) { if (right != null) { newRange = LongRangeSet.fromRemainder(right, origRange); anchor = binOp.getLOperand(); } } if (type.equals(JavaTokenType.PLUS)) { if (right != null) { newRange = origRange.minus(LongRangeSet.point(right), lrType); anchor = binOp.getLOperand(); } else if (left != null) { newRange = origRange.minus(LongRangeSet.point(left), lrType); anchor = binOp.getROperand(); } } if (type.equals(JavaTokenType.MINUS)) { if (right != null) { newRange = origRange.plus(LongRangeSet.point(right), lrType); anchor = binOp.getLOperand(); } else if (left != null) { newRange = LongRangeSet.point(left).minus(origRange, lrType); anchor = binOp.getROperand(); } } } if (newRange != null && anchor != null && !(anchor instanceof PsiLiteralExpression)) { analysis = new AnalysisStartingPoint(DfTypes.rangeClamped(newRange, lrType), anchor); } } return analysis; }