public static bool IsLiteralExpression()

in ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Util/FSharpExpressionUtil.cs [33:90]


    public static bool IsLiteralExpression([CanBeNull] this IFSharpExpression fsExpr) =>
      fsExpr.IgnoreInnerParens() is ILiteralExpr literalExpr && literalExpr.IsConstantValue();

    /// Checks exactly for ILambdaExpr
    public static bool IsLambdaExpression([CanBeNull] this IFSharpExpression fsExpr) => fsExpr is ILambdaExpr;

    public static readonly Func<IFSharpExpression, bool> IsSimpleValueExpressionFunc = IsSimpleValueExpression;
    public static readonly Func<IFSharpExpression, bool> IsLiteralExpressionFunc = IsLiteralExpression;
    public static readonly Func<IFSharpExpression, bool> IsLambdaExpressionFunc = IsLambdaExpression;

    // TODO: change name
    [CanBeNull]
    public static IFSharpExpression GetOutermostParentExpressionFromItsReturn([NotNull] this IFSharpExpression expression, bool allowFromLambdaReturn = false)
    {
      var currentExpr = expression;
      while (true)
      {
        currentExpr = currentExpr.IgnoreParentParens();

        if (MatchClauseListOwnerExprNavigator.GetByClauseExpression(currentExpr) is { } matchExpr)
        {
          currentExpr = matchExpr as IFSharpExpression;
          continue;
        }

        if (SequentialExprNavigator.GetByLastExpression(currentExpr) is { } seqExpr)
        {
          currentExpr = seqExpr;
          continue;
        }

        if (IfThenElseExprNavigator.GetByBranchExpression(currentExpr) is { ElseExpr: not null } ifExpr)
        {
          currentExpr = ifExpr;
          continue;
        }

        if (ElifExprNavigator.GetByBranchExpression(currentExpr) is { ElseExpr: not null } elifExpr)
        {
          currentExpr = elifExpr;
          continue;
        }

        if (allowFromLambdaReturn && LambdaExprNavigator.GetByExpression(currentExpr) is LambdaExpr lambdaExpr)
        {
          currentExpr = lambdaExpr;
          continue;
        }

        if (LetOrUseExprNavigator.GetByInExpression(currentExpr) is { } letOrUseExpr)
        {
          currentExpr = letOrUseExpr;
          continue;
        }

        return currentExpr;
      }
    }