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


C# Calls.OverloadResolver类代码示例

本文整理汇总了C#中Microsoft.Scripting.Actions.Calls.OverloadResolver的典型用法代码示例。如果您正苦于以下问题:C# OverloadResolver类的具体用法?C# OverloadResolver怎么用?C# OverloadResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OverloadResolver类属于Microsoft.Scripting.Actions.Calls命名空间,在下文中一共展示了OverloadResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            if (_tmp == null) {
                _tmp = resolver.GetTemporary(_elementType, "outParam");
            }

            Debug.Assert(!hasBeenUsed[Index]);
            hasBeenUsed[Index] = true;
            Expression arg = args.GetObject(Index).Expression;

            return Expression.Condition(
                Expression.TypeIs(arg, Type),
                Expression.Assign(
                    _tmp,
                    Expression.Field(
                        AstUtils.Convert(arg, Type),
                        Type.GetField("Value")
                    )
                ),
                Expression.Throw(
                    Expression.Call(
                        new Func<Type, object, Exception>(RuntimeHelpers.MakeIncorrectBoxTypeError).Method,
                        AstUtils.Constant(_elementType),
                        AstUtils.Convert(arg, typeof(object))
                    ),
                    _elementType
                )
            );
        }
开发者ID:madpilot,项目名称:ironruby,代码行数:28,代码来源:ReferenceArgBuilder.cs

示例2: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            if (_tmp == null) {
                _tmp = resolver.GetTemporary(Type, "outParam");
            }

            return Ast.Block(Ast.Assign(_tmp, base.ToExpression(resolver, args, hasBeenUsed)), _tmp);
        }
开发者ID:apboyle,项目名称:ironruby,代码行数:7,代码来源:ReturnReferenceArgBuilder.cs

示例3: ToExpression

        internal override Expression ToExpression(OverloadResolver resolver, IList<ArgBuilder> builders, RestrictedArguments args, Expression ret) {
            if (_returnArgs.Count == 1) {
                if (_returnArgs[0] == -1) {
                    return ret;
                }
                return Ast.Block(ret, builders[_returnArgs[0]].ToReturnExpression(resolver));
            }

            Expression[] retValues = new Expression[_returnArgs.Count];
            int rIndex = 0;
            bool usesRet = false;
            foreach (int index in _returnArgs) {
                if (index == -1) {
                    usesRet = true;
                    retValues[rIndex++] = ret;
                } else {
                    retValues[rIndex++] = builders[index].ToReturnExpression(resolver);
                }
            }

            Expression retArray = AstUtils.NewArrayHelper(typeof(object), retValues);
            if (!usesRet) {
                retArray = Ast.Block(ret, retArray);
            }

            return resolver.GetByRefArrayExpression(retArray);
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:27,代码来源:ByRefReturnBuilder.cs

示例4: ToReturnExpression

        internal override Expression ToReturnExpression(OverloadResolver resolver) {
            if (_isRef) {
                return _tmp;
            }

            return GetDefaultValue();
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:7,代码来源:OutArgBuilder.cs

示例5: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
            if (_tmp == null) {
                _tmp = resolver.GetTemporary(Type, "outParam");
            }

            return Ast.Block(Ast.Assign(_tmp, base.ToExpression(resolver, parameters, hasBeenUsed)), _tmp);
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:ReturnReferenceArgBuilder.cs

示例6: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            if (_tmp == null) {
                _tmp = resolver.GetTemporary(_elementType, "outParam");
            }

            Debug.Assert(!hasBeenUsed[Index]);
            hasBeenUsed[Index] = true;
            Type boxType = typeof(StrongBox<>).MakeGenericType(_elementType);
            Expression arg = args.GetObject(Index).Expression;

            return Expression.Condition(
                Expression.TypeIs(arg, Type),
                Expression.Assign(
                    _tmp,
                    Expression.Field(
                        AstUtils.Convert(arg, boxType),
                        boxType.GetField("Value")
                    )
                ),
                Expression.Call(
                    typeof(RuntimeHelpers).GetMethod("IncorrectBoxType").MakeGenericMethod(_elementType),
                    AstUtils.Convert(arg, typeof(object))
                )
            );
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:25,代码来源:ReferenceArgBuilder.cs

示例7: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
            Debug.Assert(BuilderExpectsSingleParameter(_builder));

            int index = GetKeywordIndex(parameters.Count);
            Debug.Assert(!hasBeenUsed[index]);
            hasBeenUsed[index] = true;
            return _builder.ToExpression(resolver, new Expression[] { parameters[index] }, new bool[1]);
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:8,代码来源:KeywordArgBuilder.cs

示例8: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            Debug.Assert(BuilderExpectsSingleParameter(_builder));

            int index = GetKeywordIndex(args.Length);
            Debug.Assert(!hasBeenUsed[index]);
            hasBeenUsed[index] = true;
            return _builder.ToExpression(resolver, MakeRestrictedArg(args, index), new bool[1]);
        }
开发者ID:madpilot,项目名称:ironruby,代码行数:8,代码来源:KeywordArgBuilder.cs

示例9: ParameterMapping

        internal ParameterMapping(OverloadResolver resolver, OverloadInfo method, IList<string> argNames) {
            Assert.NotNull(resolver, method);
            _resolver = resolver;
            _overload = method;
            _argNames = argNames;
            _parameters = new List<ParameterWrapper>();
            _arguments = new List<ArgBuilder>(method.ParameterCount);
            _defaultArguments = new List<ArgBuilder>();
	    }
开发者ID:BenHall,项目名称:ironruby,代码行数:9,代码来源:ParameterMapping.cs

示例10: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
            Expression res = Ast.Call(
                typeof(BinderOps).GetMethod("MakeSymbolDictionary"),
                Ast.NewArrayInit(typeof(string), ConstantNames()),
                AstUtils.NewArrayHelper(typeof(object), GetParameters(parameters, hasBeenUsed))
            );

            return res;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:ParamsDictArgBuilder.cs

示例11: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            Type dictType = ParameterInfo.ParameterType;

            return Ast.Call(
                GetCreationDelegate(dictType).Method,
                Ast.NewArrayInit(typeof(string), ConstantNames()),
                AstUtils.NewArrayHelper(typeof(object), GetParameters(args, hasBeenUsed))
            );
        }
开发者ID:techarch,项目名称:ironruby,代码行数:9,代码来源:ParamsDictArgBuilder.cs

示例12: UpdateFromReturn

 internal override Expression UpdateFromReturn(OverloadResolver resolver, IList<Expression> parameters) {
     return Expression.Assign(
         Expression.Field(
             Expression.Convert(parameters[Index], Type),
             Type.GetField("Value")
         ),
         _tmp
     );
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:ReferenceArgBuilder.cs

示例13: UpdateFromReturn

 internal override Expression UpdateFromReturn(OverloadResolver resolver, RestrictedArguments args) {
     return Expression.Assign(
         Expression.Field(
             Expression.Convert(args.GetObject(Index).Expression, Type),
             Type.GetField("Value")
         ),
         _tmp
     );
 }
开发者ID:Hank923,项目名称:ironruby,代码行数:9,代码来源:ReferenceArgBuilder.cs

示例14: ToExpression

        internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
            if (_isRef) {
                if (_tmp == null) {
                    _tmp = resolver.GetTemporary(_parameterType, "outParam");
                }
                return _tmp;
            }

            return GetDefaultValue();
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:10,代码来源:OutArgBuilder.cs

示例15: ParameterMapping

        internal ParameterMapping(OverloadResolver resolver, MethodBase method, ParameterInfo[] parameterInfos, IList<string> argNames) {
            Assert.NotNull(resolver, method);
            _resolver = resolver;
            _method = method;
            _argNames = argNames;
            _parameterInfos = parameterInfos ?? method.GetParameters();
            _parameters = new List<ParameterWrapper>();
            _arguments = new List<ArgBuilder>(_parameterInfos.Length);
            _defaultArguments = new List<ArgBuilder>();
	    }
开发者ID:teejayvanslyke,项目名称:ironruby,代码行数:10,代码来源:ParameterMapping.cs


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