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


C# StatementSyntax.CSharpKind方法代码示例

本文整理汇总了C#中StatementSyntax.CSharpKind方法的典型用法代码示例。如果您正苦于以下问题:C# StatementSyntax.CSharpKind方法的具体用法?C# StatementSyntax.CSharpKind怎么用?C# StatementSyntax.CSharpKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StatementSyntax的用法示例。


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

示例1: AdjustBinderForPositionWithinStatement

        private static Binder AdjustBinderForPositionWithinStatement(int position, Binder binder, StatementSyntax stmt)
        {
            switch (stmt.CSharpKind())
            {
                case SyntaxKind.ForEachStatement:
                    var forEachStmt = (ForEachStatementSyntax)stmt;
                    if (LookupPosition.IsBetweenTokens(position, forEachStmt.InKeyword, forEachStmt.Statement.GetFirstToken()))
                    {
                        binder = binder.Next;
                        Debug.Assert(binder is ScopedExpressionBinder);
                    }
                    break;

                case SyntaxKind.ForStatement:
                    var forStmt = (ForStatementSyntax)stmt;
                    if (LookupPosition.IsBetweenTokens(position, forStmt.OpenParenToken, forStmt.FirstSemicolonToken))
                    {
                        binder = binder.Next;
                        Debug.Assert(binder is ForLoopInitializationBinder);
                    }
                    break;

                case SyntaxKind.SwitchStatement:
                    var switchStmt = (SwitchStatementSyntax)stmt;
                    if (LookupPosition.IsBetweenTokens(position, switchStmt.OpenParenToken, switchStmt.OpenBraceToken))
                    {
                        binder = binder.Next;
                        Debug.Assert(binder is ScopedExpressionBinder);
                    }
                    break;
            }

            return binder;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:34,代码来源:MemberSemanticModel.cs

示例2: WhileBinder

 public WhileBinder(Binder enclosing, StatementSyntax syntax)
     : base(enclosing)
 {
     Debug.Assert(syntax != null && (syntax.CSharpKind() == SyntaxKind.WhileStatement || syntax.CSharpKind() == SyntaxKind.DoStatement));
     this.syntax = syntax;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:6,代码来源:WhileBinder.cs

示例3: FlattenStatement

        public void FlattenStatement(StatementSyntax ss, List<FlatStatement> instructions)
        {
            switch (ss.CSharpKind())
            {
                case SyntaxKind.Block:
                    Flatten((BlockSyntax)ss,instructions);
                    return;
                case SyntaxKind.ExpressionStatement:
                    Flatten((ExpressionStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.ReturnStatement:
                    Flatten((ReturnStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.LocalDeclarationStatement:
                    Flatten((LocalDeclarationStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.ForStatement:
                    Flatten((ForStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.IfStatement:
                    Flatten((IfStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.BreakStatement:
                    Flatten((BreakStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.ContinueStatement:
                    Flatten((ContinueStatementSyntax)ss, instructions);
                    return;
                case SyntaxKind.TryStatement:
                    Flatten((TryStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.DoStatement:
                    Flatten((DoStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.WhileStatement:
                    Flatten((WhileStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.EmptyStatement:
                    // do nothing. :)
                    return;
                case SyntaxKind.SwitchStatement:
                    Flatten((SwitchStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.ThrowStatement:
                    Flatten((ThrowStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.ForEachStatement:
                    Flatten((ForEachStatementSyntax)ss,instructions);
                    return;
                case SyntaxKind.LockStatement:
                    Flatten((LockStatementSyntax)ss, instructions);
                    return;
                case SyntaxKind.UsingStatement:
                    Flatten((UsingStatementSyntax)ss, instructions);
                    return;
                case SyntaxKind.GotoStatement:
                case SyntaxKind.GotoCaseStatement:
                case SyntaxKind.GotoDefaultStatement:
                    Flatten((GotoStatementSyntax)ss, instructions);
                    return;

                case SyntaxKind.CheckedStatement:
                case SyntaxKind.FixedStatement:
                case SyntaxKind.GlobalStatement:
                case SyntaxKind.LabeledStatement:

                case SyntaxKind.UncheckedStatement:
                case SyntaxKind.UnsafeStatement:
                case SyntaxKind.YieldBreakStatement:
                case SyntaxKind.YieldReturnStatement:
                    throw new NotImplementedException("statement type " + ss.GetType().ToString() + ": " + ss.CSharpKind().ToString());
                    break;
                default:
                    throw new NotImplementedException("statement type " + ss.GetType().ToString() + ": " + ss.CSharpKind().ToString());
                    break;
            }
        }
开发者ID:LaxLacks,项目名称:ls2csc,代码行数:77,代码来源:Function.cs


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