public static DynamicExpression ConvertTo(OldConvertToAction action, params Expression[] arguments)
        {
            ContractUtils.RequiresNotNull(arguments, "arguments");
            ContractUtils.Requires(arguments.Length > 0, "arguments");

            return(Expression.Dynamic(action, action.ToType, arguments));
        }
        public static DynamicExpression ConvertTo(ActionBinder binder, Type toType, ConversionResultKind kind, Type actionExpressionType, params Expression[] arguments)
        {
            ContractUtils.RequiresNotNull(toType, "toType");
            ContractUtils.RequiresNotNull(arguments, "arguments");
            ContractUtils.Requires(arguments.Length > 0, "arguments");

            return(Expression.Dynamic(OldConvertToAction.Make(binder, toType, kind), actionExpressionType, arguments));
        }
Beispiel #3
0
        public virtual int ExecuteProgram(SourceUnit program)
        {
            ContractUtils.RequiresNotNull(program, "program");

            object returnValue = program.Execute();

            CodeContext context = new CodeContext(new Scope(), this);

            CallSite <Func <CallSite, CodeContext, object, object> > site =
                CallSite <Func <CallSite, CodeContext, object, object> > .Create(OldConvertToAction.Make(Binder, typeof(int), ConversionResultKind.ExplicitTry));

            object exitCode = site.Target(site, context, returnValue);

            return((exitCode != null) ? (int)exitCode : 0);
        }
Beispiel #4
0
 public virtual Expression GetDynamicConversion(Expression value, Type type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(_actionBinder, type), type, value));
 }
Beispiel #5
0
 public override Expression GetDynamicConversion(Expression value, Type type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(Binder, type), type, _context, value));
 }
Beispiel #6
0
        public static DynamicExpression ConvertTo(OldConvertToAction action, params Expression[] arguments) {
            ContractUtils.RequiresNotNull(arguments, "arguments");
            ContractUtils.Requires(arguments.Length > 0, "arguments");

            return Expression.Dynamic(action, action.ToType, arguments);
        }
Beispiel #7
0
 public override Expression /*!*/ GetDynamicConversion(Expression /*!*/ value, Type /*!*/ type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(Binder, type), type, ScopeExpression, value));
 }