diff options
Diffstat (limited to 'src/mscorlib/shared/System/Runtime/CompilerServices')
41 files changed, 864 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs new file mode 100644 index 0000000000..25efcafa3f --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Field)] + public sealed class AccessedThroughPropertyAttribute : Attribute + { + public AccessedThroughPropertyAttribute(string propertyName) + { + PropertyName = propertyName; + } + + public string PropertyName { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs new file mode 100644 index 0000000000..198ed3d0e7 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] + public sealed class AsyncStateMachineAttribute : StateMachineAttribute + { + public AsyncStateMachineAttribute(Type stateMachineType) + : base(stateMachineType) + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs new file mode 100644 index 0000000000..5858634b42 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] + public sealed class CallerFilePathAttribute : Attribute + { + public CallerFilePathAttribute() + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs new file mode 100644 index 0000000000..5bd2fcb91b --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] + public sealed class CallerLineNumberAttribute : Attribute + { + public CallerLineNumberAttribute() + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs new file mode 100644 index 0000000000..8b046335b5 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] + public sealed class CallerMemberNameAttribute : Attribute + { + public CallerMemberNameAttribute() + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs new file mode 100644 index 0000000000..4da95024c5 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + /// IMPORTANT: Keep this in sync with corhdr.h + [Flags] + [Serializable] + public enum CompilationRelaxations : int + { + NoStringInterning = 0x0008 // Start in 0x0008, we had other non public flags in this enum before, + // so we'll start here just in case somebody used them. This flag is only + // valid when set for Assemblies. + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs new file mode 100644 index 0000000000..1f100bd415 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Method)] + public class CompilationRelaxationsAttribute : Attribute + { + public CompilationRelaxationsAttribute(int relaxations) + { + CompilationRelaxations = relaxations; + } + + public CompilationRelaxationsAttribute(CompilationRelaxations relaxations) + { + CompilationRelaxations = (int)relaxations; + } + + public int CompilationRelaxations { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs new file mode 100644 index 0000000000..3da2a95aeb --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.All, Inherited = true)] + public sealed class CompilerGeneratedAttribute : Attribute + { + public CompilerGeneratedAttribute() { } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs new file mode 100644 index 0000000000..22fa694200 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // Attribute used to communicate to the VS7 debugger that a class should be treated as if it has global scope. + + [Serializable] + [AttributeUsage(AttributeTargets.Class)] + public class CompilerGlobalScopeAttribute : Attribute + { + public CompilerGlobalScopeAttribute() { } + } +} + diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs new file mode 100644 index 0000000000..f5419d413b --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Assembly)] + public sealed class DefaultDependencyAttribute : Attribute + { + public DefaultDependencyAttribute(LoadHint loadHintArgument) + { + LoadHint = loadHintArgument; + } + + public LoadHint LoadHint { get; } + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs new file mode 100644 index 0000000000..56f4242bb1 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class DependencyAttribute : Attribute + { + public DependencyAttribute(String dependentAssemblyArgument, LoadHint loadHintArgument) + { + DependentAssembly = dependentAssemblyArgument; + LoadHint = loadHintArgument; + } + + public String DependentAssembly { get; } + public LoadHint LoadHint { get; } + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs new file mode 100644 index 0000000000..4fc00e10ed --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] + public sealed class DisablePrivateReflectionAttribute : Attribute + { + public DisablePrivateReflectionAttribute() { } + } +} + diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs new file mode 100644 index 0000000000..c88b3a7599 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // Custom attribute to indicating a TypeDef is a discardable attribute. + + public class DiscardableAttribute : Attribute + { + public DiscardableAttribute() { } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/ExtensionAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/ExtensionAttribute.cs new file mode 100644 index 0000000000..92170880f1 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/ExtensionAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Indicates that a method is an extension method, or that a class or assembly contains extension methods. + /// </summary> + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] + public sealed class ExtensionAttribute : Attribute { } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs new file mode 100644 index 0000000000..baf5824241 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Field)] + public sealed class FixedAddressValueTypeAttribute : Attribute + { + public FixedAddressValueTypeAttribute() { } + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs new file mode 100644 index 0000000000..bb8f00f686 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** +** Purpose: Used by a compiler for generating value types +** in-place within other value types containing a certain +** number of elements of the given (primitive) type. Somewhat +** similar to P/Invoke's ByValTStr attribute. +** Used by C# with this syntax: "fixed int buffer[10];" +** +===========================================================*/ + +using System; + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Field, Inherited = false)] + public sealed class FixedBufferAttribute : Attribute + { + public FixedBufferAttribute(Type elementType, int length) + { + ElementType = elementType; + Length = length; + } + + public Type ElementType { get; } + public int Length { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/FormattableStringFactory.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/FormattableStringFactory.cs new file mode 100644 index 0000000000..23d03860ed --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/FormattableStringFactory.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** +** +** Purpose: implementation of the FormattableStringFactory +** class. +** +===========================================================*/ + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// A factory type used by compilers to create instances of the type <see cref="FormattableString"/>. + /// </summary> + public static class FormattableStringFactory + { + /// <summary> + /// Create a <see cref="FormattableString"/> from a composite format string and object + /// array containing zero or more objects to format. + /// </summary> + public static FormattableString Create(string format, params object[] arguments) + { + if (format == null) + { + throw new ArgumentNullException(nameof(format)); + } + + if (arguments == null) + { + throw new ArgumentNullException(nameof(arguments)); + } + + return new ConcreteFormattableString(format, arguments); + } + + private sealed class ConcreteFormattableString : FormattableString + { + private readonly string _format; + private readonly object[] _arguments; + + internal ConcreteFormattableString(string format, object[] arguments) + { + _format = format; + _arguments = arguments; + } + + public override string Format { get { return _format; } } + public override object[] GetArguments() { return _arguments; } + public override int ArgumentCount { get { return _arguments.Length; } } + public override object GetArgument(int index) { return _arguments[index]; } + public override string ToString(IFormatProvider formatProvider) { return string.Format(formatProvider, _format, _arguments); } + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/IAsyncStateMachine.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IAsyncStateMachine.cs new file mode 100644 index 0000000000..7fb7ea5395 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IAsyncStateMachine.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +// +// +// +// Represents state machines generated for asynchronous methods. +// +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Represents state machines generated for asynchronous methods. + /// This type is intended for compiler use only. + /// </summary> + public interface IAsyncStateMachine + { + /// <summary>Moves the state machine to its next state.</summary> + void MoveNext(); + /// <summary>Configures the state machine with a heap-allocated replica.</summary> + /// <param name="stateMachine">The heap-allocated replica.</param> + void SetStateMachine(IAsyncStateMachine stateMachine); + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/INotifyCompletion.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/INotifyCompletion.cs new file mode 100644 index 0000000000..aba0a0691f --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/INotifyCompletion.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +// +// +// +// Interfaces used to represent instances that notify listeners of their completion via continuations. +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +using System; +using System.Security; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Represents an operation that will schedule continuations when the operation completes. + /// </summary> + public interface INotifyCompletion + { + /// <summary>Schedules the continuation action to be invoked when the instance completes.</summary> + /// <param name="continuation">The action to invoke when the operation completes.</param> + /// <exception cref="System.ArgumentNullException">The <paramref name="continuation"/> argument is null (Nothing in Visual Basic).</exception> + void OnCompleted(Action continuation); + } + + /// <summary> + /// Represents an awaiter used to schedule continuations when an await operation completes. + /// </summary> + public interface ICriticalNotifyCompletion : INotifyCompletion + { + /// <summary>Schedules the continuation action to be invoked when the instance completes.</summary> + /// <param name="continuation">The action to invoke when the operation completes.</param> + /// <exception cref="System.ArgumentNullException">The <paramref name="continuation"/> argument is null (Nothing in Visual Basic).</exception> + /// <remarks>Unlike OnCompleted, UnsafeOnCompleted need not propagate ExecutionContext information.</remarks> + void UnsafeOnCompleted(Action continuation); + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/ITuple.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/ITuple.cs new file mode 100644 index 0000000000..cafee11f8a --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/ITuple.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// This interface is required for types that want to be indexed into by dynamic patterns. + /// </summary> + public interface ITuple + { + /// <summary> + /// The number of positions in this data structure. + /// </summary> + int Length { get; } + + /// <summary> + /// Get the element at position <param name="index"/>. + /// </summary> + object this[int index] { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs new file mode 100644 index 0000000000..65653a44d9 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Property, Inherited = true)] + public sealed class IndexerNameAttribute : Attribute + { + public IndexerNameAttribute(String indexerName) + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs new file mode 100644 index 0000000000..f754694815 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)] + public sealed class InternalsVisibleToAttribute : Attribute + { + public InternalsVisibleToAttribute(string assemblyName) + { + AssemblyName = assemblyName; + } + + public string AssemblyName { get; } + public bool AllInternalsVisible { get; set; } = true; + } +} + diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/IsConst.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IsConst.cs new file mode 100644 index 0000000000..7f948b608a --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IsConst.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + public static partial class IsConst + { + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/IsVolatile.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IsVolatile.cs new file mode 100644 index 0000000000..fd1c6a1b12 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IsVolatile.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + public static class IsVolatile + { + // no instantiation, please! + } +} + diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs new file mode 100644 index 0000000000..5ac3918028 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] + public sealed class IteratorStateMachineAttribute : StateMachineAttribute + { + public IteratorStateMachineAttribute(Type stateMachineType) + : base(stateMachineType) + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs new file mode 100644 index 0000000000..ae6d9b9372 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + public enum LoadHint + { + Default = 0x0000, // No preference specified + Always = 0x0001, // Dependency is always loaded + Sometimes = 0x0002, // Dependency is sometimes loaded + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs new file mode 100644 index 0000000000..e82993a5de --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection; + +namespace System.Runtime.CompilerServices +{ + [Serializable] + public enum MethodCodeType + { + IL = MethodImplAttributes.IL, + Native = MethodImplAttributes.Native, + OPTIL = MethodImplAttributes.OPTIL, + Runtime = MethodImplAttributes.Runtime + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs new file mode 100644 index 0000000000..2b5affc699 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // This Enum matchs the miImpl flags defined in corhdr.h. It is used to specify + // certain method properties. + [Flags] + public enum MethodImplOptions + { + Unmanaged = 0x0004, + NoInlining = 0x0008, + ForwardRef = 0x0010, + Synchronized = 0x0020, + NoOptimization = 0x0040, + PreserveSig = 0x0080, + AggressiveInlining = 0x0100, + InternalCall = 0x1000 + } +}
\ No newline at end of file diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs new file mode 100644 index 0000000000..aad7310412 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Reserved to be used by the compiler for tracking metadata. + /// This attribute should not be used by developers in source code. + /// </summary> + [EditorBrowsable(EditorBrowsableState.Never)] + [AttributeUsage(AttributeTargets.All, Inherited = false)] + public sealed class ReadOnlyAttribute : Attribute + { + public ReadOnlyAttribute() + { + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs new file mode 100644 index 0000000000..6e307e72af --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** Attribute: ReferenceAssemblyAttribute +** +** Purpose: Identifies an assembly as being a "reference +** assembly", meaning it contains public surface area but +** no usable implementation. Reference assemblies +** should be loadable for introspection, but not execution. +** +============================================================*/ + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] + public sealed class ReferenceAssemblyAttribute : Attribute + { + public ReferenceAssemblyAttribute() + { + } + + public ReferenceAssemblyAttribute(String description) + { + Description = description; + } + + public String Description { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs new file mode 100644 index 0000000000..55dba0d113 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================================= +** +** +** +** Purpose: Mark up the program to indicate various legacy or new opt-in behaviors. +** +** +=============================================================================*/ + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] + public sealed class RuntimeCompatibilityAttribute : Attribute + { + public RuntimeCompatibilityAttribute() + { + // legacy behavior is the default, and WrapNonExceptionThrows is implicitly + // false thanks to the CLR's guarantee of zeroed memory. + } + + // If a non-CLSCompliant exception (i.e. one that doesn't derive from System.Exception) is + // thrown, should it be wrapped up in a System.Runtime.CompilerServices.RuntimeWrappedException + // instance when presented to catch handlers? + public bool WrapNonExceptionThrows { get; set; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs new file mode 100644 index 0000000000..b93c435439 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + public static class RuntimeFeature + { + /// <summary> + /// Checks whether a certain feature is supported by the Runtime. + /// </summary> + public static bool IsSupported(string feature) + { + // No features are supported for now. + // These features should be added as public static readonly string fields in the same class. + return false; + } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/SpecialNameAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/SpecialNameAttribute.cs new file mode 100644 index 0000000000..b18e62895f --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/SpecialNameAttribute.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Struct)] + public sealed class SpecialNameAttribute : Attribute + { + public SpecialNameAttribute() { } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs new file mode 100644 index 0000000000..94ed5b5c74 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] + public class StateMachineAttribute : Attribute + { + public StateMachineAttribute(Type stateMachineType) + { + StateMachineType = stateMachineType; + } + + public Type StateMachineType { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs new file mode 100644 index 0000000000..7772a1a263 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // Custom attribute to indicate that strings should be frozen. + + [Serializable] + [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] + public sealed class StringFreezingAttribute : Attribute + { + public StringFreezingAttribute() { } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/StrongBox.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/StrongBox.cs new file mode 100644 index 0000000000..0a1a565f54 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/StrongBox.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Holds a reference to a value. + /// </summary> + /// <typeparam name="T">The type of the value that the <see cref = "StrongBox{T}"></see> references.</typeparam> + public class StrongBox<T> : IStrongBox + { + /// <summary> + /// Gets the strongly typed value associated with the <see cref = "StrongBox{T}"></see> + /// <remarks>This is explicitly exposed as a field instead of a property to enable loading the address of the field.</remarks> + /// </summary> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] + public T Value; + + /// <summary> + /// Initializes a new StrongBox which can receive a value when used in a reference call. + /// </summary> + public StrongBox() + { + } + + /// <summary> + /// Initializes a new <see cref = "StrongBox{T}"></see> with the specified value. + /// </summary> + /// <param name="value">A value that the <see cref = "StrongBox{T}"></see> will reference.</param> + public StrongBox(T value) + { + Value = value; + } + + object IStrongBox.Value + { + get + { + return Value; + } + set + { + Value = (T)value; + } + } + } + + /// <summary> + /// Defines a property for accessing the value that an object references. + /// </summary> + public interface IStrongBox + { + /// <summary> + /// Gets or sets the value the object references. + /// </summary> + object Value { get; set; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs new file mode 100644 index 0000000000..b4224b1c89 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module)] + public sealed class SuppressIldasmAttribute : Attribute + { + public SuppressIldasmAttribute() { } + } +} + diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs new file mode 100644 index 0000000000..ad923dfae5 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Indicates that the use of <see cref="System.ValueTuple"/> on a member is meant to be treated as a tuple with element names. + /// </summary> + [CLSCompliant(false)] + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Event)] + public sealed class TupleElementNamesAttribute : Attribute + { + private readonly string[] _transformNames; + + /// <summary> + /// Initializes a new instance of the <see + /// cref="TupleElementNamesAttribute"/> class. + /// </summary> + /// <param name="transformNames"> + /// Specifies, in a pre-order depth-first traversal of a type's + /// construction, which <see cref="System.ValueType"/> occurrences are + /// meant to carry element names. + /// </param> + /// <remarks> + /// This constructor is meant to be used on types that contain an + /// instantiation of <see cref="System.ValueType"/> that contains + /// element names. For instance, if <c>C</c> is a generic type with + /// two type parameters, then a use of the constructed type <c>C{<see + /// cref="System.ValueTuple{T1, T2}"/>, <see + /// cref="System.ValueTuple{T1, T2, T3}"/></c> might be intended to + /// treat the first type argument as a tuple with element names and the + /// second as a tuple without element names. In which case, the + /// appropriate attribute specification should use a + /// <c>transformNames</c> value of <c>{ "name1", "name2", null, null, + /// null }</c>. + /// </remarks> + public TupleElementNamesAttribute(string[] transformNames) + { + if (transformNames == null) + { + throw new ArgumentNullException(nameof(transformNames)); + } + + _transformNames = transformNames; + } + + /// <summary> + /// Specifies, in a pre-order depth-first traversal of a type's + /// construction, which <see cref="System.ValueTuple"/> elements are + /// meant to carry element names. + /// </summary> + public IList<string> TransformNames => _transformNames; + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs new file mode 100644 index 0000000000..c4a8558243 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)] + public sealed class TypeForwardedFromAttribute : Attribute + { + public TypeForwardedFromAttribute(string assemblyFullName) + { + AssemblyFullName = assemblyFullName; + } + + public string AssemblyFullName { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs new file mode 100644 index 0000000000..85d5c030c1 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)] + public sealed class TypeForwardedToAttribute : Attribute + { + public TypeForwardedToAttribute(Type destination) + { + Destination = destination; + } + + public Type Destination { get; } + } +} diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs new file mode 100644 index 0000000000..162676efe8 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + [Serializable] + [AttributeUsage(AttributeTargets.Struct)] + sealed public class UnsafeValueTypeAttribute : Attribute + { + } +} |