/// <summary> /// /// </summary> /// <param name="expr"></param> /// <param name="funcReturningObj"></param> /// <returns></returns> internal static bool TryMatchLocalExpression(Expression expr, out FunctionReturningObject funcReturningObj) { bool result; try { LocalDMSExpressionChecker localExpressionChecker = new LocalDMSExpressionChecker(); localExpressionChecker.Visit(expr); bool flag = !localExpressionChecker._foundParameter && !localExpressionChecker._foundSpecialMethod && localExpressionChecker._foundConstant; if (flag) { funcReturningObj = LocalDMSExpressionChecker.CompileLocalExpression(expr); } else { funcReturningObj = null; } result = flag; } catch (Exception arg) { System.Diagnostics.Debug.WriteLine("TryMatchLocalExpression failed: " + arg); throw; } return(result); }
internal static ConstantExpression ConvertConstantExpression(Expression expr) { FunctionReturningObject functionReturningObject = LocalDMSExpressionChecker.CompileLocalExpression(expr); return(Expression.Constant(functionReturningObject(), expr.Type)); }