15 [global::__DynamicallyInvokable]
20 private readonly HoistedLocals _scope;
22 private readonly
object[] _locals;
26 internal ExpressionQuoter(HoistedLocals scope,
object[] locals)
34 _shadowedVars.Push(
new Set<ParameterExpression>(node.Parameters));
37 if (expression == node.Body)
41 return Expression.Lambda<
T>(expression, node.Name, node.TailCall, node.Parameters);
48 _shadowedVars.Push(
new Set<ParameterExpression>(node.
Variables));
77 if (expression == node.
Body && expression2 == node.
Filter)
89 int[] array =
new int[count];
90 for (
int i = 0; i < count; i++)
95 array[i] = list2.
Count;
100 array[i] = -1 - list.Count;
109 if (list2.
Count == 0)
111 return constantExpression;
128 foreach (Set<ParameterExpression> shadowedVar
in _shadowedVars)
130 if (shadowedVar.Contains(variable))
135 HoistedLocals hoistedLocals = _scope;
136 object[] array = _locals;
139 if (hoistedLocals.Indexes.TryGetValue(variable, out
int value))
143 hoistedLocals = hoistedLocals.Parent;
144 if (hoistedLocals ==
null)
148 array = HoistedLocals.GetParent(array);
150 throw ContractUtils.Unreachable;
162 return _boxes.Length;
170 return _boxes[index].Value;
174 _boxes[index].Value = value;
190 private readonly
int[] _indexes;
192 public int Count => _indexes.Length;
194 public object this[
int index]
198 index = _indexes[index];
201 return _second[-1 - index];
203 return _first[index];
207 index = _indexes[index];
210 _first[index] = value;
214 _second[-1 - index] = value;
252 private readonly
object[] _data;
254 private readonly
long[] _indexes;
256 public int Count => _indexes.Length;
258 public object this[
int index]
262 return GetStrongBox(index).Value;
266 GetStrongBox(index).Value = value;
270 internal RuntimeVariableList(
object[] data,
long[] indexes)
278 long num = _indexes[index];
279 object[] array = _data;
280 for (
int num2 = (
int)(num >> 32); num2 > 0; num2--)
282 array = HoistedLocals.GetParent(array);
296 [Obsolete(
"do not use this method",
true)]
298 [global::__DynamicallyInvokable]
301 return expando.TryGetValue(indexClass, index, name, ignoreCase, out value);
312 [Obsolete(
"do not use this method",
true)]
314 [global::__DynamicallyInvokable]
317 expando.TrySetValue(indexClass, index, value, name, ignoreCase, add:
false);
328 [Obsolete(
"do not use this method",
true)]
330 [global::__DynamicallyInvokable]
333 return expando.TryDeleteValue(indexClass, index, name, ignoreCase,
ExpandoObject.Uninitialized);
340 [Obsolete(
"do not use this method",
true)]
342 [global::__DynamicallyInvokable]
345 return expando.Class == version;
352 [Obsolete(
"do not use this method",
true)]
354 [global::__DynamicallyInvokable]
357 expando.PromoteClass(oldClass, newClass);
365 [Obsolete(
"do not use this method",
true)]
367 [global::__DynamicallyInvokable]
370 ExpressionQuoter expressionQuoter =
new ExpressionQuoter((HoistedLocals)hoistedLocals, locals);
371 return expressionQuoter.Visit(expression);
379 [Obsolete(
"do not use this method",
true)]
381 [global::__DynamicallyInvokable]
384 return new MergedRuntimeVariables(first, second, indexes);
391 [Obsolete(
"do not use this method",
true)]
393 [global::__DynamicallyInvokable]
396 return new RuntimeVariableList(data, indexes);
401 [Obsolete(
"do not use this method",
true)]
403 [global::__DynamicallyInvokable]
406 return new EmptyRuntimeVariables();
Represents an expression that has a constant value.
static bool ExpandoCheckVersion(ExpandoObject expando, object version)
Checks the version of the Expando object.
int Count
Gets the number of elements contained in the T:System.Collections.Generic.List`1.
A list of run-time variables. For more information, see T:System.Linq.Expressions....
Provides the base class for a generic read-only collection.
static IRuntimeVariables MergeRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes)
Combines two runtime variable lists and returns a new list.
EditorBrowsableState
Specifies the browsable state of a property or method from within an editor.
Expression Filter
Gets the body of the T:System.Linq.Expressions.CatchBlock filter.
Represents a block that contains a sequence of expressions where variables can be defined.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
int Count
Gets the number of elements contained in the T:System.Collections.ObjectModel.ReadOnlyCollection`1 in...
static IRuntimeVariables CreateRuntimeVariables(object[] data, long[] indexes)
Creates an interface that can be used to modify closed over variables at runtime.
Expression Body
Gets the body of the catch block.
void Add(T item)
Adds an object to the end of the T:System.Collections.Generic.List`1.
static bool ExpandoTryDeleteValue(ExpandoObject expando, object indexClass, int index, string name, bool ignoreCase)
Deletes the value of an item in an expando object.
Provides the base class from which the classes that represent expression tree nodes are derived....
An expression that provides runtime read/write permission for variables.
static object ExpandoTrySetValue(ExpandoObject expando, object indexClass, int index, object value, string name, bool ignoreCase)
Sets the value of an item in an expando object.
static void ExpandoPromoteClass(ExpandoObject expando, object oldClass, object newClass)
Promotes an Expando object from one class to a new class.
ReadOnlyCollection< Expression > Expressions
Gets the expressions in this block.
ParameterExpression Variable
Gets a reference to the T:System.Exception object caught by this handler.
Type Test
Gets the type of T:System.Exception this handler catches.
Represents a named parameter expression.
static IRuntimeVariables CreateRuntimeVariables()
Creates an interface that can be used to modify closed over variables at runtime.
ReadOnlyCollection< ParameterExpression > Variables
The variables or parameters to which to provide runtime access.
Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified typ...
static Expression Quote(Expression expression, object hoistedLocals, object[] locals)
Quotes the provided expression tree.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Represents the values of run-time variables.
int Count
Gets a count of the run-time variables.
Represents a catch statement in a try block.
ReadOnlyCollection< ParameterExpression > Variables
Gets the variables defined in this block.
Defines a property for accessing the value that an object references.
Represents an object whose members can be dynamically added and removed at run time.
T [] ToArray()
Copies the elements of the T:System.Collections.Generic.List`1 to a new array.
Represents a visitor or rewriter for expression trees.
static bool ExpandoTryGetValue(ExpandoObject expando, object indexClass, int index, string name, bool ignoreCase, out object value)
Gets the value of an item in an expando object.
Contains helper methods called from dynamically generated methods.