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


C# SpecialMember类代码示例

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


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

示例1: RewriteDelegateOperation

 private BoundNode RewriteDelegateOperation(BoundBinaryOperator node, SpecialMember member)
 {
     Debug.Assert(node != null);
     var method = (MethodSymbol)this.compilation.Assembly.GetSpecialTypeMember(member);
     // UNDONE: Handle the bizarre error case where we don't have the expected methods.
     Debug.Assert(method != null);
     BoundExpression call = BoundCall.SynthesizedCall(null, method, node.Left, node.Right);
     BoundExpression result = method.ReturnType.SpecialType == SpecialType.System_Delegate ?
         BoundConversion.SynthesizedConversion(call, ConversionKind.ExplicitReference, node.Type) :
         call;
     return Visit(result);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:12,代码来源:OperatorRewriter.cs

示例2: ReportErrorOnSpecialMember

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

示例3: RewriteStringEquality

        private BoundNode RewriteStringEquality(BoundBinaryOperator node, SpecialMember member)
        {
            Debug.Assert(node != null);
            Debug.Assert(node.ConstantValueOpt == null);

            if (node.Left.ConstantValue == ConstantValue.Null || node.Right.ConstantValue == ConstantValue.Null)
            {
                return base.VisitBinaryOperator(node);
            }

            var method = (MethodSymbol)this.compilation.Assembly.GetSpecialTypeMember(member);
            Debug.Assert(method != null);

            return Visit(BoundCall.SynthesizedCall(null, method, node.Left, node.Right));
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:15,代码来源:OperatorRewriter.cs

示例4: SpecialProperty

 public PropertySymbol SpecialProperty(SpecialMember sm)
 {
     return (PropertySymbol)SpecialMember(sm);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:4,代码来源:SyntheticBoundNodeFactory.cs

示例5: SpecialMethod

 public MethodSymbol SpecialMethod(SpecialMember sm)
 {
     return (MethodSymbol)SpecialMember(sm);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:4,代码来源:SyntheticBoundNodeFactory.cs

示例6: SpecialMember

        /// <summary>
        /// Get the symbol for a special member. The use of this method to get a special 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="sm">The desired special member</param>
        /// <returns>A symbol for the special member.</returns>
        public Symbol SpecialMember(SpecialMember sm)
        {
            Symbol specialMember = Compilation.GetSpecialTypeMember(sm);
            if (specialMember == null)
            {
                RuntimeMembers.MemberDescriptor memberDescriptor = SpecialMembers.GetDescriptor(sm);
                SpecialType containingType = (SpecialType)memberDescriptor.DeclaringTypeId;
                var diagnostic = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, containingType.GetMetadataName(), memberDescriptor.Name), Syntax.Location);
                throw new MissingPredefinedMember(diagnostic);
            }

            Binder.ReportUseSiteDiagnostics(specialMember, Diagnostics, Syntax);
            return specialMember;
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:21,代码来源:SyntheticBoundNodeFactory.cs

示例7: OpenPropertyImplementation

 public MethodSymbol OpenPropertyImplementation(NamedTypeSymbol interfaceType, SpecialMember interfaceProperty, bool debuggerHidden = false)
 {
     var methodToImplement = (((PropertySymbol)SpecialMember(interfaceProperty)).GetMethod).AsMember(interfaceType);
     return OpenPropertyImplementation(methodToImplement, debuggerHidden);
 }
开发者ID:nagyist,项目名称:roslyn,代码行数:5,代码来源:SyntheticBoundNodeFactory.cs

示例8: GetDeclaredSpecialTypeMember

        /// <summary>
        /// Lookup member declaration in predefined CorLib type in this Assembly. Only valid if this 
        /// assembly is the Cor Library
        /// </summary>
        internal override Symbol GetDeclaredSpecialTypeMember(SpecialMember member)
        {
#if DEBUG
            foreach (var module in this.Modules)
            {
                Debug.Assert(module.GetReferencedAssemblies().Length == 0);
            }
#endif

            if (_lazySpecialTypeMembers == null || ReferenceEquals(_lazySpecialTypeMembers[(int)member], ErrorTypeSymbol.UnknownResultType))
            {
                if (_lazySpecialTypeMembers == null)
                {
                    var specialTypeMembers = new Symbol[(int)SpecialMember.Count];

                    for (int i = 0; i < specialTypeMembers.Length; i++)
                    {
                        specialTypeMembers[i] = ErrorTypeSymbol.UnknownResultType;
                    }

                    Interlocked.CompareExchange(ref _lazySpecialTypeMembers, specialTypeMembers, null);
                }

                var descriptor = SpecialMembers.GetDescriptor(member);
                NamedTypeSymbol type = GetDeclaredSpecialType((SpecialType)descriptor.DeclaringTypeId);
                Symbol result = null;

                if (!type.IsErrorType())
                {
                    result = CSharpCompilation.GetRuntimeMember(type, ref descriptor, CSharpCompilation.SpecialMembersSignatureComparer.Instance, accessWithinOpt: null);
                }

                Interlocked.CompareExchange(ref _lazySpecialTypeMembers[(int)member], result, ErrorTypeSymbol.UnknownResultType);
            }

            return _lazySpecialTypeMembers[(int)member];
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:41,代码来源:MetadataOrSourceAssemblySymbol.cs

示例9: RewriteStringEquality

        private BoundExpression RewriteStringEquality(BoundBinaryOperator oldNode, CSharpSyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member)
        {
            if (oldNode != null && (loweredLeft.ConstantValue == ConstantValue.Null || loweredRight.ConstantValue == ConstantValue.Null))
            {
                return oldNode.Update(operatorKind, loweredLeft, loweredRight, oldNode.ConstantValueOpt, oldNode.MethodOpt, oldNode.ResultKind, type);
            }

            var method = GetSpecialTypeMethod(syntax, member);
            Debug.Assert((object)method != null);

            return BoundCall.Synthesized(syntax, null, method, loweredLeft, loweredRight);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:LocalRewriter_BinaryOperator.cs

示例10: IsMemberMissing

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

示例11: GetDescriptor

 public static MemberDescriptor GetDescriptor(SpecialMember member)
 {
     return descriptors[(int)member];
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:4,代码来源:SpecialMembers.cs

示例12: GetDeclaredSpecialTypeMember

 internal override Symbol GetDeclaredSpecialTypeMember(SpecialMember member)
 {
     return null;
 }
开发者ID:Wazner,项目名称:roslyn,代码行数:4,代码来源:MissingAssemblySymbol.cs

示例13: GetDeclaredSpecialTypeMember

        /// <summary>
        /// Lookup member declaration in predefined CorLib type in this Assembly. Only valid if this 
        /// assembly is the Cor Library
        /// </summary>
        internal Symbol GetDeclaredSpecialTypeMember(SpecialMember member)
        {
            if (_lazySpecialTypeMembers == null || ReferenceEquals(_lazySpecialTypeMembers[(int)member], ErrorTypeSymbol.UnknownResultType))
            {
                if (_lazySpecialTypeMembers == null)
                {
                    var specialTypeMembers = new Symbol[(int)SpecialMember.Count];

                    for (int i = 0; i < specialTypeMembers.Length; i++)
                    {
                        specialTypeMembers[i] = ErrorTypeSymbol.UnknownResultType;
                    }

                    Interlocked.CompareExchange(ref _lazySpecialTypeMembers, specialTypeMembers, null);
                }

                var descriptor = SpecialMembers.GetDescriptor(member);
                NamedTypeSymbol type = GetDeclaredSpecialType((SpecialType)descriptor.DeclaringTypeId);
                Symbol result = null;

                if (!type.IsErrorType())
                {
                    result = PhpCompilation.GetRuntimeMember(type, ref descriptor, PhpCompilation.SpecialMembersSignatureComparer.Instance, null);
                }

                Interlocked.CompareExchange(ref _lazySpecialTypeMembers[(int)member], result, ErrorTypeSymbol.UnknownResultType);
            }

            return _lazySpecialTypeMembers[(int)member];
        }
开发者ID:iolevel,项目名称:peachpie,代码行数:34,代码来源:AssemblySymbol.cs

示例14: EnsureSpecialPropertyGetter

        /// <summary>
        /// Check that the property and its getter exist and collect any use-site errors.
        /// </summary>
        private void EnsureSpecialPropertyGetter(SpecialMember member, DiagnosticBag bag)
        {
            PropertySymbol symbol = (PropertySymbol)EnsureSpecialMember(member, bag);
            if ((object)symbol != null)
            {
                var getter = symbol.GetMethod;
                if ((object)getter == null)
                {
                    Binder.Error(bag, ErrorCode.ERR_PropertyLacksGet, body.Syntax, symbol);
                    return;
                }

                var info = getter.GetUseSiteDiagnostic();
                if ((object)info != null)
                {
                    bag.Add(new CSDiagnostic(info, body.Syntax.Location));
                }
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:22,代码来源:IteratorRewriter.cs

示例15: EnsureSpecialMember

 private Symbol EnsureSpecialMember(SpecialMember member, DiagnosticBag bag)
 {
     Symbol symbol;
     Binder.TryGetSpecialTypeMember(F.Compilation, member, body.Syntax, bag, out symbol);
     return symbol;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:6,代码来源:IteratorRewriter.cs


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