本文整理汇总了C#中IronPython.Compiler.Ast.Statement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Statement.GetType方法的具体用法?C# Statement.GetType怎么用?C# Statement.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Compiler.Ast.Statement
的用法示例。
在下文中一共展示了Statement.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
internal static stmt Convert(Statement stmt) {
stmt ast;
if (stmt is FunctionDefinition)
ast = new FunctionDef((FunctionDefinition)stmt);
else if (stmt is ReturnStatement)
ast = new Return((ReturnStatement)stmt);
else if (stmt is AssignmentStatement)
ast = new Assign((AssignmentStatement)stmt);
else if (stmt is AugmentedAssignStatement)
ast = new AugAssign((AugmentedAssignStatement)stmt);
else if (stmt is DelStatement)
ast = new Delete((DelStatement)stmt);
else if (stmt is PrintStatement)
ast = new Print((PrintStatement)stmt);
else if (stmt is ExpressionStatement)
ast = new Expr((ExpressionStatement)stmt);
else if (stmt is ForStatement)
ast = new For((ForStatement)stmt);
else if (stmt is WhileStatement)
ast = new While((WhileStatement)stmt);
else if (stmt is IfStatement)
ast = new If((IfStatement)stmt);
else if (stmt is WithStatement)
ast = new With((WithStatement)stmt);
else if (stmt is RaiseStatement)
ast = new Raise((RaiseStatement)stmt);
else if (stmt is TryStatement)
ast = Convert((TryStatement)stmt);
else if (stmt is AssertStatement)
ast = new Assert((AssertStatement)stmt);
else if (stmt is ImportStatement)
ast = new Import((ImportStatement)stmt);
else if (stmt is FromImportStatement)
ast = new ImportFrom((FromImportStatement)stmt);
else if (stmt is ExecStatement)
ast = new Exec((ExecStatement)stmt);
else if (stmt is GlobalStatement)
ast = new Global((GlobalStatement)stmt);
else if (stmt is ClassDefinition)
ast = new ClassDef((ClassDefinition)stmt);
else if (stmt is BreakStatement)
ast = new Break();
else if (stmt is ContinueStatement)
ast = new Continue();
else if (stmt is EmptyStatement)
ast = new Pass();
else
throw new ArgumentTypeException("Unexpected statement type: " + stmt.GetType());
ast.GetSourceLocation(stmt);
return ast;
}