Example #1
0
        public override ValueExpression Evaluate(IParserContext context)
        {
            ClassName className = TypeExpression.Evaluate(context).Value as ClassName;

            if (className == null)
            {
                throw new ExpressionEvaluationException("type cast requires a type. " + TypeExpression + " is not a type", this);
            }

            return(Exp.Value(TokenPosition, Convert.ChangeType(TargetExpression.Evaluate(context).Value, className.Type, null), className.Type));
        }