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


C# MethodSpec.IsConditionallyExcluded方法代码示例

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


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

示例1: Emit

		public void Emit (EmitContext ec, MethodSpec method, Arguments Arguments, Location loc)
		{
			// Speed up the check by not doing it on not allowed targets
			if (method.ReturnType.Kind == MemberKind.Void && method.IsConditionallyExcluded (ec.MemberContext, loc))
				return;

			EmitPredefined (ec, method, Arguments);
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:8,代码来源:codegen.cs

示例2: DoResolve

        protected override Expression DoResolve(ResolveContext ec)
        {
            constructor_method = Delegate.GetConstructor (ec.Compiler, ec.CurrentType, type);

            var invoke_method = Delegate.GetInvokeMethod (ec.Compiler, type);
            method_group.DelegateType = type;
            method_group.CustomErrorHandler = this;

            Arguments arguments = CreateDelegateMethodArguments (invoke_method.Parameters, loc);
            method_group = method_group.OverloadResolve (ec, ref arguments, false, loc);
            if (method_group == null)
                return null;

            delegate_method = (MethodSpec) method_group;

            if (TypeManager.IsNullableType (delegate_method.DeclaringType)) {
                ec.Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
                    TypeManager.GetFullNameSignature (delegate_method));
                return null;
            }

            Invocation.IsSpecialMethodInvocation (ec, delegate_method, loc);

            ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;
            if (emg != null) {
                delegate_instance_expression = emg.ExtensionExpression;
                TypeSpec e_type = delegate_instance_expression.Type;
                if (TypeManager.IsValueType (e_type)) {
                    ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates",
                        delegate_method.GetSignatureForError (), TypeManager.CSharpName (e_type));
                }
            }

            TypeSpec rt = delegate_method.ReturnType;
            Expression ret_expr = new TypeExpression (rt, loc);
            if (!Delegate.IsTypeCovariant (ret_expr, invoke_method.ReturnType)) {
                Error_ConversionFailed (ec, delegate_method, ret_expr);
            }

            if (delegate_method.IsConditionallyExcluded (loc)) {
                ec.Report.SymbolRelatedToPreviousError (delegate_method);
                MethodOrOperator m = delegate_method.MemberDefinition as MethodOrOperator;
                if (m != null && m.IsPartialDefinition) {
                    ec.Report.Error (762, loc, "Cannot create delegate from partial method declaration `{0}'",
                        delegate_method.GetSignatureForError ());
                } else {
                    ec.Report.Error (1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute",
                        TypeManager.CSharpSignature (delegate_method));
                }
            }

            DoResolveInstanceExpression (ec);
            eclass = ExprClass.Value;
            return this;
        }
开发者ID:speier,项目名称:shake,代码行数:55,代码来源:delegate.cs


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