71 lines
1.8 KiB
C#
71 lines
1.8 KiB
C#
using System;
|
|
using System.Reflection.Emit;
|
|
|
|
namespace System.Linq.Expressions
|
|
{
|
|
/// <summary>Represents a named parameter expression.</summary>
|
|
// Token: 0x0200002E RID: 46
|
|
public sealed class ParameterExpression : Expression
|
|
{
|
|
// Token: 0x06000248 RID: 584 RVA: 0x0000C004 File Offset: 0x0000A204
|
|
internal ParameterExpression(Type type, string name)
|
|
: base(ExpressionType.Parameter, type)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
/// <summary>Gets the name of the parameter.</summary>
|
|
/// <returns>A <see cref="T:System.String" /> that contains the name of the parameter.</returns>
|
|
// Token: 0x17000033 RID: 51
|
|
// (get) Token: 0x06000249 RID: 585 RVA: 0x0000C018 File Offset: 0x0000A218
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return this.name;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600024A RID: 586 RVA: 0x0000C020 File Offset: 0x0000A220
|
|
private void EmitLocalParameter(EmitContext ec, int position)
|
|
{
|
|
ec.ig.Emit(OpCodes.Ldarg, position);
|
|
}
|
|
|
|
// Token: 0x0600024B RID: 587 RVA: 0x0000C034 File Offset: 0x0000A234
|
|
private void EmitHoistedLocal(EmitContext ec, int level, int position)
|
|
{
|
|
ec.EmitScope();
|
|
for (int i = 0; i < level; i++)
|
|
{
|
|
ec.EmitParentScope();
|
|
}
|
|
ec.EmitLoadLocals();
|
|
ec.ig.Emit(OpCodes.Ldc_I4, position);
|
|
ec.ig.Emit(OpCodes.Ldelem, typeof(object));
|
|
ec.EmitLoadStrongBoxValue(base.Type);
|
|
}
|
|
|
|
// Token: 0x0600024C RID: 588 RVA: 0x0000C09C File Offset: 0x0000A29C
|
|
internal override void Emit(EmitContext ec)
|
|
{
|
|
int num = -1;
|
|
if (ec.IsLocalParameter(this, ref num))
|
|
{
|
|
this.EmitLocalParameter(ec, num);
|
|
return;
|
|
}
|
|
int num2 = 0;
|
|
if (ec.IsHoistedLocal(this, ref num2, ref num))
|
|
{
|
|
this.EmitHoistedLocal(ec, num2, num);
|
|
return;
|
|
}
|
|
throw new InvalidOperationException("Parameter out of scope");
|
|
}
|
|
|
|
// Token: 0x040000BD RID: 189
|
|
private string name;
|
|
}
|
|
}
|