Skip to content

Commit

Permalink
Revise based on C# LDM changes to model
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub committed Mar 30, 2021
1 parent e72399f commit 2e08bb9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderOverrideAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncStateMachineAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncTaskMethodBuilder.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ namespace System.Runtime.CompilerServices
{
/// <summary>
/// Indicates the type of the async method builder that should be used by a language compiler to
/// build the attributed type when used as the return type of an async method.
/// build the attributed async method or to build the attributed type when used as the return type
/// of an async method.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class AsyncMethodBuilderAttribute : Attribute
{
/// <summary>Initializes the <see cref="AsyncMethodBuilderAttribute"/>.</summary>
Expand Down

This file was deleted.

8 changes: 1 addition & 7 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9114,18 +9114,12 @@ public sealed partial class AsyncIteratorStateMachineAttribute : System.Runtime.
{
public AsyncIteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncMethodBuilderAttribute : System.Attribute
{
public AsyncMethodBuilderAttribute(System.Type builderType) { }
public System.Type BuilderType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Property | System.AttributeTargets.Module, Inherited = false, AllowMultiple = true)]
public sealed partial class AsyncMethodBuilderOverrideAttribute : System.Attribute
{
public AsyncMethodBuilderOverrideAttribute(System.Type builderType) { }
public System.Type BuilderType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public static async Task NonGeneric_UsedWithAsyncMethod_CompletesSuccessfully(in
await ValueTaskReturningAsyncMethod(84, result);
Assert.Equal(84 + yields, result.Value);

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
async ValueTask ValueTaskReturningAsyncMethod(int result, StrongBox<int> output)
{
for (int i = 0; i < yields; i++)
Expand All @@ -390,7 +390,7 @@ public static async Task Generic_UsedWithAsyncMethod_CompletesSuccessfully(int y
Assert.Equal(42 + yields, await ValueTaskReturningAsyncMethod(42));
Assert.Equal(84 + yields, await ValueTaskReturningAsyncMethod(84));

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
async ValueTask<int> ValueTaskReturningAsyncMethod(int result)
{
for (int i = 0; i < yields; i++)
Expand All @@ -412,7 +412,7 @@ public static async Task AwaitTasksAndValueTasks_InTaskAndValueTaskMethods()
Assert.Equal(18, await ValueTaskInt32ReturningMethod());
}

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
async ValueTask ValueTaskReturningMethod()
{
for (int i = 0; i < 3; i++)
Expand Down Expand Up @@ -440,7 +440,7 @@ async ValueTask ValueTaskReturningMethod()
}
}

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
async ValueTask<int> ValueTaskInt32ReturningMethod()
{
for (int i = 0; i < 3; i++)
Expand Down Expand Up @@ -480,7 +480,7 @@ await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async
{
await ValueTaskAsync();
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
static async ValueTask ValueTaskAsync()
{
await Task.Delay(1);
Expand All @@ -499,7 +499,7 @@ await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async
{
Assert.Equal(42 + i, await ValueTaskAsync(i));
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
static async ValueTask<int> ValueTaskAsync(int i)
{
await Task.Delay(1);
Expand Down Expand Up @@ -549,14 +549,14 @@ public void PoolingAsyncValueTasksBuilder_ObjectsPooled(string limitEnvVar)
Assert.InRange(boxes.Distinct().Count(), 1, boxes.Count - 1);
}, new RemoteInvokeOptions() { StartInfo = psi }).Dispose();

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
static async ValueTask<int> ComputeAsync(int input, ConcurrentQueue<object> boxes)
{
await RecursiveValueTaskAsync(3, boxes);
return input * 2;
}

[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
static async ValueTask RecursiveValueTaskAsync(int depth, ConcurrentQueue<object> boxes)
{
boxes.Enqueue(await GetStateMachineData.FetchAsync());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="AsyncMethodBuilderAttributeTests.cs" />
<Compile Include="AsyncMethodBuilderOverrideAttributeTests.cs" />
<Compile Include="AsyncValueTaskMethodBuilderTests.cs" />
<Compile Include="ManualResetValueTaskSourceTests.cs" />
<Compile Include="PoolingAsyncValueTaskMethodBuilderTests.cs" />
Expand Down

0 comments on commit 2e08bb9

Please sign in to comment.