-
Notifications
You must be signed in to change notification settings - Fork 1
/
Arguments.codegen.cs
88 lines (81 loc) · 3.61 KB
/
Arguments.codegen.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Reflection.Emit;
using JetBrains.Annotations;
namespace ILGeneratorExtensions
{
public static partial class Arguments
{
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, Char value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, Boolean value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, Int32 value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, UInt32 value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, Int64 value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
/// <summary>
/// Overwrite the specified argument with the given value.
/// </summary>
/// <param name="generator">The <see cref="T:System.Reflection.Emit.ILGenerator" /> to emit instructions from</param>
/// <param name="argNum">The index of the argument to store the value in</param>
/// <param name="value">The value to store in the argument</param>
[PublicAPI]
public static ILGenerator OverwriteArgument(this ILGenerator generator, ushort argNum, UInt64 value)
{
return generator.LoadConstant(value)
.StoreInArgument(argNum);
}
}
}