• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.Symbol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BinderWithContainingMemberOrLambda

            internal BinderWithContainingMemberOrLambda(Binder next, BinderFlags flags, Symbol containingMemberOrLambda)
                : base(next, flags)
            {
                Debug.Assert(containingMemberOrLambda != null);

                _containingMemberOrLambda = containingMemberOrLambda;
            }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:Binder_Flags.cs


示例2: Analyze

        internal static void Analyze(
            CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion, HashSet<PrefixUnaryExpressionSyntax> unassignedVariableAddressOfSyntaxes,
            out IEnumerable<Symbol> readInside,
            out IEnumerable<Symbol> writtenInside,
            out IEnumerable<Symbol> readOutside,
            out IEnumerable<Symbol> writtenOutside,
            out IEnumerable<Symbol> captured,
            out IEnumerable<Symbol> unsafeAddressTaken)
        {
            var walker = new ReadWriteWalker(compilation, member, node, firstInRegion, lastInRegion, unassignedVariableAddressOfSyntaxes);
            try
            {
                bool badRegion = false;
                walker.Analyze(ref badRegion);
                if (badRegion)
                {
                    readInside = writtenInside = readOutside = writtenOutside = captured = unsafeAddressTaken = Enumerable.Empty<Symbol>();
                }
                else
                {
                    readInside = walker._readInside;
                    writtenInside = walker._writtenInside;
                    readOutside = walker._readOutside;
                    writtenOutside = walker._writtenOutside;

                    captured = walker.GetCaptured();
                    unsafeAddressTaken = walker.GetUnsafeAddressTaken();
                }
            }
            finally
            {
                walker.Free();
            }
        }
开发者ID:,项目名称:,代码行数:34,代码来源:


示例3: BindCref

 internal ImmutableArray<Symbol> BindCref(CrefSyntax syntax, out Symbol ambiguityWinner, DiagnosticBag diagnostics)
 {
     ImmutableArray<Symbol> symbols = BindCrefInternal(syntax, out ambiguityWinner, diagnostics);
     Debug.Assert(!symbols.IsDefault, "Prefer empty to null.");
     Debug.Assert((symbols.Length > 1) == ((object)ambiguityWinner != null), "ambiguityWinner should be set iff more than one symbol is returned.");
     return symbols;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:7,代码来源:Binder_Crefs.cs


示例4: ReportUnassigned

 protected override void ReportUnassigned(Symbol symbol, SyntaxNode node)
 {
     if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
     {
         _result.Add((PrefixUnaryExpressionSyntax)node.Parent);
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:UnassignedAddressTakenVariablesWalker.cs


示例5: MethodGroupResolution

        public MethodGroupResolution(
            MethodGroup methodGroup,
            Symbol otherSymbol,
            OverloadResolutionResult<MethodSymbol> overloadResolutionResult,
            AnalyzedArguments analyzedArguments,
            LookupResultKind resultKind,
            ImmutableArray<Diagnostic> diagnostics,
            bool extensionMethodsOfSameViabilityAreAvailable)
        {
            Debug.Assert((methodGroup == null) || (methodGroup.Methods.Count > 0));
            Debug.Assert((methodGroup == null) || ((object)otherSymbol == null));
            // Methods should be represented in the method group.
            Debug.Assert(((object)otherSymbol == null) || (otherSymbol.Kind != SymbolKind.Method));
            Debug.Assert(resultKind != LookupResultKind.Ambiguous); // HasAnyApplicableMethod is expecting Viable methods.
            Debug.Assert(!diagnostics.IsDefault);
            Debug.Assert(!extensionMethodsOfSameViabilityAreAvailable || methodGroup == null || !methodGroup.IsExtensionMethodGroup);

            this.MethodGroup = methodGroup;
            this.OtherSymbol = otherSymbol;
            this.OverloadResolutionResult = overloadResolutionResult;
            this.AnalyzedArguments = analyzedArguments;
            this.ResultKind = resultKind;
            this.Diagnostics = diagnostics;
            this.ExtensionMethodsOfSameViabilityAreAvailable = extensionMethodsOfSameViabilityAreAvailable;
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:25,代码来源:MethodGroupResolution.cs


示例6: BindQualifiedCref

 private ImmutableArray<Symbol> BindQualifiedCref(QualifiedCrefSyntax syntax, out Symbol ambiguityWinner, DiagnosticBag diagnostics)
 {
     // NOTE: we won't check whether container is an error type - we'll just let BindMemberCref fail
     // and report a blanket diagnostic.
     NamespaceOrTypeSymbol container = BindNamespaceOrTypeSymbolInCref(syntax.Container);
     return BindMemberCref(syntax.Member, container, out ambiguityWinner, diagnostics);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:7,代码来源:Binder_Crefs.cs


示例7: CheckArguments

 private void CheckArguments(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<BoundExpression> arguments, Symbol method)
 {
     if (!argumentRefKindsOpt.IsDefault)
     {
         Debug.Assert(arguments.Length == argumentRefKindsOpt.Length);
         for (int i = 0; i < arguments.Length; i++)
         {
             if (argumentRefKindsOpt[i] != RefKind.None)
             {
                 var argument = arguments[i];
                 switch (argument.Kind)
                 {
                     case BoundKind.FieldAccess:
                         CheckFieldAddress((BoundFieldAccess)argument, method);
                         break;
                     case BoundKind.Local:
                         var local = (BoundLocal)argument;
                         if (local.Syntax.Kind() == SyntaxKind.DeclarationExpression)
                         {
                             CheckOutDeclaration(local, method);
                         }
                         break;
                 }
             }
         }
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:DiagnosticsPass_Warnings.cs


示例8: DecisionTreeBuilder

 protected DecisionTreeBuilder(
     Symbol enclosingSymbol,
     Conversions conversions)
 {
     this._enclosingSymbol = enclosingSymbol;
     this._conversions = conversions;
 }
开发者ID:genlu,项目名称:roslyn,代码行数:7,代码来源:DecisionTreeBuilder.cs


示例9: ExecutableCodeBinder

 internal ExecutableCodeBinder(CSharpSyntaxNode root, Symbol memberSymbol, Binder next, BinderFlags additionalFlags)
     : base(next, (next.Flags | additionalFlags) & ~BinderFlags.AllClearedAtExecutableCodeBoundary)
 {
     this.memberSymbol = memberSymbol;
     this.root = root;
     this.owner = memberSymbol as MethodSymbol;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:ExecutableCodeBinder.cs


示例10: SubsumptionDiagnosticBuilder

 internal SubsumptionDiagnosticBuilder(Symbol enclosingSymbol,
                                        Conversions conversions,
                                        BoundExpression expression)
     : base(enclosingSymbol, conversions)
 {
     _subsumptionTree = DecisionTree.Create(expression, expression.Type, enclosingSymbol);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:SubsumptionDiagnosticBuilder.cs


示例11: RegionAnalysisContext

        /// <summary>
        /// Construct context
        /// </summary>
        public RegionAnalysisContext(CSharpCompilation compilation, Symbol member, BoundNode boundNode, BoundNode firstInRegion, BoundNode lastInRegion)
        {
            this.Compilation = compilation;
            this.Member = member;
            this.BoundNode = boundNode;
            this.FirstInRegion = firstInRegion;
            this.LastInRegion = lastInRegion;
            this.Failed =
                boundNode == null ||
                firstInRegion == null ||
                lastInRegion == null ||
                firstInRegion.Syntax.SpanStart > lastInRegion.Syntax.Span.End;

            if (!this.Failed && ReferenceEquals(firstInRegion, lastInRegion))
            {
                switch (firstInRegion.Kind)
                {
                    case BoundKind.NamespaceExpression:
                    case BoundKind.TypeExpression:

                        // Some bound nodes are still considered to be invalid for flow analysis
                        this.Failed = true;
                        break;
                }
            }
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:29,代码来源:RegionAnalysisContext.cs


示例12: GetCapturedVariableFieldName

        private static string GetCapturedVariableFieldName(Symbol variable, ref int uniqueId)
        {
            if (IsThis(variable))
            {
                return GeneratedNames.ThisProxyFieldName();
            }

            var local = variable as LocalSymbol;
            if ((object)local != null)
            {
                if (local.SynthesizedKind == SynthesizedLocalKind.LambdaDisplayClass)
                {
                    return GeneratedNames.MakeLambdaDisplayLocalName(uniqueId++);
                }

                if (local.SynthesizedKind == SynthesizedLocalKind.ExceptionFilterAwaitHoistedExceptionLocal)
                {
                    return GeneratedNames.MakeHoistedLocalFieldName(local.SynthesizedKind, uniqueId++);
                }

                if (local.SynthesizedKind == SynthesizedLocalKind.InstrumentationPayload)
                {
                    return GeneratedNames.MakeSynthesizedInstrumentationPayloadLocalFieldName(uniqueId++);
                }
            }

            Debug.Assert(variable.Name != null);
            return variable.Name;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:29,代码来源:LambdaCapturedVariable.cs


示例13: Visit

 public virtual void Visit(Symbol symbol)
 {
     if ((object)symbol != null)
     {
         symbol.Accept(this);
     }
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:7,代码来源:SymbolVisitor.cs


示例14: CheckSymbolKind

 private static void CheckSymbolKind(Symbol symbol)
 {
     switch (symbol.Kind)
     {
         case SymbolKind.ErrorType:
         case SymbolKind.NamedType:
         case SymbolKind.Event:
         case SymbolKind.Field:
         case SymbolKind.Method:
         case SymbolKind.Property:
         case SymbolKind.TypeParameter:
             break; // Can sensibly append location.
         case SymbolKind.ArrayType:
         case SymbolKind.PointerType:
         case SymbolKind.Parameter:
             break; // Can sensibly append location, after unwrapping.
         case SymbolKind.DynamicType:
             break; // Can't sensibly append location, but it should never be ambiguous.
         case SymbolKind.Namespace:
         case SymbolKind.Alias:
         case SymbolKind.Assembly:
         case SymbolKind.NetModule:
         case SymbolKind.Label:
         case SymbolKind.Local:
         case SymbolKind.RangeVariable:
         case SymbolKind.Preprocessing:
         default:
             throw ExceptionUtilities.UnexpectedValue(symbol.Kind);
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:30,代码来源:SymbolDistinguisher.cs


示例15: Create

        public static DecisionTree Create(BoundExpression expression, TypeSymbol type, Symbol enclosingSymbol)
        {
            Debug.Assert(expression.Type == type);
            LocalSymbol temp = null;
            if (expression.ConstantValue == null)
            {
                // Unless it is a constant, the decision tree acts on a copy of the input expression.
                // We create a temp to represent that copy. Lowering will assign into this temp.
                temp = new SynthesizedLocal(enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, expression.Syntax, false, RefKind.None);
                expression = new BoundLocal(expression.Syntax, temp, null, type);
            }

            if (expression.Type.CanBeAssignedNull())
            {
                // We need the ByType decision tree to separate null from non-null values.
                // Note that, for the purpose of the decision tree (and subsumption), we
                // ignore the fact that the input may be a constant, and therefore always
                // or never null.
                return new ByType(expression, type, temp);
            }
            else
            {
                // If it is a (e.g. builtin) value type, we can switch on its (constant) values.
                // If it isn't a builtin, in practice we will only use the Default part of the
                // ByValue.
                return new ByValue(expression, type, temp);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:28,代码来源:DecisionTree.cs


示例16: LazyObsoleteDiagnosticInfo

 internal LazyObsoleteDiagnosticInfo(Symbol symbol, Symbol containingSymbol, BinderFlags binderFlags)
     : base(CSharp.MessageProvider.Instance, (int)ErrorCode.Unknown)
 {
     this.symbol = symbol;
     this.containingSymbol = containingSymbol;
     this.binderFlags = binderFlags;
     this.lazyActualObsoleteDiagnostic = null;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:LazyObsoleteDiagnosticInfo.cs


示例17: MethodBodySemanticModel

 private MethodBodySemanticModel(CSharpCompilation compilation, Symbol owner, Binder rootBinder, CSharpSyntaxNode syntax, SyntaxTreeSemanticModel parentSemanticModelOpt = null, int speculatedPosition = 0)
     : base(compilation, syntax, owner, rootBinder, parentSemanticModelOpt, speculatedPosition)
 {
     Debug.Assert((object)owner != null);
     Debug.Assert(owner.Kind == SymbolKind.Method);
     Debug.Assert(syntax != null);
     Debug.Assert(owner.ContainingType.IsScriptClass || syntax.Kind != SyntaxKind.CompilationUnit);
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:MethodBodySemanticModel.cs


示例18: IsSymbolAccessible

 /// <summary>
 /// Checks if 'symbol' is accessible from within assembly 'within'.  
 /// </summary>
 public static bool IsSymbolAccessible(
     Symbol symbol,
     AssemblySymbol within,
     ref HashSet<DiagnosticInfo> useSiteDiagnostics)
 {
     bool failedThroughTypeCheck;
     return IsSymbolAccessibleCore(symbol, within, null, out failedThroughTypeCheck, within.DeclaringCompilation, ref useSiteDiagnostics);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:AccessCheck.cs


示例19: Create

        public static LambdaCapturedVariable Create(LambdaFrame frame, Symbol captured, ref int uniqueId)
        {
            Debug.Assert(captured is LocalSymbol || captured is ParameterSymbol);

            string fieldName = GetCapturedVariableFieldName(captured, ref uniqueId);
            TypeSymbol type = GetCapturedVariableFieldType(frame, captured);
            return new LambdaCapturedVariable(frame, type, fieldName, IsThis(captured));
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:8,代码来源:LambdaCapturedVariable.cs


示例20: ReportUnassigned

 protected override void ReportUnassigned(Symbol symbol, SyntaxNode node)
 {
     // TODO: how to handle fields of structs?
     if (symbol.Kind != SymbolKind.Field)
     {
         _result.Add(symbol);
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:8,代码来源:UnassignedVariablesWalker.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.SyntaxTreeSemanticModel类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.Location类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap