Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IndexMethodByRefUpdater.cs
Go to the documentation of this file.
3
5
6internal sealed class IndexMethodByRefUpdater : ByRefUpdater
7{
8 private readonly MethodInfo _indexer;
9
10 private readonly LocalDefinition? _obj;
11
12 private readonly LocalDefinition[] _args;
13
14 public IndexMethodByRefUpdater(LocalDefinition? obj, LocalDefinition[] args, MethodInfo indexer, int argumentIndex)
15 : base(argumentIndex)
16 {
17 _obj = obj;
18 _args = args;
19 _indexer = indexer;
20 }
21
22 public override void Update(InterpretedFrame frame, object value)
23 {
24 object[] array = new object[_args.Length + 1];
25 for (int i = 0; i < array.Length - 1; i++)
26 {
27 array[i] = frame.Data[_args[i].Index];
28 }
29 array[^1] = value;
30 object obj = ((!_obj.HasValue) ? null : frame.Data[_obj.GetValueOrDefault().Index]);
31 try
32 {
34 }
36 {
39 }
40 }
41
42 public override void UndefineTemps(InstructionList instructions, LocalVariables locals)
43 {
44 if (_obj.HasValue)
45 {
46 locals.UndefineLocal(_obj.GetValueOrDefault(), instructions.Count);
47 }
48 for (int i = 0; i < _args.Length; i++)
49 {
50 locals.UndefineLocal(_args[i], instructions.Count);
51 }
52 }
53}
static void UnwrapAndRethrow(TargetInvocationException exception)
override void UndefineTemps(InstructionList instructions, LocalVariables locals)
IndexMethodByRefUpdater(LocalDefinition? obj, LocalDefinition[] args, MethodInfo indexer, int argumentIndex)
override void Update(InterpretedFrame frame, object value)
void UndefineLocal(LocalDefinition definition, int end)
object? Invoke(object? obj, object?[]? parameters)