本文整理汇总了C#中StatementSyntax.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# StatementSyntax.GetType方法的具体用法?C# StatementSyntax.GetType怎么用?C# StatementSyntax.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementSyntax
的用法示例。
在下文中一共展示了StatementSyntax.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlattenStatement
public void FlattenStatement(StatementSyntax ss, List<FlatStatement> instructions)
{
switch (ss.Kind)
{
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.Kind.ToString());
break;
default:
throw new NotImplementedException("statement type " + ss.GetType().ToString() + ": " + ss.Kind.ToString());
break;
}
}
示例2: CompileStatement
protected virtual void CompileStatement(StatementSyntax statement)
{
if (statement is IfStatementSyntax) CompileIfStatement( (IfStatementSyntax) statement);
else if (statement is LocalDeclarationStatementSyntax) CompileLocalDeclarationStatement((LocalDeclarationStatementSyntax)statement);
else if (statement is BlockSyntax) CompileBlock( (BlockSyntax) statement);
else if (statement is ExpressionStatementSyntax) CompileExpressionStatement( (ExpressionStatementSyntax) statement);
else if (statement is ReturnStatementSyntax) CompileReturnStatement( (ReturnStatementSyntax) statement);
else if (statement is ThrowStatementSyntax) CompileThrowStatement( (ThrowStatementSyntax) statement);
else if (statement is StatementSyntax) WriteLine("statement {0}", statement.GetType());
}