-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from Sergio0694/dev/net8-polyfills
Add C# 12 and .NET 8 polyfills
- Loading branch information
Showing
24 changed files
with
447 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"version": "8.0.100", | ||
"rollForward": "latestFeature", | ||
"allowPrerelease": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...mbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.InlineArrayAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable annotations | ||
|
||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices2 | ||
{ | ||
/// <summary> | ||
/// Indicates that the instance's storage is sequentially replicated "length" times. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// This attribute can be used to annotate a <see langword="struct"/> type with a single field. | ||
/// The runtime will replicate that field in the actual type layout as many times as is specified. | ||
/// </para> | ||
/// <para> | ||
/// Here's an example of how an inline array type with 8 <see cref="float"/> values can be declared: | ||
/// <code lang="csharp"> | ||
/// [InlineArray(8)] | ||
/// struct Float8InlineArray | ||
/// { | ||
/// private float _value; | ||
/// } | ||
/// </code> | ||
/// </para> | ||
/// </remarks> | ||
[global::System.AttributeUsage(global::System.AttributeTargets.Struct, AllowMultiple = false)] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] | ||
public sealed class InlineArrayAttribute : global::System.Attribute | ||
{ | ||
/// <summary>Creates a new <see cref="global::System.Runtime.CompilerServices2.InlineArrayAttribute"/> instance with the specified length.</summary> | ||
/// <param name="length">The number of sequential fields to replicate in the inline array type.</param> | ||
public InlineArrayAttribute(int length) | ||
{ | ||
Length = length; | ||
} | ||
|
||
/// <summary>Gets the number of sequential fields to replicate in the inline array type.</summary> | ||
public int Length { get; } | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...ddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable annotations | ||
|
||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
/// <summary> | ||
/// Provides access to an inaccessible member of a specific type. | ||
/// </summary> | ||
/// <remarks> | ||
/// This attribute may be applied to an <code>extern static</code> method. | ||
/// The implementation of the <code>extern static</code> method annotated with | ||
/// this attribute will be provided by the runtime based on the information in | ||
/// the attribute and the signature of the method that the attribute is applied to. | ||
/// The runtime will try to find the matching method or field and forward the call | ||
/// to it. If the matching method or field is not found, the body of the <code>extern</code> | ||
/// method will throw <see cref="global::System.MissingFieldException" /> or <see cref="global::System.MissingMethodException" />. | ||
/// Only the specific type defined will be examined for inaccessible members. The type hierarchy | ||
/// is not walked looking for a match. | ||
/// | ||
/// For <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method"/>, | ||
/// <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind.StaticMethod"/>, | ||
/// <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field"/>, | ||
/// and <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind.StaticField"/>, the type of | ||
/// the first argument of the annotated <code>extern</code> method identifies the owning type. | ||
/// The value of the first argument is treated as <code>this</code> pointer for instance fields and methods. | ||
/// The first argument must be passed as <code>ref</code> for instance fields and methods on structs. | ||
/// The value of the first argument is not used by the implementation for <code>static</code> fields and methods. | ||
/// | ||
/// Return type is considered for the signature match. modreqs and modopts are initially not considered for | ||
/// the signature match. However, if an ambiguity exists ignoring modreqs and modopts, a precise match | ||
/// is attempted. If an ambiguity still exists <see cref="global::System.Reflection.AmbiguousMatchException" /> is thrown. | ||
/// | ||
/// By default, the attributed method's name dictates the name of the method/field. This can cause confusion | ||
/// in some cases since language abstractions, like C# local functions, generate mangled IL names. The | ||
/// solution to this is to use the <code>nameof</code> mechanism and define the <see cref="Name"/> property. | ||
/// | ||
/// <code> | ||
/// public void Method(Class c) | ||
/// { | ||
/// PrivateMethod(c); | ||
/// | ||
/// [UnsafeAccessor(UnsafeAccessorKind.Method, Name = nameof(PrivateMethod))] | ||
/// extern static void PrivateMethod(Class c); | ||
/// } | ||
/// </code> | ||
/// </remarks> | ||
[global::System.AttributeUsage(global::System.AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] | ||
internal sealed class UnsafeAccessorAttribute : global::System.Attribute | ||
{ | ||
/// <summary> | ||
/// Instantiates an <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorAttribute"/> | ||
/// providing access to a member of kind <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind"/>. | ||
/// </summary> | ||
/// <param name="kind">The kind of the target to which access is provided.</param> | ||
public UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind kind) | ||
{ | ||
Kind = kind; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the kind of member to which access is provided. | ||
/// </summary> | ||
public global::System.Runtime.CompilerServices.UnsafeAccessorKind Kind { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the member to which access is provided. | ||
/// </summary> | ||
/// <remarks> | ||
/// The name defaults to the annotated method name if not specified. | ||
/// The name must be unset/<code>null</code> for <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorKind.Constructor"/>. | ||
/// </remarks> | ||
public string? Name { get; set; } | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
.../EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorKind.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable annotations | ||
|
||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
/// <summary> | ||
/// Specifies the kind of target to which an <see cref="global::System.Runtime.CompilerServices.UnsafeAccessorAttribute" /> is providing access. | ||
/// </summary> | ||
internal enum UnsafeAccessorKind | ||
{ | ||
/// <summary> | ||
/// Provide access to a constructor. | ||
/// </summary> | ||
Constructor, | ||
|
||
/// <summary> | ||
/// Provide access to a method. | ||
/// </summary> | ||
Method, | ||
|
||
/// <summary> | ||
/// Provide access to a static method. | ||
/// </summary> | ||
StaticMethod, | ||
|
||
/// <summary> | ||
/// Provide access to a field. | ||
/// </summary> | ||
Field, | ||
|
||
/// <summary> | ||
/// Provide access to a static field. | ||
/// </summary> | ||
StaticField | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.