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

C# CSharp.BoundNode类代码示例

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

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



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

示例1: 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


示例2: Analyze

        public static MultiDictionary<Symbol, CSharpSyntaxNode> Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node)
        {
            var emptyStructs = new CaptureWalkerEmptyStructTypeCache();
            var initiallyAssignedVariables = UnassignedVariablesWalker.Analyze(compilation, method, node, emptyStructs);

            var walker = new IteratorAndAsyncCaptureWalker(compilation, method, node, emptyStructs, initiallyAssignedVariables);

            bool badRegion = false;
            walker.Analyze(ref badRegion);
            Debug.Assert(!badRegion);

            var result = walker.variablesCaptured;


            if (!method.IsStatic && method.ContainingType.TypeKind == TypeKind.Struct)
            {
                // It is possible that the enclosing method only *writes* to the enclosing struct, but in that
                // case it should be considered captured anyway so that we have a proxy for it to write to.
                result.Add(method.ThisParameter, node.Syntax);
            }

            foreach (var variable in result.Keys.ToArray()) // take a snapshot, as we are modifying the underlying multidictionary
            {
                var local = variable as LocalSymbol;
                if ((object)local != null && local.RefKind != RefKind.None)
                {
                    walker.AddSpillsForRef(walker.refLocalInitializers[local], result[local]);
                }
            }

            walker.Free();
            return result;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:33,代码来源:IteratorAndAsyncCaptureWalker.cs


示例3: Visit

 public override BoundNode Visit(BoundNode node)
 {
     IOperation operation = node as IOperation;
     if (operation != null)
     {
         this.nodes.Add(operation);
         // Following operations are not bound node, therefore have to be added explicitly:
         //  1. IArgument
         //  2. IMemberInitializer
         //  3. ICase
         switch (operation.Kind)
         {
             case OperationKind.InvocationExpression:
                 nodes.AddRange(((IInvocationExpression)operation).ArgumentsInSourceOrder);
                 break;
             case OperationKind.ObjectCreationExpression:
                 var objCreationExp = (IObjectCreationExpression)operation;
                 nodes.AddRange(objCreationExp.ConstructorArguments);
                 nodes.AddRange(objCreationExp.MemberInitializers);
                 break;
             case OperationKind.SwitchStatement:
                 nodes.AddRange(((ISwitchStatement)operation).Cases);
                 break;
         }
     }
     return base.Visit(node);
 }
开发者ID:hughgao,项目名称:roslyn,代码行数:27,代码来源:Expression.cs


示例4: NoteUnsafe

 private void NoteUnsafe(BoundNode node)
 {
     if (_inExpressionLambda && !_reportedUnsafe)
     {
         Error(ErrorCode.ERR_ExpressionTreeContainsPointerOp, node);
         _reportedUnsafe = true;
     }
 }
开发者ID:abock,项目名称:roslyn,代码行数:8,代码来源:DiagnosticsPass_ExpressionTrees.cs


示例5: IssueDiagnostics

        public static void IssueDiagnostics(CSharpCompilation compilation, BoundNode node, DiagnosticBag diagnostics, MethodSymbol containingSymbol)
        {
            Debug.Assert(node != null);
            Debug.Assert((object)containingSymbol != null);

            var diagnosticPass = new DiagnosticsPass(compilation, diagnostics, containingSymbol);
            diagnosticPass.Visit(node);
        }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:8,代码来源:DiagnosticsPass_ExpressionTrees.cs


示例6: IteratorAndAsyncCaptureWalker

 private IteratorAndAsyncCaptureWalker(CSharpCompilation compilation, MethodSymbol method, BoundNode node, CaptureWalkerEmptyStructTypeCache emptyStructCache, HashSet<Symbol> initiallyAssignedVariables)
     : base(compilation, 
           method, 
           node, 
           emptyStructCache, 
           trackUnassignments: true, 
           initiallyAssignedVariables: initiallyAssignedVariables)
 {
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:9,代码来源:IteratorAndAsyncCaptureWalker.cs


示例7: AbstractRegionControlFlowPass

 internal AbstractRegionControlFlowPass(
     CSharpCompilation compilation,
     Symbol member,
     BoundNode node,
     BoundNode firstInRegion,
     BoundNode lastInRegion)
     : base(compilation, member, node, firstInRegion, lastInRegion)
 {
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:AbstractRegionControlFlowPass.cs


示例8: Visit

            public override BoundNode Visit(BoundNode node)
            {
                IOperation operation = node as IOperation;
                if (operation != null)
                {
                    this.nodes.Add(operation);
                }

                return base.Visit(node);
            }
开发者ID:physhi,项目名称:roslyn,代码行数:10,代码来源:Expression.cs


示例9: AbstractRegionDataFlowPass

 internal AbstractRegionDataFlowPass(
     CSharpCompilation compilation,
     Symbol member,
     BoundNode node,
     BoundNode firstInRegion,
     BoundNode lastInRegion,
     HashSet<Symbol> initiallyAssignedVariables = null,
     HashSet<PrefixUnaryExpressionSyntax> unassignedVariableAddressOfSyntaxes = null,
     bool trackUnassignments = false)
     : base(compilation, member, node, firstInRegion, lastInRegion, initiallyAssignedVariables, unassignedVariableAddressOfSyntaxes, trackUnassignments)
 {
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:12,代码来源:AbstractRegionDataFlowPass.cs


示例10: Find

 public static HashSet<LabelSymbol> Find(BoundNode node, Dictionary<BoundNode, HashSet<LabelSymbol>> unmatchedLabelsCache)
 {
     UnmatchedGotoFinder finder = new UnmatchedGotoFinder(unmatchedLabelsCache);
     finder.Visit(node);
     HashSet<LabelSymbol> gotos = finder._gotos;
     HashSet<LabelSymbol> targets = finder._targets;
     if (gotos != null && targets != null)
     {
         gotos.RemoveAll(targets);
     }
     return gotos;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:UnmatchedGotoFinder.cs


示例11: NoteBranch

        protected override void NoteBranch(
            PendingBranch pending,
            BoundNode gotoStmt,
            BoundStatement targetStmt)
        {
            targetStmt.AssertIsLabeledStatement();
            if (!gotoStmt.WasCompilerGenerated && !targetStmt.WasCompilerGenerated && !RegionContains(gotoStmt.Syntax.Span) && RegionContains(targetStmt.Syntax.Span))
            {
                pending.State = ResetState(pending.State);
            }

            base.NoteBranch(pending, gotoStmt, targetStmt);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:13,代码来源:DataFlowsInWalker.cs


示例12: Analyze

        // Returns deterministically ordered list of variables that ought to be hoisted.
        public static OrderedSet<Symbol> Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, DiagnosticBag diagnostics)
        {
            var initiallyAssignedVariables = UnassignedVariablesWalker.Analyze(compilation, method, node, convertInsufficientExecutionStackExceptionToCancelledByStackGuardException: true);
            var walker = new IteratorAndAsyncCaptureWalker(compilation, method, node, new NeverEmptyStructTypeCache(), initiallyAssignedVariables);

            walker._convertInsufficientExecutionStackExceptionToCancelledByStackGuardException = true;

            bool badRegion = false;
            walker.Analyze(ref badRegion);
            Debug.Assert(!badRegion);

            if (!method.IsStatic && method.ContainingType.TypeKind == TypeKind.Struct)
            {
                // It is possible that the enclosing method only *writes* to the enclosing struct, but in that
                // case it should be considered captured anyway so that we have a proxy for it to write to.
                walker.CaptureVariable(method.ThisParameter, node.Syntax);
            }

            var variablesToHoist = walker._variablesToHoist;
            var lazyDisallowedCaptures = walker._lazyDisallowedCaptures;
            var allVariables = walker.variableBySlot;

            walker.Free();

            if (lazyDisallowedCaptures != null)
            {
                foreach (var kvp in lazyDisallowedCaptures)
                {
                    var variable = kvp.Key;
                    var type = (variable.Kind == SymbolKind.Local) ? ((LocalSymbol)variable).Type : ((ParameterSymbol)variable).Type;

                    foreach (CSharpSyntaxNode syntax in kvp.Value)
                    {
                        // CS4013: Instance of type '{0}' cannot be used inside an anonymous function, query expression, iterator block or async method
                        diagnostics.Add(ErrorCode.ERR_SpecialByRefInLambda, syntax.Location, type);
                    }
                }
            }

            if (compilation.Options.OptimizationLevel != OptimizationLevel.Release)
            {
                Debug.Assert(variablesToHoist.Count == 0);

                // In debug build we hoist all locals and parameters:
                variablesToHoist.AddRange(from v in allVariables
                                          where v.Symbol != null && HoistInDebugBuild(v.Symbol)
                                          select v.Symbol);
            }

            return variablesToHoist;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:52,代码来源:IteratorAndAsyncCaptureWalker.cs


示例13: Analyze

 internal static HashSet<Symbol> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, EmptyStructTypeCache emptyStructCache = null)
 {
     var walker = new UnassignedVariablesWalker(compilation, member, node, emptyStructCache);
     try
     {
         bool badRegion = false;
         var result = walker.Analyze(ref badRegion);
         return badRegion ? new HashSet<Symbol>() : result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:14,代码来源:UnassignedVariablesWalker.cs


示例14: Analyze

 internal static IEnumerable<Symbol> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
 {
     var walker = new VariablesDeclaredWalker(compilation, member, node, firstInRegion, lastInRegion);
     try
     {
         bool badRegion = false;
         walker.Analyze(ref badRegion);
         return badRegion ? SpecializedCollections.EmptyEnumerable<Symbol>() : walker._variablesDeclared;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:Rookieek,项目名称:roslyn,代码行数:14,代码来源:VariablesDeclaredWalker.cs


示例15: Analyze

 internal static IEnumerable<Symbol> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
 {
     var walker = new AlwaysAssignedWalker(compilation, member, node, firstInRegion, lastInRegion);
     bool badRegion = false;
     try
     {
         var result = walker.Analyze(ref badRegion);
         return badRegion ? SpecializedCollections.EmptyEnumerable<Symbol>() : result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:14,代码来源:AlwaysAssignedWalker.cs


示例16: IssueDiagnostics

        public static void IssueDiagnostics(CSharpCompilation compilation, BoundNode node, DiagnosticBag diagnostics, MethodSymbol containingSymbol)
        {
            Debug.Assert(node != null);
            Debug.Assert((object)containingSymbol != null);

            try
            {
                var diagnosticPass = new DiagnosticsPass(compilation, diagnostics, containingSymbol);
                diagnosticPass.Visit(node);
            }
            catch (CancelledByStackGuardException ex)
            {
                ex.AddAnError(diagnostics);
            }
        }
开发者ID:abock,项目名称:roslyn,代码行数:15,代码来源:DiagnosticsPass_ExpressionTrees.cs


示例17: Analyze

 internal static HashSet<PrefixUnaryExpressionSyntax> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node)
 {
     var walker = new UnassignedAddressTakenVariablesWalker(compilation, member, node);
     try
     {
         bool badRegion = false;
         var result = walker.Analyze(ref badRegion);
         Debug.Assert(!badRegion);
         return result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:15,代码来源:UnassignedAddressTakenVariablesWalker.cs


示例18: Analyze

 internal static HashSet<Symbol> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion,
     HashSet<Symbol> unassignedVariables, HashSet<PrefixUnaryExpressionSyntax> unassignedVariableAddressOfSyntaxes, out bool? succeeded)
 {
     var walker = new DataFlowsInWalker(compilation, member, node, firstInRegion, lastInRegion, unassignedVariables, unassignedVariableAddressOfSyntaxes);
     try
     {
         bool badRegion = false;
         var result = walker.Analyze(ref badRegion);
         succeeded = !badRegion;
         return badRegion ? new HashSet<Symbol>() : result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:16,代码来源:DataFlowsInWalker.cs


示例19: Analyze

 internal static IEnumerable<StatementSyntax> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
 {
     var walker = new ExitPointsWalker(compilation, member, node, firstInRegion, lastInRegion);
     try
     {
         bool badRegion = false;
         walker.Analyze(ref badRegion);
         var result = walker._branchesOutOf.ToImmutableAndFree();
         walker._branchesOutOf = null;
         return badRegion ? SpecializedCollections.EmptyEnumerable<StatementSyntax>() : result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:16,代码来源:ExitPointsWalker.cs


示例20: Analyze

 internal static IEnumerable<LabeledStatementSyntax> Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion, out bool? succeeded)
 {
     var walker = new EntryPointsWalker(compilation, member, node, firstInRegion, lastInRegion);
     bool badRegion = false;
     try
     {
         walker.Analyze(ref badRegion);
         var result = walker.entryPoints;
         succeeded = !badRegion;
         return badRegion ? SpecializedCollections.EmptyEnumerable<LabeledStatementSyntax>() : result;
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:16,代码来源:EntryPointsWalker.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.BoundReturnStatement类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.BoundMethodGroup类代码示例发布时间: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