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


C# WellKnownMember类代码示例

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


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

示例1: ReportErrorOnWellKnownMember

 private static void ReportErrorOnWellKnownMember(Symbol symbol, WellKnownMember member, DiagnosticBag diagnostics, ref bool hasError)
 {
     if ((object)symbol == null)
     {
         MemberDescriptor memberDescriptor = WellKnownMembers.GetDescriptor(member);
         diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, NoLocation.Singleton,
             ((WellKnownType)memberDescriptor.DeclaringTypeId).GetMetadataName(), memberDescriptor.Name);
         hasError = true;
     }
     else
     {
         ReportErrorOnSymbol(symbol, diagnostics, ref hasError);
         ReportErrorOnSymbol(symbol.ContainingType, diagnostics, ref hasError);
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:15,代码来源:AnonymousTypeManager.SymbolCollection.cs

示例2: WellKnownMethod

 public MethodSymbol WellKnownMethod(WellKnownMember wm, bool isOptional = false)
 {
     return (MethodSymbol)WellKnownMember(wm, isOptional);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:4,代码来源:SyntheticBoundNodeFactory.cs

示例3: WellKnownMember

        /// <summary>
        /// Get the symbol for a well-known member. The use of this method to get a well-known member
        /// that does not exist will result in an exception of type MissingPredefinedMember being thrown
        /// containing an appropriate diagnostic for the caller to report.
        /// </summary>
        /// <param name="wm">The desired well-known member</param>
        /// <param name="isOptional">If true, the method may return null for a missing member without an exception</param>
        /// <returns>A symbol for the well-known member, or null if it is missing and isOptions == true</returns>
        public Symbol WellKnownMember(WellKnownMember wm, bool isOptional = false)
        {
            Symbol wellKnownMember = Binder.GetWellKnownTypeMember(Compilation, wm, Diagnostics, syntax: Syntax, isOptional: true);
            if (wellKnownMember == null && !isOptional)
            {
                RuntimeMembers.MemberDescriptor memberDescriptor = WellKnownMembers.GetDescriptor(wm);
                WellKnownType containingType = (WellKnownType)memberDescriptor.DeclaringTypeId;
                var diagnostic = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, containingType.GetMetadataName(), memberDescriptor.Name), Syntax.Location);
                throw new MissingPredefinedMember(diagnostic);
            }

            return wellKnownMember;
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:21,代码来源:SyntheticBoundNodeFactory.cs

示例4: Property

 public BoundExpression Property(BoundExpression receiver, WellKnownMember member)
 {
     var propertySym = WellKnownMember(member) as PropertySymbol;
     Debug.Assert(!propertySym.IsStatic);
     Debug.Assert(receiver.Type.GetMembers(propertySym.Name).OfType<PropertySymbol>().Single() == propertySym);
     //if (propertySym == null) return BoundBadExpression
     Binder.ReportUseSiteDiagnostics(propertySym, Diagnostics, Syntax);
     Debug.Assert(!propertySym.IsStatic);
     return Call(receiver, propertySym.GetMethod);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:10,代码来源:SyntheticBoundNodeFactory.cs

示例5: TryCreate

        private static bool TryCreate(
            SyntheticBoundNodeFactory F,
            NamedTypeSymbol builderType,
            TypeSymbol resultType,
            WellKnownMember setException,
            WellKnownMember setResult,
            WellKnownMember awaitOnCompleted,
            WellKnownMember awaitUnsafeOnCompleted,
            WellKnownMember start,
            WellKnownMember setStateMachine,
            PropertySymbol task,
            out AsyncMethodBuilderMemberCollection collection)
        {
            MethodSymbol setExceptionMethod;
            MethodSymbol setResultMethod;
            MethodSymbol awaitOnCompletedMethod;
            MethodSymbol awaitUnsafeOnCompletedMethod;
            MethodSymbol startMethod;
            MethodSymbol setStateMachineMethod;

            if (TryGetWellKnownMethodAsMember(F, setException, builderType, out setExceptionMethod) &&
                TryGetWellKnownMethodAsMember(F, setResult, builderType, out setResultMethod) &&
                TryGetWellKnownMethodAsMember(F, awaitOnCompleted, builderType, out awaitOnCompletedMethod) &&
                TryGetWellKnownMethodAsMember(F, awaitUnsafeOnCompleted, builderType, out awaitUnsafeOnCompletedMethod) &&
                TryGetWellKnownMethodAsMember(F, start, builderType, out startMethod) &&
                TryGetWellKnownMethodAsMember(F, setStateMachine, builderType, out setStateMachineMethod))
            {
                collection = new AsyncMethodBuilderMemberCollection(
                    builderType,
                    resultType,
                    setExceptionMethod,
                    setResultMethod,
                    awaitOnCompletedMethod,
                    awaitUnsafeOnCompletedMethod,
                    startMethod,
                    setStateMachineMethod,
                    task);

                return true;
            }

            collection = default(AsyncMethodBuilderMemberCollection);
            return false;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:44,代码来源:AsyncMethodBuilderMemberCollection.cs

示例6: MakeMemberMissing

 internal void MakeMemberMissing(WellKnownMember member)
 {
     MakeMemberMissing((int)member);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:4,代码来源:CSharpCompilation.cs

示例7: EnsureWellKnownMember

 private Symbol EnsureWellKnownMember(WellKnownMember member, DiagnosticBag bag)
 {
     return Binder.GetWellKnownTypeMember(F.Compilation, member, bag, body.Syntax.Location);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:4,代码来源:AsyncRewriter.cs

示例8: StaticCall

 public BoundExpression StaticCall(WellKnownMember method, params BoundExpression[] args)
 {
     MethodSymbol methodSymbol = WellKnownMethod(method);
     Binder.ReportUseSiteDiagnostics(methodSymbol, Diagnostics, Syntax);
     Debug.Assert(methodSymbol.IsStatic);
     return Call(null, methodSymbol, args);
 }
开发者ID:genlu,项目名称:roslyn,代码行数:7,代码来源:SyntheticBoundNodeFactory.cs

示例9: MethodInfo

 public BoundExpression MethodInfo(WellKnownMember meth)
 {
     var method = (MethodSymbol)WellKnownMember(meth);
     return MethodInfo(method);
 }
开发者ID:nagyist,项目名称:roslyn,代码行数:5,代码来源:SyntheticBoundNodeFactory.cs

示例10: OpenMethodImplementation

 public SynthesizedImplementationMethod OpenMethodImplementation(WellKnownMember interfaceMethod, string methodName = null, bool debuggerHidden = false, MethodSymbol asyncKickoffMethod = null)
 {
     var methodToImplement = (MethodSymbol)this.WellKnownMember(interfaceMethod);
     return OpenMethodImplementation(methodToImplement, methodName, debuggerHidden, asyncKickoffMethod: asyncKickoffMethod);
 }
开发者ID:nagyist,项目名称:roslyn,代码行数:5,代码来源:SyntheticBoundNodeFactory.cs

示例11: TryGetWellKnownPropertyAsMember

        private static bool TryGetWellKnownPropertyAsMember(SyntheticBoundNodeFactory F, WellKnownMember wellKnownProperty, NamedTypeSymbol containingType, out PropertySymbol propertySymbol)
        {
            propertySymbol = F.WellKnownMember(wellKnownProperty) as PropertySymbol;
            if ((object)propertySymbol == null) return false;

            propertySymbol = propertySymbol.AsMember(containingType);
            return true;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:8,代码来源:AsyncMethodBuilderMemberCollection.cs

示例12: TryGetWellKnownMethodAsMember

        private static bool TryGetWellKnownMethodAsMember(SyntheticBoundNodeFactory F, WellKnownMember wellKnownMethod, NamedTypeSymbol containingType, out MethodSymbol methodSymbol)
        {
            methodSymbol = F.WellKnownMember(wellKnownMethod) as MethodSymbol;
            if ((object)methodSymbol == null) return false;

            methodSymbol = methodSymbol.AsMember(containingType);
            return true;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:8,代码来源:AsyncMethodBuilderMemberCollection.cs

示例13: MethodInfo

 public BoundExpression MethodInfo(WellKnownMember method)
 {
     return MethodInfo(WellKnownMethod(method));
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:4,代码来源:SyntheticBoundNodeFactory.cs

示例14: MakeBinderConstruction

        private BoundExpression MakeBinderConstruction(WellKnownMember factoryMethod, BoundExpression[] args)
        {
            var binderFactory = _factory.WellKnownMember(factoryMethod);
            if ((object)binderFactory == null)
            {
                return null;
            }

            return _factory.Call(null, (MethodSymbol)binderFactory, args.AsImmutableOrNull());
        }
开发者ID:Wazner,项目名称:roslyn,代码行数:10,代码来源:LoweredDynamicOperationFactory.cs

示例15: ReportUseSiteDiagnosticForSynthesizedAttribute

        /// <summary>
        /// Report diagnostics that should be reported when using a synthesized attribute. 
        /// </summary>
        internal static void ReportUseSiteDiagnosticForSynthesizedAttribute(
            CSharpCompilation compilation,
            WellKnownMember attributeMember,
            DiagnosticBag diagnostics,
            Location location = null,
            CSharpSyntaxNode syntax = null)
        {
            Debug.Assert((location != null) ^ (syntax != null));

            // Dev11 reports use-site diagnostics when an optional attribute is found but is bad for some other reason 
            // (comes from an unified assembly). When the symbol is not found no error is reported. See test VersionUnification_UseSiteDiagnostics_OptionalAttributes.
            bool isOptional = WellKnownMembers.IsSynthesizedAttributeOptional(attributeMember);

            GetWellKnownTypeMember(compilation, attributeMember, diagnostics, location, syntax, isOptional);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:18,代码来源:Binder.cs


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