当前位置: 首页>>代码示例>>C#>>正文


C# BindingRestrictions.Merge方法代码示例

本文整理汇总了C#中System.Dynamic.BindingRestrictions.Merge方法的典型用法代码示例。如果您正苦于以下问题:C# BindingRestrictions.Merge方法的具体用法?C# BindingRestrictions.Merge怎么用?C# BindingRestrictions.Merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Dynamic.BindingRestrictions的用法示例。


在下文中一共展示了BindingRestrictions.Merge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareArguments

        /// <summary>
        /// Prepares arguments for argfull overload.
        /// </summary>
        /// <param name="routine">Routine for which arguments should be prepared</param>
        /// <param name="arguments">Arguments to be prepared for the routine</param>
        /// <param name="genericArguments">Amount of generic arguments provided by call site.</param>
        /// <param name="regularArguments">Amount of value arguments provided by call site.</param>
        /// <param name="restrictions">Type restrictions for the arguments</param>
        /// <returns>Array of prepared arguments to be called with routine</returns>
        /// <remarks>
        /// This is basically substitute for everything important that was done in argless overload (except it doesn't use PhpStack but evaluation stack).
        /// It adopts the arguments according to routine. e.g. dereference reference if value is needed, supplies default argument, etc.
        /// </remarks>
        public static Expression[] PrepareArguments(this PhpRoutine routine, DynamicMetaObject[] arguments, int genericArguments, int regularArguments, out BindingRestrictions restrictions)
        {
            const int scriptContextIndex = 0;
            DynamicMetaObject arg;
            int result_offset = 0;
            int argument_offset = 0;
            Expression[] result = new Expression[1 + routine.Signature.GenericParamCount + routine.Signature.ParamCount];//ScriptContext + all arguments = actual arguments to be passed to argfull overload
            restrictions = BindingRestrictions.Empty;

            result[scriptContextIndex] = arguments[scriptContextIndex].Expression;
            ++result_offset;
            ++argument_offset;

			// peek pseudo-generic arguments:
            for (int i = 0; i < routine.Signature.GenericParamCount; ++i)
            {
                if (i < genericArguments)
                {
                    arg = arguments[argument_offset + i];
                }
                else
                {
                    arg = null;
                }

                result[result_offset + i] = GeneratePeekPseudoGenericArgument(routine, arguments[scriptContextIndex], arg, i);

                // it isn't necessary to add restriction for type argument, it is always DTypeDesc
            }

            result_offset += routine.Signature.GenericParamCount;
            argument_offset += genericArguments;

			// peek regular arguments:
            // skip first one ScriptContext and generic parameters
            for (int i = 0; i < routine.Signature.ParamCount; ++i)
            {
                if (i < regularArguments)
                {
                    arg = arguments[argument_offset + i];

                    if (arg.RuntimeType != null)
                        restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(arguments[argument_offset + i].Expression, arguments[argument_offset + i].LimitType));
                    else
                        restrictions = restrictions.Merge(BindingRestrictions.GetInstanceRestriction(arguments[argument_offset + i].Expression, null));//(MB) is it necessary?
                }
                else
                {
                    arg = null;
                }
                
                result[result_offset + i] = GeneratePeekArgument(routine, arguments[scriptContextIndex], arg, i);

            }

            return result;
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:70,代码来源:PhpRoutineExtensions.cs

示例2: TargetAsObject

        public static void TargetAsObject(DynamicMetaObject target, out Expression target_expr, out object target_value, ref BindingRestrictions restrictions)
        {
            target_expr = target.Expression;
            target_value = target.Value;

            if (target_value == null)
            {
                throw new NotImplementedException();    // TODO: call on NULL
            }

            for (;;)
            {
                if (target_expr.Type == typeof(PhpValue))
                {
                    // Template: target.Object // target.IsObject
                    var value = (PhpValue)target_value;
                    if (value.IsNull)
                    {
                        throw new NotImplementedException();    // TODO: call on NULL
                    }
                    else if (value.IsObject)
                    {
                        restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(Expression.Property(target_expr, "IsObject")));

                        target_value = value.Object;
                        target_expr = Expression.Property(target_expr, "Object");
                        break;
                    }
                    else if (value.IsAlias)
                    {
                        restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(Expression.Property(target_expr, "IsAlias")));

                        target_value = value.Alias;
                        target_expr = Expression.Property(target_expr, "Alias");
                        continue;
                    }
                    else
                    {
                        throw new NotImplementedException();    // TODO: scalar
                    }
                }
                else if (target_expr.Type == typeof(PhpAlias))
                {
                    // dereference
                    target_value = (PhpAlias)target_value;
                    target_expr = Expression.PropertyOrField(target_expr, "Value");
                    continue;
                }

                //
                break;
            }
        }
开发者ID:iolevel,项目名称:peachpie,代码行数:53,代码来源:BinderHelpers.cs

示例3: ResolveName

 string ResolveName(DynamicMetaObject[] args, ref BindingRestrictions restrictions)
 {
     if (_name != null)
     {
         return _name;
     }
     else
     {
         Debug.Assert(args.Length >= 1 && args[0].LimitType == typeof(string));
         restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(Expression.Equal(args[0].Expression, Expression.Constant(args[0].Value)))); // args[0] == "VALUE"
         return (string)args[0].Value;
     }
 }
开发者ID:iolevel,项目名称:peachpie,代码行数:13,代码来源:GetFieldBinder.cs

示例4: ResolveArgs

 void ResolveArgs(DynamicMetaObject[] args, ref BindingRestrictions restrictions, out string fieldName, out Expression valueExpr)
 {
     if (_name != null)
     {
         fieldName = _name;
         valueExpr = (args.Length > 0) ? args[0].Expression : null;
     }
     else
     {
         Debug.Assert(args.Length >= 1 && args[0].LimitType == typeof(string));
         restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(Expression.Equal(args[0].Expression, Expression.Constant(args[0].Value)))); // args[0] == "VALUE"
         fieldName = (string)args[0].Value;
         valueExpr = (args.Length > 1) ? args[1].Expression : null;
     }
 }
开发者ID:iolevel,项目名称:peachpie,代码行数:15,代码来源:SetFieldBinder.cs

示例5: AddRemoteObjectRestrictions

 private static BindingRestrictions AddRemoteObjectRestrictions(BindingRestrictions restrictions, object[] args, ReadOnlyCollection<ParameterExpression> parameters)
 {
     for (int i = 0; i < parameters.Count; i++)
     {
         ParameterExpression left = parameters[i];
         MarshalByRefObject obj2 = args[i] as MarshalByRefObject;
         if ((obj2 != null) && !IsComObject(obj2))
         {
             BindingRestrictions expressionRestriction;
             if (RemotingServices.IsObjectOutOfAppDomain(obj2))
             {
                 expressionRestriction = BindingRestrictions.GetExpressionRestriction(Expression.AndAlso(Expression.NotEqual(left, Expression.Constant(null)), Expression.Call(typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), left)));
             }
             else
             {
                 expressionRestriction = BindingRestrictions.GetExpressionRestriction(Expression.AndAlso(Expression.NotEqual(left, Expression.Constant(null)), Expression.Not(Expression.Call(typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), left))));
             }
             restrictions = restrictions.Merge(expressionRestriction);
         }
     }
     return restrictions;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:DynamicMetaObjectBinder.cs

示例6: MakeInvalidParametersRule

        // TODO: revisit
        private DynamicMetaObject MakeInvalidParametersRule(DefaultOverloadResolver binder, BindingRestrictions restrictions, BindingTarget bt) {
            var args = binder.Arguments;
            
            BindingRestrictions restriction = MakeSplatTests(binder.CallType, binder.Signature, true, args);

            // restrict to the exact type of all parameters for errors
            for (int i = 0; i < args.Count; i++) {
                args[i] = args[i].Restrict(args[i].GetLimitType());
            }

            return MakeError(
                binder.MakeInvalidParametersError(bt),
                restrictions.Merge(BindingRestrictions.Combine(args).Merge(restriction)),
                typeof(object)
            );
        }
开发者ID:jschementi,项目名称:iron,代码行数:17,代码来源:DefaultBinder.MethodCalls.cs

示例7: CallMethod

        /// <summary>
        /// Performs binding against a set of overloaded methods using the specified arguments.  The arguments are
        /// consumed as specified by the CallSignature object.
        /// </summary>
        /// <param name="minLevel">TODO.</param>
        /// <param name="maxLevel">TODO.</param>
        /// <param name="resolver">Overload resolver.</param>
        /// <param name="targets">The methods to be called</param>
        /// <param name="restrictions">Additional restrictions which should be applied to the resulting MetaObject.</param>
        /// <param name="target">The resulting binding target which can be used for producing error information.</param>
        /// <param name="name">The name of the method or null to use the name from targets.</param>
        /// <returns>A meta object which results from the call.</returns>
        public DynamicMetaObject CallMethod(DefaultOverloadResolver resolver, IList<MethodBase> targets, BindingRestrictions restrictions, string name, 
            NarrowingLevel minLevel, NarrowingLevel maxLevel, out BindingTarget target) {
            ContractUtils.RequiresNotNull(resolver, "resolver");
            ContractUtils.RequiresNotNullItems(targets, "targets");
            ContractUtils.RequiresNotNull(restrictions, "restrictions");

            // attempt to bind to an individual method
            target = resolver.ResolveOverload(name ?? GetTargetName(targets), targets, minLevel, maxLevel);

            if (target.Success) {
                // if we succeed make the target for the rule
                return new DynamicMetaObject(
                    target.MakeExpression(),
                    restrictions.Merge(
                        MakeSplatTests(resolver.CallType, resolver.Signature, resolver.Arguments).
                            Merge(target.RestrictedArguments.GetAllRestrictions())
                    )
                );
            }

            // make an error rule
            return MakeInvalidParametersRule(resolver, restrictions, target);
        }
开发者ID:jschementi,项目名称:iron,代码行数:35,代码来源:DefaultBinder.MethodCalls.cs

示例8: TryMakeBindingTarget

        private DynamicMetaObject TryMakeBindingTarget(MethodInfo[] targets, DynamicMetaObject[] args, Expression codeContext, BindingRestrictions restrictions) {
            MethodBinder mb = MethodBinder.MakeBinder(this, targets[0].Name, targets);

            BindingTarget target = mb.MakeBindingTarget(CallTypes.None, args);
            if (target.Success) {
                return new DynamicMetaObject(
                    target.MakeExpression(new ParameterBinderWithCodeContext(this, codeContext)),
                    restrictions.Merge(BindingRestrictions.Combine(target.RestrictedArguments))
                );
            }

            return null;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:13,代码来源:DefaultBinder.Operations.cs

示例9: GetMetaObject

 internal MetaObject GetMetaObject(Expression expression, BindingRestrictions restrictions, object value)
 {
     return new MetaObject(this, expression, restrictions.Merge(Restrict(expression)), value);
 }
开发者ID:Alxandr,项目名称:IronTotem,代码行数:4,代码来源:TotemType.cs

示例10: InvokePhpMethod

        /// <summary>
        /// This method binds rules for PhpMethod
        /// </summary>
        private void InvokePhpMethod(DynamicMetaObject/*!*/ target, DynamicMetaObject[]/*!!*/ args, /*object targetObj,*/ PhpRoutine/*!*/ routine, out BindingRestrictions restrictions, out Expression invokeMethodExpr)
        {
            Debug.Assert(target != null && target.Value != null);
            Debug.Assert(!(target.Value is IClrValue), "PhpRoutine should not be declared on CLR value type!");

            /*if (target.Value is PhpObject)
            {
                // Restriction: typeof(target) == |target.TypeDesc.RealType|
                var targetPhpObj = (PhpObject)target.Value;
                Debug.Assert(targetPhpObj.TypeDesc.RealType == target.LimitType);
                Debug.Assert(target.Value.GetType() == target.LimitType);
                restrictions = BindingRestrictions.GetTypeRestriction(target.Expression, targetPhpObj.TypeDesc.RealType);
            }
            else*/
            Debug.Assert(typeof(ClrObject).IsSealed);   // just to ensure following condition is correct
            if (target.Value.GetType() == typeof(ClrObject))
            {
                target = new ClrDynamicMetaObject(target);  // unwrap the real object, get restrictions
                restrictions = target.Restrictions;
            }
            else
            {
                Debug.Assert(target.Value.GetType() == target.LimitType);   // just for sure
                Debug.Assert(!(target.Value is PhpObject) || ((PhpObject)target.Value).TypeDesc.RealType == target.LimitType);

                restrictions = BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType);
            }

            BindingRestrictions argumentsRestrictions;
            Expression[] arguments;

            if (routine.Name != Name.SpecialMethodNames.Call)
            {
                args = GetArgumentsRange(args, 0, RealMethodArgumentCount);// This can't be done when _call method is invoked

                //Check if method has ArgAware attribute
                if ((routine.Properties & RoutineProperties.IsArgsAware) != 0 ||
                    routine.IsStatic)// this is because of hack in PHP.Library.XML library static methods that can be also called like instance methods
                {
                    DynamicMetaObject scriptContext = args[0];

                    //Select arguments without scriptContext
                    DynamicMetaObject[] realArgs = GetArgumentsRange(args, 1, RealMethodArgumentCount - 1);

                    InvokeArgLess(target, scriptContext, routine.RoutineDesc, realArgs, out argumentsRestrictions, out invokeMethodExpr);
                    restrictions = restrictions.Merge(argumentsRestrictions);
                    return;
                }

                arguments = routine.PrepareArguments(args, _genericParamsCount, _paramsCount, out argumentsRestrictions);
                restrictions = restrictions.Merge(argumentsRestrictions);
            }
            else
            {
                arguments = BinderHelper.PackToExpressions(args);
            }

            //((PhpObject)target))
            var realObjEx = Expression.Convert(target.Expression, routine.ArgFullInfo.DeclaringType);//targetObj.TypeDesc.RealType);

            //ArgFull( ((PhpObject)target), ScriptContext, args, ... )
            invokeMethodExpr = Expression.Call(BinderHelper.WrapInstanceMethodCall(routine.ArgFullInfo),
                                     BinderHelper.CombineArguments(realObjEx, arguments));

            invokeMethodExpr = ReturnArgumentHelpers.ReturnValueConversion(routine.ArgFullInfo, invokeMethodExpr);

            invokeMethodExpr = HandleResult(invokeMethodExpr, routine.ArgFullInfo.ReturnType, false);

        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:72,代码来源:PhpInvokeMemberBinder.cs

示例11: GetClassAndRestrictions

        /// <summary>
        /// This core method determines the class of an object.
        /// </summary>
        /// <param name="runtime">Required: SmalltalkRuntime containing the Smalltalk classes.</param>
        /// <param name="receiver">Optional: Object whos class is to be determined.</param>
        /// <param name="self">Required: Expression for the receiver.</param>
        /// <param name="arguments">Required: Currently not used.</param>
        /// <param name="restrictions">Restrictions for the given receiver.</param>
        /// <returns>The SmalltalkClass for the given receiver. This always returns an object (unless the given SmalltalkRuntime is inconsistent).</returns>
        public static SmalltalkClass GetClassAndRestrictions(SmalltalkRuntime runtime, 
            object receiver,
            DynamicMetaObject self,
            DynamicMetaObject[] arguments,
            out BindingRestrictions restrictions)
        {
            SmalltalkClass cls;
            // Special case handling of null, so it acts like first-class-object.
            if (receiver == null)
            {
                cls = runtime.NativeTypeClassMap.UndefinedObject;
                // If not explicitely mapped to a ST Class, fallback to the generic .Net mapping class.
                if (cls == null)
                    cls = runtime.NativeTypeClassMap.Native;
                if (cls == null)
                    cls = runtime.NativeTypeClassMap.Object;
                restrictions = BindingRestrictions.GetInstanceRestriction(self.Expression, null);
            }
            // Smalltalk objects ... almost every objects ends up here.
            else if (receiver is SmalltalkObject)
            {
                SmalltalkObject obj = (SmalltalkObject)receiver;
                cls = obj.Class;
                if (cls.Runtime == runtime)
                {
                    FieldInfo field = typeof(SmalltalkObject).GetField("Class", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public);
                    if (field == null)
                        throw new InvalidOperationException();
                    restrictions = BindingRestrictions.GetTypeRestriction(self.Expression, typeof(SmalltalkObject));
                    restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(
                        Expression.ReferenceEqual(Expression.Field(Expression.Convert(self.Expression, typeof(SmalltalkObject)), field), Expression.Constant(cls))));
                }
                else
                {
                    // A smalltalk object, but from different runtime
                    cls = null; // Let block below handle this.
                    restrictions = null;
                }
            }
            else if (receiver is Symbol)
            {
                Symbol symbol = (Symbol)receiver;
                SymbolTable manager = symbol.Manager;
                if (manager.Runtime == runtime)
                {
                    cls = runtime.NativeTypeClassMap.Symbol;
                    FieldInfo field = typeof(Symbol).GetField("Manager", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public);
                    if (field == null)
                        throw new InvalidOperationException();
                    restrictions = BindingRestrictions.GetTypeRestriction(self.Expression, typeof(Symbol));
                    restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(
                        Expression.ReferenceEqual(Expression.Field(Expression.Convert(self.Expression, typeof(Symbol)), field), Expression.Constant(manager))));
                }
                else
                {
                    // A smalltalk object, but from different runtime
                    cls = null; // Let block below handle this.
                    restrictions = null;
                }
            }
            else if (receiver is Pool)
            {
                Pool pool = (Pool)receiver;

                if (pool.Runtime == runtime)
                {
                    cls = runtime.NativeTypeClassMap.Pool;
                    PropertyInfo prop = typeof(Pool).GetProperty("Runtime", BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.GetProperty,
                        null, typeof(SmalltalkRuntime), new Type[0], null);
                    if (prop == null)
                        throw new InvalidOperationException();
                    restrictions = BindingRestrictions.GetTypeRestriction(self.Expression, typeof(Pool));
                    restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(
                        Expression.ReferenceEqual(Expression.Property(Expression.Convert(self.Expression, typeof(Pool)), prop), Expression.Constant(runtime))));
                }
                else
                {
                    // A smalltalk object, but from different runtime
                    cls = null; // Let block below handle this.
                    restrictions = null;
                }
            }
            // Common FCL type mapping (bool, int, string, etc) to first-class-object.
            else if (receiver is bool)
            {
                Expression restrictionTest;
                if ((bool)receiver)
                {
                    cls = runtime.NativeTypeClassMap.True;
                    restrictionTest = Expression.IsTrue(Expression.Convert(self.Expression, typeof(bool)));
                }
//.........这里部分代码省略.........
开发者ID:erlis,项目名称:IronSmalltalk,代码行数:101,代码来源:MethodLookupHelper.cs

示例12: ResolveMethods

        protected override MethodBase[] ResolveMethods(DynamicMetaObject ctx, ref DynamicMetaObject target, IList<DynamicMetaObject> args, ref BindingRestrictions restrictions)
        {
            if (target.Value == null)
            {
                Combine(ref restrictions, BindingRestrictions.GetInstanceRestriction(target.Expression, Expression.Constant(null)));
                // TODO: Err instance is null
                return null;
            }

            // resolve target expression:
            Expression target_expr;
            object target_value;
            BinderHelpers.TargetAsObject(target, out target_expr, out target_value, ref restrictions);

            // target restrictions
            if (!target_expr.Type.GetTypeInfo().IsSealed)
            {
                restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(target_expr, target_value.GetType()));
                target_expr = Expression.Convert(target_expr, target_value.GetType());
            }

            target = new DynamicMetaObject(target_expr, target.Restrictions, target_value);

            string name = _name;

            if (_name == null)
            {
                // indirect function name

                Debug.Assert(args.Count >= 1 && args[0].LimitType == typeof(string));
                Debug.Assert(args[0].Value is string);

                restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(Expression.Equal(args[0].Expression, Expression.Constant(args[0].Value)))); // args[0] == "VALUE"

                name = (string)args[0].Value;
                args.RemoveAt(0);
            }

            // candidates:
            var candidates = target.RuntimeType.SelectCandidates().SelectByName(name).SelectVisible(_classCtx).ToList();
            return candidates.ToArray();
        }
开发者ID:iolevel,项目名称:peachpie,代码行数:42,代码来源:CallBinder.cs

示例13: MakeInvalidParametersRule

        private static DynamicMetaObject MakeInvalidParametersRule(CallTypes callType, CallSignature signature, DefaultBinder binder, IList<DynamicMetaObject> args, BindingRestrictions restrictions, BindingTarget bt) {
            BindingRestrictions restriction = MakeSplatTests(callType, signature, true, args);

            // restrict to the exact type of all parameters for errors
            for (int i = 0; i < args.Count; i++) {
                args[i] = args[i].Restrict(args[i].GetLimitType());
            }

            return MakeError(
                binder.MakeInvalidParametersError(bt),
                restrictions.Merge(BindingRestrictions.Combine(args).Merge(restriction))
            );
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:13,代码来源:DefaultBinder.MethodCalls.cs

示例14: CallWorker

        private DynamicMetaObject CallWorker(ParameterBinder parameterBinder, IList<MethodBase> targets, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType, BindingRestrictions restrictions, NarrowingLevel minLevel, NarrowingLevel maxLevel, string name, out BindingTarget target) {
            ContractUtils.RequiresNotNull(parameterBinder, "parameterBinder");
            ContractUtils.RequiresNotNullItems(args, "args");
            ContractUtils.RequiresNotNullItems(targets, "targets");
            ContractUtils.RequiresNotNull(restrictions, "restrictions");

            DynamicMetaObject[] finalArgs;
            SymbolId[] argNames;

            if (callType == CallTypes.ImplicitInstance) {
                GetArgumentNamesAndTypes(signature, ArrayUtils.RemoveFirst(args), out argNames, out finalArgs);
                finalArgs = ArrayUtils.Insert(args[0], finalArgs);
            } else {
                GetArgumentNamesAndTypes(signature, args, out argNames, out finalArgs);
            }

            // attempt to bind to an individual method
            MethodBinder binder = MethodBinder.MakeBinder(
                this,
                name ?? GetTargetName(targets),
                targets,
                argNames,
                minLevel,
                maxLevel);
            target = binder.MakeBindingTarget(callType, finalArgs);

            if (target.Success) {
                // if we succeed make the target for the rule
                return new DynamicMetaObject(
                    target.MakeExpression(parameterBinder),
                    restrictions.Merge(MakeSplatTests(callType, signature, args).Merge(BindingRestrictions.Combine(target.RestrictedArguments)))
                );
            }
            // make an error rule
            return MakeInvalidParametersRule(callType, signature, this, args, restrictions, target);
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:36,代码来源:DefaultBinder.MethodCalls.cs

示例15: ExpandLastArg

        void ExpandLastArg(List<Argument> arguments, DynamicMetaObject[] args, ref BindingRestrictions restrictions)
        {
            if (args.Length == 0)
                return;

            var lastArg = args.Last();

            if (lastArg.LimitType != typeof(Varargs))
                return;

            // TODO: Use custom restriction (checks length and types) and add arguments by indexing into Varargs value
            restrictions = restrictions.Merge(RuntimeHelpers.MergeInstanceRestrictions(lastArg));

            var varargs = (Varargs)lastArg.Value;
            arguments.RemoveAt(arguments.Count - 1);
            arguments.AddRange(varargs.Select(value => new Argument(Expr.Constant(value), value.GetType())));
        }
开发者ID:ericmj,项目名称:IronLua,代码行数:17,代码来源:LuaInvokeBinder.cs


注:本文中的System.Dynamic.BindingRestrictions.Merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。