Skip to content

Commit cca2182

Browse files
Release v1.1.3 (#60)
* [Bug] Fixes issues with AsyncTaskMethodBuilder that caused the "Prefer Interpretation" mode with the system compiler to fail for async state machines. --------- Co-authored-by: Brenton Farmer <[email protected]> Co-authored-by: MattEdwardsWaggleBee <[email protected]>
1 parent cbe78cd commit cca2182

29 files changed

+520
-521
lines changed

Directory.Build.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<PropertyGroup>
44
<MajorVersion>1</MajorVersion>
55
<MinorVersion>1</MinorVersion>
6-
<PatchVersion>2</PatchVersion>
6+
<PatchVersion>3</PatchVersion>
7+
<RevisionVersion>0</RevisionVersion>
8+
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
9+
<FileVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion).$(RevisionVersion)</FileVersion>
710
</PropertyGroup>
811
<!-- Disable automatic package publishing -->
912
<PropertyGroup>

Directory.Build.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<Target Name="SetPackageVersion" BeforeTargets="GenerateNuspec"
1616
Condition="'$(IsPackable)'=='true'">
1717
<PropertyGroup>
18-
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
1918
<PackageVersion Condition="'$(VersionSuffix)'==''">$(VersionPrefix)</PackageVersion>
2019
<PackageVersion Condition="'$(VersionSuffix)'!=''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
2120
</PropertyGroup>

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Welcome to Hyperbee Expressions
22

3-
`Hyperbee.Expressions` is a C# library that extends the capabilities of expression trees to handle asynchronous
4-
workflows and other language constructs.
3+
`Hyperbee.Expressions` is a library for creating c# expression trees that extend the capabilities of standard expression
4+
trees to handle asynchronous workflows and other language constructs.
55

66
## Features
77

@@ -21,6 +21,14 @@ workflows and other language constructs.
2121
* `StringFormatExpression`: An expression that creates a string using a supplied format string and parameters.
2222
* `DebugExpression`: An expression that helps when debugging expression trees.
2323

24+
* Supports Fast Expression Compiler (FEC) for improved performance.
25+
26+
* Supports interpreted expression trees using `lambda.Compile(preferInterpretation: true)`.
27+
```csharp
28+
var lambda = Expression.Lambda<Func<int>>(Expression.Constant(1));
29+
var interpetedLambda = lambda.Compile(preferInterpretation: true);
30+
```
31+
2432
## Examples
2533

2634
### Asynchronous Expressions
@@ -37,7 +45,6 @@ public class Example
3745
public async Task ExampleAsync()
3846
{
3947
// Create an async block that calls async methods and assigns their results
40-
4148
var instance = Constant( this );
4249
var result1 = Variable( typeof(int), "result1" );
4350
var result2 = Variable( typeof(int), "result2" );
@@ -119,5 +126,4 @@ Special thanks to:
119126
## Contributing
120127

121128
We welcome contributions! Please see our [Contributing Guide](https://github.com/Stillpoint-Software/.github/blob/main/.github/CONTRIBUTING.md)
122-
for more details.
123-
129+
for more detai

docs/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ trees to handle asynchronous workflows and other language constructs.
2828

2929
* Supports Fast Expression Compiler (FEC) for improved performance.
3030

31+
* Supports interpreted expression trees using `lambda.Compile(preferInterpretation: true)`.
32+
```csharp
33+
var lambda = Expression.Lambda<Func<int>>(Expression.Constant(1));
34+
var interpetedLambda = lambda.Compile(preferInterpretation: true);
35+
```
36+
3137
## Examples
3238

3339
### Asynchronous Expressions

src/Hyperbee.Expressions/AsyncBlockExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.ObjectModel;
22
using System.Diagnostics;
33
using System.Linq.Expressions;
4+
using Hyperbee.Collections;
45
using Hyperbee.Expressions.CompilerServices;
5-
using Hyperbee.Expressions.CompilerServices.Collections;
66

77
namespace Hyperbee.Expressions;
88

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System.Runtime.CompilerServices;
2+
3+
namespace Hyperbee.Expressions.CompilerServices;
4+
5+
public class AsyncInterpreterTaskBuilder<TResult>
6+
{
7+
public AsyncTaskMethodBuilder<TResult> Builder;
8+
9+
public Task<TResult> Task => Builder.Task;
10+
11+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
12+
public void SetStateMachine( IAsyncStateMachine stateMachine )
13+
{
14+
Builder.SetStateMachine( stateMachine );
15+
}
16+
17+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
18+
public void Start<TStateMachine>( ref TStateMachine stateMachine ) where TStateMachine : IAsyncStateMachine
19+
{
20+
Builder.Start( ref stateMachine );
21+
}
22+
23+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
24+
public void SetResult( TResult result )
25+
{
26+
Builder.SetResult( result );
27+
}
28+
29+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
30+
public void SetException( Exception exception )
31+
{
32+
Builder.SetException( exception );
33+
}
34+
35+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
36+
public void AwaitOnCompleted<TAwaiter, TStateMachine>(
37+
ref TAwaiter awaiter,
38+
ref TStateMachine stateMachine
39+
) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
40+
{
41+
Builder.AwaitOnCompleted( ref awaiter, ref stateMachine );
42+
}
43+
44+
[MethodImpl( MethodImplOptions.AggressiveInlining )]
45+
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(
46+
ref TAwaiter awaiter,
47+
ref TStateMachine stateMachine
48+
) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
49+
{
50+
Builder.AwaitUnsafeOnCompleted( ref awaiter, ref stateMachine );
51+
}
52+
}

0 commit comments

Comments
 (0)