Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateAndExecute3< T0, T1, T2, TRet >()

static TRet System.Dynamic.UpdateDelegates.UpdateAndExecute3< T0, T1, T2, TRet > ( CallSite site,
T0 arg0,
T1 arg1,
T2 arg2 )
inlinestaticpackage

Definition at line 176 of file UpdateDelegates.cs.

177 {
179 Func<CallSite, T0, T1, T2, TRet> target = callSite.Target;
180 site = callSite.GetMatchmaker();
181 Func<CallSite, T0, T1, T2, TRet>[] rules;
182 Func<CallSite, T0, T1, T2, TRet> func;
183 if ((rules = CallSiteOps.GetRules(callSite)) != null)
184 {
185 for (int i = 0; i < rules.Length; i++)
186 {
187 func = rules[i];
188 if ((object)func != target)
189 {
190 callSite.Target = func;
191 TRet result = func(site, arg0, arg1, arg2);
192 if (CallSiteOps.GetMatch(site))
193 {
194 CallSiteOps.UpdateRules(callSite, i);
195 callSite.ReleaseMatchmaker(site);
196 return result;
197 }
199 }
200 }
201 }
202 RuleCache<Func<CallSite, T0, T1, T2, TRet>> ruleCache = CallSiteOps.GetRuleCache(callSite);
203 rules = ruleCache.GetRules();
204 for (int j = 0; j < rules.Length; j++)
205 {
206 func = (callSite.Target = rules[j]);
207 try
208 {
209 TRet result = func(site, arg0, arg1, arg2);
210 if (CallSiteOps.GetMatch(site))
211 {
212 callSite.ReleaseMatchmaker(site);
213 return result;
214 }
215 }
216 finally
217 {
218 if (CallSiteOps.GetMatch(site))
219 {
220 CallSiteOps.AddRule(callSite, func);
221 CallSiteOps.MoveRule(ruleCache, func, j);
222 }
223 }
225 }
226 func = null;
227 object[] args = new object[3] { arg0, arg1, arg2 };
228 while (true)
229 {
230 callSite.Target = target;
231 func = (callSite.Target = callSite.Binder.BindCore(callSite, args));
232 try
233 {
234 TRet result = func(site, arg0, arg1, arg2);
235 if (CallSiteOps.GetMatch(site))
236 {
237 callSite.ReleaseMatchmaker(site);
238 return result;
239 }
240 }
241 finally
242 {
243 if (CallSiteOps.GetMatch(site))
244 {
245 CallSiteOps.AddRule(callSite, func);
246 }
247 }
249 }
250 }
static bool GetMatch(CallSite site)
static void ClearMatch(CallSite site)
void ReleaseMatchmaker(CallSite matchMaker)
Definition CallSite.cs:106

References System.Runtime.CompilerServices.CallSite< T >.Binder, System.Runtime.CompilerServices.CallSiteOps.ClearMatch(), System.Runtime.CompilerServices.CallSiteOps.GetMatch(), System.Runtime.CompilerServices.CallSite< T >.GetMatchmaker(), System.Runtime.CompilerServices.RuleCache< T >.GetRules(), System.Runtime.CompilerServices.CallSite< T >.ReleaseMatchmaker(), and System.Runtime.CompilerServices.CallSite< T >.Target.