80 lines
2.3 KiB
C#
80 lines
2.3 KiB
C#
using System;
|
|
using System.Reflection.Emit;
|
|
|
|
namespace System.Linq.Expressions
|
|
{
|
|
/// <summary>Represents an expression that has a conditional operator.</summary>
|
|
// Token: 0x02000016 RID: 22
|
|
public sealed class ConditionalExpression : Expression
|
|
{
|
|
// Token: 0x06000155 RID: 341 RVA: 0x00008B98 File Offset: 0x00006D98
|
|
internal ConditionalExpression(Expression test, Expression if_true, Expression if_false)
|
|
: base(ExpressionType.Conditional, if_true.Type)
|
|
{
|
|
this.test = test;
|
|
this.if_true = if_true;
|
|
this.if_false = if_false;
|
|
}
|
|
|
|
/// <summary>Gets the test of the conditional operation.</summary>
|
|
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the test of the conditional operation.</returns>
|
|
// Token: 0x17000017 RID: 23
|
|
// (get) Token: 0x06000156 RID: 342 RVA: 0x00008BC8 File Offset: 0x00006DC8
|
|
public Expression Test
|
|
{
|
|
get
|
|
{
|
|
return this.test;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the expression to execute if the test evaluates to true.</summary>
|
|
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is true.</returns>
|
|
// Token: 0x17000018 RID: 24
|
|
// (get) Token: 0x06000157 RID: 343 RVA: 0x00008BD0 File Offset: 0x00006DD0
|
|
public Expression IfTrue
|
|
{
|
|
get
|
|
{
|
|
return this.if_true;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the expression to execute if the test evaluates to false.</summary>
|
|
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is false.</returns>
|
|
// Token: 0x17000019 RID: 25
|
|
// (get) Token: 0x06000158 RID: 344 RVA: 0x00008BD8 File Offset: 0x00006DD8
|
|
public Expression IfFalse
|
|
{
|
|
get
|
|
{
|
|
return this.if_false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000159 RID: 345 RVA: 0x00008BE0 File Offset: 0x00006DE0
|
|
internal override void Emit(EmitContext ec)
|
|
{
|
|
ILGenerator ig = ec.ig;
|
|
Label label = ig.DefineLabel();
|
|
Label label2 = ig.DefineLabel();
|
|
this.test.Emit(ec);
|
|
ig.Emit(OpCodes.Brfalse, label);
|
|
this.if_true.Emit(ec);
|
|
ig.Emit(OpCodes.Br, label2);
|
|
ig.MarkLabel(label);
|
|
this.if_false.Emit(ec);
|
|
ig.MarkLabel(label2);
|
|
}
|
|
|
|
// Token: 0x0400005E RID: 94
|
|
private Expression test;
|
|
|
|
// Token: 0x0400005F RID: 95
|
|
private Expression if_true;
|
|
|
|
// Token: 0x04000060 RID: 96
|
|
private Expression if_false;
|
|
}
|
|
}
|