mscorlib(4.0.0.0) API with additions
CallSiteOps.cs
2 using System.Diagnostics;
3 
5 {
7  [EditorBrowsable(EditorBrowsableState.Never)]
8  [DebuggerStepThrough]
9  [global::__DynamicallyInvokable]
10  public static class CallSiteOps
11  {
16  [Obsolete("do not use this method", true)]
17  [EditorBrowsable(EditorBrowsableState.Never)]
18  [global::__DynamicallyInvokable]
19  public static CallSite<T> CreateMatchmaker<T>(CallSite<T> site) where T : class
20  {
21  CallSite<T> callSite = site.CreateMatchMaker();
22  ClearMatch(callSite);
23  return callSite;
24  }
25 
29  [Obsolete("do not use this method", true)]
30  [EditorBrowsable(EditorBrowsableState.Never)]
31  [global::__DynamicallyInvokable]
32  public static bool SetNotMatched(CallSite site)
33  {
34  bool match = site._match;
35  site._match = false;
36  return match;
37  }
38 
42  [Obsolete("do not use this method", true)]
43  [EditorBrowsable(EditorBrowsableState.Never)]
44  [global::__DynamicallyInvokable]
45  public static bool GetMatch(CallSite site)
46  {
47  return site._match;
48  }
49 
52  [Obsolete("do not use this method", true)]
53  [EditorBrowsable(EditorBrowsableState.Never)]
54  [global::__DynamicallyInvokable]
55  public static void ClearMatch(CallSite site)
56  {
57  site._match = true;
58  }
59 
64  [Obsolete("do not use this method", true)]
65  [EditorBrowsable(EditorBrowsableState.Never)]
66  [global::__DynamicallyInvokable]
67  public static void AddRule<T>(CallSite<T> site, T rule) where T : class
68  {
69  site.AddRule(rule);
70  }
71 
76  [Obsolete("do not use this method", true)]
77  [EditorBrowsable(EditorBrowsableState.Never)]
78  [global::__DynamicallyInvokable]
79  public static void UpdateRules<T>(CallSite<T> @this, int matched) where T : class
80  {
81  if (matched > 1)
82  {
83  @this.MoveRule(matched);
84  }
85  }
86 
91  [Obsolete("do not use this method", true)]
92  [EditorBrowsable(EditorBrowsableState.Never)]
93  [global::__DynamicallyInvokable]
94  public static T[] GetRules<T>(CallSite<T> site) where T : class
95  {
96  return site.Rules;
97  }
98 
103  [Obsolete("do not use this method", true)]
104  [EditorBrowsable(EditorBrowsableState.Never)]
105  [global::__DynamicallyInvokable]
106  public static RuleCache<T> GetRuleCache<T>(CallSite<T> site) where T : class
107  {
108  return site.Binder.GetRuleCache<T>();
109  }
110 
116  [Obsolete("do not use this method", true)]
117  [EditorBrowsable(EditorBrowsableState.Never)]
118  [global::__DynamicallyInvokable]
119  public static void MoveRule<T>(RuleCache<T> cache, T rule, int i) where T : class
120  {
121  if (i > 1)
122  {
123  cache.MoveRule(rule, i);
124  }
125  }
126 
131  [Obsolete("do not use this method", true)]
132  [EditorBrowsable(EditorBrowsableState.Never)]
133  [global::__DynamicallyInvokable]
134  public static T[] GetCachedRules<T>(RuleCache<T> cache) where T : class
135  {
136  return cache.GetRules();
137  }
138 
145  [Obsolete("do not use this method", true)]
146  [EditorBrowsable(EditorBrowsableState.Never)]
147  [global::__DynamicallyInvokable]
148  public static T Bind<T>(CallSiteBinder binder, CallSite<T> site, object[] args) where T : class
149  {
150  return binder.BindCore(site, args);
151  }
152  }
153 }
static T Bind< T >(CallSiteBinder binder, CallSite< T > site, object[] args)
Updates the call site target with a new rule based on the arguments.
Definition: CallSiteOps.cs:148
static T [] GetRules< T >(CallSite< T > site)
Gets the dynamic binding rules from the call site.
Definition: CallSiteOps.cs:94
Represents a cache of runtime binding rules.
Definition: RuleCache.cs:12
static T [] GetCachedRules< T >(RuleCache< T > cache)
Searches the dynamic rule cache for rules applicable to the dynamic operation.
Definition: CallSiteOps.cs:134
EditorBrowsableState
Specifies the browsable state of a property or method from within an editor.
Definition: __Canon.cs:3
A dynamic call site base class. This type is used as a parameter type to the dynamic site targets.
Definition: CallSite.cs:13
static void MoveRule< T >(RuleCache< T > cache, T rule, int i)
Moves the binding rule within the cache.
Definition: CallSiteOps.cs:119
static CallSite< T > CreateMatchmaker< T >(CallSite< T > site)
Creates an instance of a dynamic call site used for cache lookup.
Definition: CallSiteOps.cs:19
static bool SetNotMatched(CallSite site)
Checks if a dynamic site requires an update.
Definition: CallSiteOps.cs:32
static RuleCache< T > GetRuleCache< T >(CallSite< T > site)
Retrieves binding rule cache.
Definition: CallSiteOps.cs:106
static void UpdateRules< T >(CallSite< T > @this, int matched)
Updates rules in the cache.
Definition: CallSiteOps.cs:79
Creates and caches binding rules.
Definition: CallSiteOps.cs:10
static bool GetMatch(CallSite site)
Checks whether the executed rule matched
Definition: CallSiteOps.cs:45
Class responsible for runtime binding of the dynamic operations on the dynamic call site.
static void ClearMatch(CallSite site)
Clears the match flag on the matchmaker call site.
Definition: CallSiteOps.cs:55
static void AddRule< T >(CallSite< T > site, T rule)
Adds a rule to the cache maintained on the dynamic call site.
Definition: CallSiteOps.cs:67