Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
InitializeLocalInstruction.cs
Go to the documentation of this file.
5
7
9{
11 {
12 public override string InstructionName => "InitRef";
13
14 internal Reference(int index)
15 : base(index)
16 {
17 }
18
19 public override int Run(InterpretedFrame frame)
20 {
21 frame.Data[_index] = null;
22 return 1;
23 }
24
26 {
27 if (index != _index)
28 {
29 return null;
30 }
32 }
33 }
34
36 {
37 private readonly object _defaultValue;
38
39 public override string InstructionName => "InitImmutableValue";
40
41 internal ImmutableValue(int index, object defaultValue)
42 : base(index)
43 {
44 _defaultValue = defaultValue;
45 }
46
47 public override int Run(InterpretedFrame frame)
48 {
49 frame.Data[_index] = _defaultValue;
50 return 1;
51 }
52
54 {
55 if (index != _index)
56 {
57 return null;
58 }
59 return new ImmutableBox(index, _defaultValue);
60 }
61 }
62
64 {
65 private readonly object _defaultValue;
66
67 public override string InstructionName => "InitImmutableBox";
68
69 internal ImmutableBox(int index, object defaultValue)
70 : base(index)
71 {
72 _defaultValue = defaultValue;
73 }
74
75 public override int Run(InterpretedFrame frame)
76 {
78 return 1;
79 }
80 }
81
83 {
84 public override string InstructionName => "InitImmutableBox";
85
86 internal ImmutableRefBox(int index)
87 : base(index)
88 {
89 }
90
91 public override int Run(InterpretedFrame frame)
92 {
93 frame.Data[_index] = new StrongBox<object>();
94 return 1;
95 }
96 }
97
99 {
100 public override string InstructionName => "InitParameterBox";
101
102 public ParameterBox(int index)
103 : base(index)
104 {
105 }
106
107 public override int Run(InterpretedFrame frame)
108 {
109 frame.Data[_index] = new StrongBox<object>(frame.Data[_index]);
110 return 1;
111 }
112 }
113
115 {
116 public override string InstructionName => "InitParameter";
117
118 internal Parameter(int index)
119 : base(index)
120 {
121 }
122
123 public override int Run(InterpretedFrame frame)
124 {
125 return 1;
126 }
127
129 {
130 if (index == _index)
131 {
133 }
134 return null;
135 }
136 }
137
139 {
140 private readonly Type _type;
141
142 public override string InstructionName => "InitMutableValue";
143
145 : base(index)
146 {
147 _type = type;
148 }
149
150 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2077:UnrecognizedReflectionPattern", Justification = "_type is a ValueType. You can always get an uninitialized ValueType.")]
151 public override int Run(InterpretedFrame frame)
152 {
153 try
154 {
156 }
158 {
161 }
162 return 1;
163 }
164
166 {
167 if (index != _index)
168 {
169 return null;
170 }
171 return new MutableBox(index, _type);
172 }
173 }
174
176 {
177 private readonly Type _type;
178
179 public override string InstructionName => "InitMutableBox";
180
181 internal MutableBox(int index, Type type)
182 : base(index)
183 {
184 _type = type;
185 }
186
187 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2077:UnrecognizedReflectionPattern", Justification = "_type is a ValueType. You can always get an uninitialized ValueType.")]
188 public override int Run(InterpretedFrame frame)
189 {
190 object value;
191 try
192 {
194 }
196 {
199 }
200 frame.Data[_index] = new StrongBox<object>(value);
201 return 1;
202 }
203 }
204
206 : base(index)
207 {
208 }
209}
static ? object CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture)
Definition Activator.cs:17
static void UnwrapAndRethrow(TargetInvocationException exception)
static object GetUninitializedObject([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type)