1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation.
5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
6 * copy of the license can be found in the License.html file at the root of this distribution. If
7 * you cannot locate the Apache License, Version 2.0, please send an email to
8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
9 * by the terms of the Apache License, Version 2.0.
11 * You must not remove this notice, or any other, from this software.
14 * ***************************************************************************/
16 using System.ComponentModel;
17 using System.Diagnostics;
19 namespace System.Runtime.CompilerServices {
22 /// This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
23 /// Represents the runtime state of a dynamically generated method.
25 [EditorBrowsable(EditorBrowsableState.Never), DebuggerStepThrough]
26 public sealed class Closure {
28 /// Represents the non-trivial constants and locally executable expressions that are referenced by a dynamically generated method.
30 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")]
31 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
32 public readonly object[] Constants;
35 /// Represents the hoisted local variables from the parent context.
37 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")]
38 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
39 public readonly object[] Locals;
42 /// Creates an object to hold state of a dynamically generated method.
44 /// <param name="constants">The constant values used by the method.</param>
45 /// <param name="locals">The hoisted local variables from the parent context.</param>
46 public Closure(object[] constants, object[] locals) {
47 Constants = constants;