本文整理汇总了C#中AstExpression.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# AstExpression.GetType方法的具体用法?C# AstExpression.GetType怎么用?C# AstExpression.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstExpression
的用法示例。
在下文中一共展示了AstExpression.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
internal static expr Convert(AstExpression expr, expr_context ctx)
{
expr ast;
if (expr is ConstantExpression)
ast = Convert((ConstantExpression)expr);
else if (expr is NameExpression)
ast = new Name((NameExpression)expr, ctx);
else if (expr is UnaryExpression)
ast = new UnaryOp((UnaryExpression)expr);
else if (expr is BinaryExpression)
ast = Convert((BinaryExpression)expr);
else if (expr is AndExpression)
ast = new BoolOp((AndExpression)expr);
else if (expr is OrExpression)
ast = new BoolOp((OrExpression)expr);
else if (expr is CallExpression)
ast = new Call((CallExpression)expr);
else if (expr is ParenthesisExpression)
return Convert(((ParenthesisExpression)expr).Expression);
else if (expr is LambdaExpression)
ast = new Lambda((LambdaExpression)expr);
else if (expr is ListExpression)
ast = new List((ListExpression)expr, ctx);
else if (expr is TupleExpression)
ast = new Tuple((TupleExpression)expr, ctx);
else if (expr is DictionaryExpression)
ast = new Dict((DictionaryExpression)expr);
else if (expr is ListComprehension)
ast = new ListComp((ListComprehension)expr);
else if (expr is GeneratorExpression)
ast = new GeneratorExp((GeneratorExpression)expr);
else if (expr is MemberExpression)
ast = new Attribute((MemberExpression)expr, ctx);
else if (expr is YieldExpression)
ast = new Yield((YieldExpression)expr);
else if (expr is ConditionalExpression)
ast = new IfExp((ConditionalExpression)expr);
else if (expr is IndexExpression)
ast = new Subscript((IndexExpression)expr, ctx);
else if (expr is BackQuoteExpression)
ast = new Repr((BackQuoteExpression)expr);
else if (expr is SetExpression)
ast = new Set((SetExpression)expr);
else if (expr is DictionaryComprehension)
ast = new DictComp((DictionaryComprehension)expr);
else if (expr is SetComprehension)
ast = new SetComp((SetComprehension)expr);
else
throw new ArgumentTypeException("Unexpected expression type: " + expr.GetType());
ast.GetSourceLocation(expr);
return ast;
}