本文整理汇总了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;
}
示例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;
}
示例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;
}
}