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


C# BoundNode类代码示例

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


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

示例1: Rewrite

        internal static BoundNode Rewrite(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, BoundNode node)
        {
            var builder = ArrayBuilder<BoundStatement>.GetInstance();
            bool hasChanged;

            // Rewrite top-level declarations only.
            switch (node.Kind)
            {
                case BoundKind.LocalDeclaration:
                    RewriteLocalDeclaration(compilation, container, declaredLocals, builder, (BoundLocalDeclaration)node);
                    hasChanged = true;
                    break;
                case BoundKind.MultipleLocalDeclarations:
                    foreach (var declaration in ((BoundMultipleLocalDeclarations)node).LocalDeclarations)
                    {
                        RewriteLocalDeclaration(compilation, container, declaredLocals, builder, declaration);
                    }
                    hasChanged = true;
                    break;
                default:
                    hasChanged = false;
                    break;
            }

            if (hasChanged)
            {
                node = new BoundBlock(node.Syntax, ImmutableArray<LocalSymbol>.Empty, builder.ToImmutable()) { WasCompilerGenerated = true };
            }

            builder.Free();
            return node;
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:32,代码来源:LocalDeclarationRewriter.cs

示例2: Visit

 public override BoundNode Visit(BoundNode node)
 {
     if (_mayHaveSideEffects)
     {
         return null;
     }
     return base.Visit(node);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:8,代码来源:MayHaveSideEffectsVisitor.cs

示例3: Visit

 public override BoundNode Visit(BoundNode node)
 {
     var expression = node as BoundExpression;
     if (expression != null)
     {
         _typeParameterChecker.Visit(expression.ExpressionSymbol);
     }
     return base.Visit(node);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:TypeParameterChecker.cs

示例4: Visit

        protected override void Visit(BoundNode node)
        {
            if (node != null && node.Syntax != null)
            {
                NoteLocation(node.Syntax.Span);
            }

            base.Visit(node);
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:RegionAnalysisWalker.cs

示例5: Rewrite

 internal static BoundNode Rewrite(
     ParameterSymbol targetMethodThisParameter,
     Conversions conversions,
     ImmutableDictionary<string, DisplayClassVariable> displayClassVariables,
     BoundNode node,
     DiagnosticBag diagnostics)
 {
     var rewriter = new CapturedVariableRewriter(targetMethodThisParameter, conversions, displayClassVariables, diagnostics);
     return rewriter.Visit(node);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:10,代码来源:CapturedVariableRewriter.cs

示例6: Visit

 public override BoundNode Visit(BoundNode node)
 {
     var expression = node as BoundExpression;
     if (expression != null)
     {
         var constantValue = expression.ConstantValue;
         if (constantValue != null && constantValue.IsDecimal)
         {
             return RewriteConstant(expression);
         }
     }
     return base.Visit(node);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:13,代码来源:DecimalRewriter.cs

示例7: Classify

		/// <summary>
		///     Classifies the operations performed on the <paramref name="variable" /> within the <paramref name="node" />.
		/// </summary>
		/// <param name="node">The node of a bound tree the <paramref name="variable" /> should be classified for.</param>
		/// <param name="variable">The variable that should be classified.</param>
		public static VariableOperations Classify(BoundNode node, VariableMetadata variable)
		{
			Requires.NotNull(node, () => node);
			Requires.NotNull(variable, () => variable);

			_instance._writeContext = 0;
			_instance._operations = VariableOperations.None;
			_instance._variable = variable;
			_instance.Visit(node);

			Assert.That(_instance._writeContext == 0, "Unbalanced write context operations.");
			return _instance._operations;
		}
开发者ID:cubeme,项目名称:safety-sharp,代码行数:18,代码来源:VariableAccessClassifier.cs

示例8: Analyze

 internal static IEnumerable<StatementSyntax> Analyze(Compilation compilation, MethodSymbol sourceMethod, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
 {
     var walker = new ReturnStatementsWalker(compilation, sourceMethod, node, firstInRegion, lastInRegion);
     try
     {
         bool badRegion = false;
         walker.Analyze(ref badRegion);
         return badRegion ? Enumerable.Empty<StatementSyntax>() : walker.returnStatements.ToArray();
     }
     finally
     {
         walker.Free();
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:14,代码来源:ReturnStatementsWalker.cs

示例9: Visit

 public override BoundNode Visit(BoundNode node)
 {
     if (found == null)
     {
         if (node != null && !node.WasCompilerGenerated && node.Syntax == syntax)
         {
             found = node;
         }
         else
         {
             base.Visit(node);
         }
     }
     return null;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:15,代码来源:MemberSemanticModel.BoundChildFinder.cs

示例10: Visit

 public override BoundNode Visit(BoundNode node)
 {
     if (node != null) //e.g. static method invocations have null receivers
     {
         _list.Add(node);
     }
     return base.Visit(node);
 }
开发者ID:jeffanders,项目名称:roslyn,代码行数:8,代码来源:ConstantTests.cs

示例11: GetNodes

 public static IEnumerable<BoundNode> GetNodes(BoundNode root)
 {
     var s = new BoundTreeSequencer();
     s.Visit(root);
     foreach (var node in s._list)
         yield return node;
 }
开发者ID:jeffanders,项目名称:roslyn,代码行数:7,代码来源:ConstantTests.cs

示例12: VisitStatement

        public BoundNode VisitStatement(BoundNode node)
        {
            Debug.Assert(node == null || EvalStackIsEmpty());

            var origStack = StackDepth();
            var prevContext = _context;

            var result = base.Visit(node);

            _context = prevContext;
            SetStackDepth(origStack);
            _counter += 1;

            return result;
        }
开发者ID:redjbishop,项目名称:roslyn,代码行数:15,代码来源:Optimizer.cs

示例13: Visit

            public override BoundNode Visit(BoundNode node)
            {
                if (!_found)
                {
                    return base.Visit(node);
                }

                return null;
            }
开发者ID:rosslyn-cuongle,项目名称:roslyn,代码行数:9,代码来源:Optimizer.cs

示例14: LhsUsesStackWhenAssignedTo

        // here we have a case of indirect assignment:  *t1 = expr;
        // normally we would need to push t1 and that will cause spilling of t2
        //
        // TODO: an interesting case arises in unused x[i]++  and ++x[i] :
        //       we have trees that look like:
        //
        //  t1 = &(x[0])
        //  t2 = *t1
        //  *t1 = t2 + 1
        //
        //  t1 = &(x[0])
        //  t2 = *t1 + 1
        //  *t1 = t2
        //
        //  in these cases, we could keep t2 on stack (dev10 does).
        //  we are dealing with exactly 2 locals and access them in strict order 
        //  t1, t2, t1, t2  and we are not using t2 after that.
        //  We may consider detecting exactly these cases and pretend that we do not need 
        //  to push either t1 or t2 in this case.
        //
        private bool LhsUsesStackWhenAssignedTo(BoundNode node, ExprContext context)
        {
            Debug.Assert(context == ExprContext.AssignmentTarget);

            switch (node.Kind)
            {
                case BoundKind.Parameter:
                case BoundKind.Local:
                    return false;

                case BoundKind.FieldAccess:
                    return !((BoundFieldAccess)node).FieldSymbol.IsStatic;

                case BoundKind.Sequence:
                    return LhsUsesStackWhenAssignedTo(((BoundSequence)node).Value, context);
            }

            return true;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:39,代码来源:Optimizer.cs

示例15: Check

 public static void Check(BoundNode node, ImmutableArray<TypeParameterSymbol> acceptableTypeParameters)
 {
     new BlockChecker(new TypeParameterChecker(acceptableTypeParameters)).Visit(node);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:TypeParameterChecker.cs


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