Skip to content

Commit

Permalink
EmitLoadOpCodeForConstantValue is now obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Mar 1, 2021
1 parent 8079b9e commit 2778d33
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/Castle.Core/DynamicProxy/Generators/Emitters/OpCodeUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,6 @@ public static void EmitLoadIndirectOpCodeForType(ILGenerator gen, Type type)
}
}

/// <summary>
/// Emits a load opcode of the appropriate kind for a constant string or
/// primitive value.
/// </summary>
public static void EmitLoadOpCodeForConstantValue(ILGenerator gen, object value)
{
if (value is string)
{
gen.Emit(OpCodes.Ldstr, value.ToString());
}
else if (value is Int32)
{
var code = LdcOpCodesDictionary.Instance[value.GetType()];
gen.Emit(code, (int)value);
}
else if (value is bool)
{
var code = LdcOpCodesDictionary.Instance[value.GetType()];
gen.Emit(code, Convert.ToInt32(value));
}
else
{
throw new NotSupportedException();
}
}

/// <summary>
/// Emits a load opcode of the appropriate kind for the constant default value of a
/// type, such as 0 for value types and null for reference types.
Expand Down

0 comments on commit 2778d33

Please sign in to comment.