示例#1
0
        public static ExpressionSyntax ForceOptimization(this ExpressionSyntax exp)
        {
            if (exp is ArgumentExpression arg)
            {
                return(ForceOptimization(arg.Value));
            }
            if (exp is StringLiteralExpressionSyntax)
            {
                return(exp.AsOptimized());
            }

            var result = new Expressive.Expression(exp.ExpressionString).Evaluate();

            if (result is float f)
            {
                return(new SingleLiteralExpressionSyntax(f).AsOptimized());
            }
            return(new VeinSyntax().LiteralExpression.End().Parse($"{result}").AsOptimized());
        }