private ContractReturnValue getDefaultReturnValue(List<LighterASTNode> statements) {
    class ReturnValueVisitor extends RecursiveLighterASTNodeWalkingVisitor {
      public ContractReturnValue returnValue = fail();

      private BitSet assignedParameters;

      ReturnValueVisitor() {
        super(myTree);
      }

      @Override
      public void visitNode(@NotNull LighterASTNode element) {
        IElementType type = element.getTokenType();
        if (type == CLASS || type == LAMBDA_EXPRESSION) return;
        if (returnValue.equals(returnAny())) {
          return;
        }
        if (type == ASSIGNMENT_EXPRESSION || type == POSTFIX_EXPRESSION ||
            (type == PREFIX_EXPRESSION && firstChildOfType(myTree, element, UNARY_INCREMENT_DECREMENT) != null)) {
          LighterASTNode expression = skipParenthesesCastsDown(myTree, findExpressionChild(myTree, element));
          int paramIndex = resolveParameter(expression);
          if (paramIndex >= 0) {
            if (assignedParameters == null) {
              assignedParameters = new BitSet();
            }
            assignedParameters.set(paramIndex);
            if (returnValue.equals(returnParameter(paramIndex))) {
              returnValue = returnAny();
            }
          }
        }
        if (type == RETURN_STATEMENT) {
          LighterASTNode expression = findExpressionChild(myTree, element);
          ContractReturnValue newReturnValue = expressionToReturnValue(expression);
          if (returnValue.isFail()) {
            returnValue = newReturnValue;
          }
          else if (!returnValue.equals(newReturnValue)) {
            returnValue = returnAny();
          }
        }
        super.visitNode(element);
      }

      @NotNull
      private ContractReturnValue expressionToReturnValue(LighterASTNode expression) {
        expression = skipParenthesesDown(myTree, expression);
        if (expression == null) return returnAny();
        IElementType type = expression.getTokenType();
        if (type == NEW_EXPRESSION) {
          return returnNew();
        }
        if (type == THIS_EXPRESSION) {
          return returnThis();
        }
        if (type == REFERENCE_EXPRESSION) {
          int paramIndex = resolveParameter(expression);
          if (paramIndex >= 0 && (assignedParameters == null || !assignedParameters.get(paramIndex))) {
            return returnParameter(paramIndex);
          }
        }
        return returnAny();
      }
    }
    ReturnValueVisitor visitor = new ReturnValueVisitor();
    for (LighterASTNode statement : statements) {
      visitor.visitNode(statement);
    }
    return visitor.returnValue;
  }
private ContractReturnValue getDefaultReturnValue(List<LighterASTNode> statements)