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


C# Arguments.RemoveAt方法代码示例

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


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

示例1: VerifyArgumentsCompat

        public bool VerifyArgumentsCompat(ResolveContext ec, ref Arguments arguments,
            int arg_count, MethodSpec method,
            bool chose_params_expanded,
            bool may_fail, Location loc)
        {
            AParametersCollection pd = method.Parameters;
            int param_count = GetApplicableParametersCount (method, pd);

            int errors = ec.Report.Errors;
            Parameter.Modifier p_mod = 0;
            TypeSpec pt = null;
            int a_idx = 0, a_pos = 0;
            Argument a = null;
            ArrayInitializer params_initializers = null;
            bool has_unsafe_arg = method.ReturnType.IsPointer;

            for (; a_idx < arg_count; a_idx++, ++a_pos) {
                a = arguments [a_idx];
                if (p_mod != Parameter.Modifier.PARAMS) {
                    p_mod = pd.FixedParameters [a_idx].ModFlags;
                    pt = pd.Types [a_idx];
                    has_unsafe_arg |= pt.IsPointer;

                    if (p_mod == Parameter.Modifier.PARAMS) {
                        if (chose_params_expanded) {
                            params_initializers = new ArrayInitializer (arg_count - a_idx, a.Expr.Location);
                            pt = TypeManager.GetElementType (pt);
                        }
                    }
                }

                //
                // Types have to be identical when ref or out modifer is used
                //
                if (a.Modifier != 0 || (p_mod & ~Parameter.Modifier.PARAMS) != 0) {
                    if ((p_mod & ~Parameter.Modifier.PARAMS) != a.Modifier)
                        break;

                    if (!TypeManager.IsEqual (a.Expr.Type, pt))
                        break;

                    continue;
                } else {
                    NamedArgument na = a as NamedArgument;
                    if (na != null) {
                        int name_index = pd.GetParameterIndexByName (na.Name);
                        if (name_index < 0 || name_index >= param_count) {
                            if (DeclaringType != null && TypeManager.IsDelegateType (DeclaringType)) {
                                ec.Report.SymbolRelatedToPreviousError (DeclaringType);
                                ec.Report.Error (1746, na.Location,
                                    "The delegate `{0}' does not contain a parameter named `{1}'",
                                    TypeManager.CSharpName (DeclaringType), na.Name);
                            } else {
                                ec.Report.SymbolRelatedToPreviousError (best_candidate);
                                ec.Report.Error (1739, na.Location,
                                    "The best overloaded method match for `{0}' does not contain a parameter named `{1}'",
                                    TypeManager.CSharpSignature (method), na.Name);
                            }
                        } else if (arguments[name_index] != a) {
                            if (DeclaringType != null && TypeManager.IsDelegateType (DeclaringType))
                                ec.Report.SymbolRelatedToPreviousError (DeclaringType);
                            else
                                ec.Report.SymbolRelatedToPreviousError (best_candidate);

                            ec.Report.Error (1744, na.Location,
                                "Named argument `{0}' cannot be used for a parameter which has positional argument specified",
                                na.Name);
                        }
                    }
                }

                if (a.Expr.Type == InternalType.Dynamic)
                    continue;

                if (delegate_type != null && !Delegate.IsTypeCovariant (a.Expr, pt))
                    break;

                Expression conv = Convert.ImplicitConversion (ec, a.Expr, pt, loc);
                if (conv == null)
                    break;

                //
                // Convert params arguments to an array initializer
                //
                if (params_initializers != null) {
                    // we choose to use 'a.Expr' rather than 'conv' so that
                    // we don't hide the kind of expression we have (esp. CompoundAssign.Helper)
                    params_initializers.Add (a.Expr);
                    arguments.RemoveAt (a_idx--);
                    --arg_count;
                    continue;
                }

                // Update the argument with the implicit conversion
                a.Expr = conv;
            }

            if (a_idx != arg_count) {
                if (!may_fail && ec.Report.Errors == errors) {
                    if (CustomErrorHandler != null)
//.........这里部分代码省略.........
开发者ID:speier,项目名称:shake,代码行数:101,代码来源:ecore.cs


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