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), className.Type)); }
public override ValueExpression Evaluate(IParserContext context) { ClassName className = _className.Evaluate(context).Value as ClassName; if (className == null) { throw new TypeInitializationException(_className.VarName, null); } return(Exp.Value(TokenPosition, className.Type.GetConstructors())); }