예제 #1
0
        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);
        }
예제 #2
0
        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);
        }