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

C# BoundNode类代码示例

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

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



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


示例16: AddBoundTreeAndGetBoundNodeFromMap

 // Adds every syntax/bound pair in a tree rooted at the given bound node to the map, and the
 // performs a lookup of the given syntax node in the map. 
 private BoundNode AddBoundTreeAndGetBoundNodeFromMap(SyntaxNode syntax, BoundNode bound)
 {
     using (nodeMapLock.DisposableWrite())
     {
         NodeMapBuilder.AddToMap(bound, this.guardedNodeMap);
         BoundNode result;
         this.guardedNodeMap.TryGetValue(syntax, out result);
         return result;
     }
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:12,代码来源:ExecutableCodeSemanticModel.cs


示例17: AddBoundNodeToMap

 // Simply add a syntax/bound pair to the map.
 private void AddBoundNodeToMap(SyntaxNode syntax, BoundNode bound)
 {
     using (nodeMapLock.DisposableWrite())
     {
         // Suppose we have bound a subexpression, say "x", and have cached the result in the
         // map. Later on, we bind the parent expression, "x + y" and end up re-binding x. In
         // this situation we do not want to clobber the existing "x" in the map because x
         // might be a complex expression that contains lambda symbols (or, equivalently,
         // lambda parameter symbols). We want to make sure we always get the same symbols
         // out of the cache every time we ask.
         if (!this.guardedNodeMap.ContainsKey(syntax))
         {
             this.guardedNodeMap.Add(syntax, bound);
         }
     }
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:17,代码来源:ExecutableCodeSemanticModel.cs


示例18: Visit

            public override BoundNode Visit(BoundNode node)
            {
                var expression = node as BoundExpression;
                if (expression != null && _resultExpressions.Contains(expression))
                {
                    // Create a temporary to hold the result.

                    var temporary = new BoundTemporary(
                        --_lastTemporaryIndex,
                        _typeManager.CreateType(null, BoundTypeKind.Temporary)
                    );

                    var nodes = new ReadOnlyArray<BoundStatement>.Builder();

                    // Initialize the temporary with the expression.

                    nodes.Add(new BoundSetVariable(
                        temporary,
                        expression,
                        SourceLocation.Missing
                    ));

                    // Copy the temporary to the result.

                    nodes.Add(new BoundSetVariable(
                        _resultTemporary,
                        new BoundGetVariable(temporary),
                        SourceLocation.Missing
                    ));

                    // Return an expression block.

                    return new BoundExpressionBlock(
                        temporary,
                        new BoundBlock(
                            ReadOnlyArray<BoundTemporary>.CreateFrom(temporary),
                            nodes.ToReadOnly(),
                            SourceLocation.Missing
                        )
                    );
                }

                return base.Visit(node);
            }
开发者ID:pvginkel,项目名称:Jint2,代码行数:44,代码来源:ResultRewriterPhase.cs


示例19: Rewrite

 internal static BoundNode Rewrite(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, BoundNode node, DiagnosticBag diagnostics)
 {
     var rewriter = new PlaceholderLocalRewriter(compilation, container, declaredLocals, diagnostics);
     return rewriter.Visit(node);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:5,代码来源:PlaceholderLocalRewriter.cs


示例20: LoadDataSourceFields

 private void LoadDataSourceFields()
 {
     this.EnterLoadingMode();
     IDataSourceFieldSchema[] fieldSchemas = this.GetFieldSchemas();
     if ((fieldSchemas != null) && (fieldSchemas.Length > 0))
     {
         DataFieldNode node = new DataFieldNode(this);
         this._availableFieldsTree.Nodes.Insert(0, node);
         foreach (IDataSourceFieldSchema schema in fieldSchemas)
         {
             BoundNode node2 = new BoundNode(this, schema);
             this._selectedDataSourceNode.Nodes.Add(node2);
         }
         this._selectedDataSourceNode.Expand();
         foreach (IDataSourceFieldSchema schema2 in fieldSchemas)
         {
             if ((schema2.DataType == typeof(bool)) || (schema2.DataType == typeof(bool?)))
             {
                 CheckBoxNode node3 = new CheckBoxNode(this, schema2);
                 this._selectedCheckBoxDataSourceNode.Nodes.Add(node3);
             }
         }
         this._selectedCheckBoxDataSourceNode.Expand();
         this._availableFieldsTree.SelectedNode = node;
         node.EnsureVisible();
     }
     else
     {
         BoundNode node4 = new BoundNode(this, null);
         this._availableFieldsTree.Nodes.Insert(0, node4);
         node4.EnsureVisible();
         CheckBoxNode node5 = new CheckBoxNode(this, null);
         this._availableFieldsTree.Nodes.Insert(1, node5);
         node5.EnsureVisible();
         this._availableFieldsTree.SelectedNode = node4;
     }
     this.ExitLoadingMode();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:38,代码来源:DataControlFieldsEditor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BoundObjectCreationExpression类代码示例发布时间:2022-05-24
下一篇:
C# BoundLocal类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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