Skip to content

Commit 6767e7f

Browse files
author
Joanna May
authored
Merge pull request #32 from chickensoft-games/fix/stop
fix: exit and detach on stop
2 parents 45a8e2c + 66a9a02 commit 6767e7f

File tree

8 files changed

+18
-11
lines changed

8 files changed

+18
-11
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "coreclr",
77
"request": "launch",
88
"preLaunchTask": "build",
9-
"program": "${workspaceFolder}/Chickensoft.LogicBlocks.Example/bin/Debug/net6.0/Chickensoft.LogicBlocks.Example.dll",
9+
"program": "${workspaceFolder}/Chickensoft.LogicBlocks.Example/bin/Debug/net7.0/Chickensoft.LogicBlocks.Example.dll",
1010
"args": [
1111
// "${input:args}"
1212
],
@@ -17,4 +17,4 @@
1717
"enableStepFiltering": false,
1818
},
1919
]
20-
}
20+
}

Chickensoft.LogicBlocks.Generator/src/LogicBlocksGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace Chickensoft.LogicBlocks.Generator;
88
using System.Text;
99
using System.Threading;
1010
using Chickensoft.LogicBlocks.Generator.Common.Models;
11+
using Chickensoft.LogicBlocks.Generator.Common.Services;
1112
using Chickensoft.SourceGeneratorUtils;
1213
using Microsoft.CodeAnalysis;
1314
using Microsoft.CodeAnalysis.CSharp.Syntax;
1415
using Microsoft.CodeAnalysis.Text;
15-
using SuperNodes.Common.Services;
1616

1717
[Generator]
1818
public class LogicBlocksGenerator :

Chickensoft.LogicBlocks.Generator/src/OutputVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ namespace Chickensoft.LogicBlocks.Generator;
44
using System.Collections.Immutable;
55
using System.Threading;
66
using Chickensoft.LogicBlocks.Generator.Common.Models;
7+
using Chickensoft.LogicBlocks.Generator.Common.Services;
78
using Chickensoft.SourceGeneratorUtils;
89
using Microsoft.CodeAnalysis;
910
using Microsoft.CodeAnalysis.CSharp;
1011
using Microsoft.CodeAnalysis.CSharp.Syntax;
11-
using SuperNodes.Common.Services;
1212

1313
public class OutputVisitor : CSharpSyntaxWalker {
1414
public SemanticModel Model { get; }

Chickensoft.LogicBlocks.Generator/src/ReturnTypeVisitor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ namespace Chickensoft.LogicBlocks.Generator;
33
using System.Collections.Generic;
44
using System.Collections.Immutable;
55
using System.Threading;
6+
using Chickensoft.LogicBlocks.Generator.Common.Services;
67
using Chickensoft.SourceGeneratorUtils;
78
using Microsoft.CodeAnalysis;
89
using Microsoft.CodeAnalysis.CSharp;
910
using Microsoft.CodeAnalysis.CSharp.Syntax;
1011

11-
using SuperNodes.Common.Services;
12-
1312
public class ReturnTypeVisitor : CSharpSyntaxWalker {
1413
public SemanticModel Model { get; }
1514
public CancellationToken Token { get; }

Chickensoft.LogicBlocks.Generator/src/common/services/CodeService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SuperNodes.Common.Services;
1+
namespace Chickensoft.LogicBlocks.Generator.Common.Services;
22

33
using System;
44
using System.Collections.Generic;

Chickensoft.LogicBlocks/src/LogicBlock.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ public void Start() =>
124124
Value.Enter(previous: null, onError: AddError);
125125

126126
/// <inheritdoc />
127-
public void Stop() => Value.Exit(next: null, onError: AddError);
127+
public void Stop() {
128+
Value.Exit(next: null, onError: AddError);
129+
Value.Detach();
130+
SetState(null!);
131+
}
128132

129133
internal override Func<object, TState> GetInputHandler<TInputType>()
130134
=> (input) => {

Chickensoft.LogicBlocks/src/LogicBlockAsync.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ public Task Start() =>
159159
Value.Enter(previous: null, onError: AddError);
160160

161161
/// <inheritdoc />
162-
public Task Stop() => Value.Exit(next: null, onError: AddError);
162+
public async Task Stop() {
163+
await Value.Exit(next: null, onError: AddError);
164+
Value.Detach();
165+
SetState(null!);
166+
}
163167

164168
internal override Func<object, Task<TState>> GetInputHandler<TInputType>()
165169
=> (input) => {

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
33
"rollForward": "latestMinor",
4-
"version": "7.0.306"
4+
"version": "7.0.404"
55
}
6-
}
6+
}

0 commit comments

Comments
 (0)