private static Number?DiscoverNumberValue([NotNull] BaseExpression expr) { if (expr is ConstantNumber con) { return(con.Value); } if (expr.IsConstant) { var s = expr.StaticEvaluate(); if (s.Type == Type.Number) { return(s.Number); } } return(null); }
private static string DiscoverStringValue([NotNull] BaseExpression expr) { if (expr is ConstantString con) { return(con.Value); } if (expr.IsConstant) { var s = expr.StaticEvaluate(); if (s.Type == Type.String) { return(s.String); } } return(null); }