本文整理汇总了C#中expr类的典型用法代码示例。如果您正苦于以下问题:C# expr类的具体用法?C# expr怎么用?C# expr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
expr类属于命名空间,在下文中一共展示了expr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GeneratorExp
internal GeneratorExp(GeneratorExpression expr)
: this() {
ExtractListComprehensionIterators walker = new ExtractListComprehensionIterators();
expr.Function.Body.Walk(walker);
ComprehensionIterator[] iters = walker.Iterators;
Debug.Assert(iters.Length != 0, "A generator expression cannot have zero iterators.");
iters[0] = new ComprehensionFor(((ComprehensionFor)iters[0]).Left, expr.Iterable);
_elt = Convert(walker.Yield.Expression);
_generators = Convert(iters);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:10,代码来源:_ast.cs
示例2: GenerateExpr
private void GenerateExpr(expr expr, ILGenerator ilGenerator)
{
if (expr is int_lit)
{
int_lit e = expr as int_lit;
ilGenerator.Emit(OpCodes.Ldc_I4, e.value);
}
else if (expr is float_lit)
{
float_lit e = expr as float_lit;
ilGenerator.Emit(OpCodes.Ldc_R4, e.value);
}
else if (expr is bool_lit)
{
bool_lit e = expr as bool_lit;
ilGenerator.Emit(OpCodes.Ldc_I4, (e.value ? 1 : 0));
}
else if (expr is string_lit)
{
string_lit e = expr as string_lit;
ilGenerator.Emit(OpCodes.Ldstr, e.value);
}
else if (expr is byte_lit)
{
byte_lit e = expr as byte_lit;
ilGenerator.Emit(OpCodes.Ldc_I4, e.value);
}
else if (expr is getvar)
{
getvar e = expr as getvar;
LoadLocal(e.name, ilGenerator);
}
}
开发者ID:Northcode,项目名称:nvm,代码行数:33,代码来源:ILGenerator.cs
示例3: GetExprTypes
private Type[] GetExprTypes(expr expr)
{
if (expr is expr_list)
{
return (expr as expr_list).list.Select(e => GetExprType(e)).ToArray();
}
else if (expr == null)
{
return null;
}
else
{
return new Type[] { GetExprType(expr) };
}
}
开发者ID:Northcode,项目名称:nvm,代码行数:15,代码来源:ILGenerator.cs
示例4: BinOp
internal BinOp(BinaryExpression expr, @operator op)
: this() {
_left = Convert(expr.Left);
_right = Convert(expr.Right);
_op = op;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:6,代码来源:_ast.cs
示例5: Assign
internal Assign(AssignmentStatement stmt)
: this() {
_targets = PythonOps.MakeEmptyList(stmt.Left.Count);
foreach (Compiler.Ast.Expression expr in stmt.Left)
_targets.Add(Convert(expr, Store.Instance));
_value = Convert(stmt.Right);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:8,代码来源:_ast.cs
示例6: Print
internal Print(PrintStatement stmt)
: this() {
if (stmt.Destination != null)
_dest = Convert(stmt.Destination);
_values = PythonOps.MakeEmptyList(stmt.Expressions.Count);
foreach (Compiler.Ast.Expression expr in stmt.Expressions)
_values.Add(Convert(expr));
_nl = !stmt.TrailingComma;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:11,代码来源:_ast.cs
示例7: Index
internal Index(expr expr)
: this() {
_value = expr;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:4,代码来源:_ast.cs
示例8: Yield
internal Yield(YieldExpression expr)
: this() {
// expr.Expression is never null
_value = Convert(expr.Expression);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:5,代码来源:_ast.cs
示例9: Repr
internal Repr(BackQuoteExpression expr)
: this() {
_value = Convert(expr.Expression);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:4,代码来源:_ast.cs
示例10: Slice
public Slice(SliceExpression expr)
: this() {
if (expr.SliceStart != null)
_lower = Convert(expr.SliceStart);
if (expr.SliceStop != null)
_upper = Convert(expr.SliceStop);
if (expr.StepProvided && expr.SliceStep != null)
_step = Convert(expr.SliceStep);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:9,代码来源:_ast.cs
示例11: Attribute
internal Attribute(MemberExpression attr, expr_context ctx)
: this() {
_value = Convert(attr.Target);
_attr = attr.Name;
_ctx = ctx;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:6,代码来源:_ast.cs
示例12: Subscript
internal Subscript(IndexExpression expr, expr_context ctx)
: this() {
_value = Convert(expr.Target);
AST index = Convert(expr.Index);
if (index is expr)
if (index is Tuple && ((TupleExpression)expr.Index).IsExpandable)
_slice = new ExtSlice(((Tuple)index).elts);
else
_slice = new Index((expr)index);
else if (index is slice) // includes Ellipsis
_slice = (slice)index;
else
throw new ArgumentTypeException("Unexpected index expression: " + expr.Index.GetType());
_ctx = ctx;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:16,代码来源:_ast.cs
示例13: UnaryOp
internal UnaryOp(UnaryExpression expression)
: this() {
_op = (unaryop)Convert(expression.Op);
_operand = Convert(expression.Expression);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:5,代码来源:_ast.cs
示例14: GetExprType
private Type GetExprType(expr e)
{
if (e is int_lit)
{
return typeof(int);
}
else if (e is float_lit)
{
return typeof(float);
}
else if (e is bool_lit)
{
return typeof(bool);
}
else if (e is byte_lit)
{
return typeof(byte);
}
else if (e is string_lit)
{
return typeof(string);
}
else if (e is getvar)
{
return GetVarType(e);
}
else if (e is function_call)
{
function_call stmt = e as function_call;
return GetMethodInfo(stmt.name, null, null, GetMethodTypes(stmt.name, null, GetExprTypes(stmt.arg))).ReturnType;
}
else if (e == null)
{
return null;
}
else
{
throw new Exception("Cannot find argument type");
}
}
开发者ID:Northcode,项目名称:nvm,代码行数:40,代码来源:ILGenerator.cs
示例15: With
internal With(WithStatement with)
: this() {
_context_expr = Convert(with.ContextManager);
if (with.Variable != null)
_optional_vars = Convert(with.Variable);
_body = ConvertStatements(with.Body);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:8,代码来源:_ast.cs
示例16: GetVarType
private Type GetVarType(expr e)
{
throw new NotImplementedException();
}
开发者ID:Northcode,项目名称:nvm,代码行数:4,代码来源:ILGenerator.cs
示例17: AugAssign
internal AugAssign(AugmentedAssignStatement stmt)
: this() {
_target = Convert(stmt.Left, Store.Instance);
_value = Convert(stmt.Right);
_op = (@operator)Convert(stmt.Operator);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:6,代码来源:_ast.cs
示例18: keyword
internal keyword(IronPython.Compiler.Ast.Arg arg)
: this() {
_arg = arg.Name;
_value = Convert(arg.Expression);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:5,代码来源:_ast.cs
示例19: Raise
internal Raise(RaiseStatement stmt)
: this() {
if (stmt.ExceptType != null)
_type = Convert(stmt.ExceptType);
if (stmt.Value != null)
_inst = Convert(stmt.Value);
if (stmt.Traceback != null)
_tback = Convert(stmt.Traceback);
}
开发者ID:rchandrashekara,项目名称:main,代码行数:9,代码来源:_ast.cs
示例20: Lambda
internal Lambda(LambdaExpression lambda)
: this() {
FunctionDef def = (FunctionDef)Convert(lambda.Function);
_args = def.args;
Debug.Assert(def.body.Count == 1, "LambdaExpression body should be one Return statement.");
_body = ((Return)def.body[0]).value;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:7,代码来源:_ast.cs
注:本文中的expr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论