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


C# CSharp.Symbol类代码示例

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


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


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