示例#1
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));
        }
示例#2
0
        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));
        }
示例#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);
        }
示例#4
0
 public virtual Expression GetDynamicConversion(Expression value, Type type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(_actionBinder, type), type, value));
 }
示例#5
0
 public override Expression GetDynamicConversion(Expression value, Type type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(Binder, type), type, _context, value));
 }
示例#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);
        }
示例#7
0
 public override Expression /*!*/ GetDynamicConversion(Expression /*!*/ value, Type /*!*/ type)
 {
     return(Expression.Dynamic(OldConvertToAction.Make(Binder, type), type, ScopeExpression, value));
 }