Skip to content

Commit 08ff320

Browse files
author
Rajesh Jinaga
committed
Remove argument immutability in order to avoid complexity at this stage.
1 parent 9a594fc commit 08ff320

File tree

11 files changed

+7
-234
lines changed

11 files changed

+7
-234
lines changed

src/Simpleflow/CodeGenerator/ArgumentImmutabilityCheck.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/Simpleflow/CodeGenerator/SimpleflowCodeVisitor.VistitSet.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,8 @@ private Expression VisitPartialSet(SimpleflowParser.SetStmtContext context, Expr
146146
(propInfo, valueExp) =>
147147
propExpressions.Add(Expression.Assign(Expression.Property(variable, propInfo), valueExp)));
148148

149-
/*
150-
* Check for script argument immutability, exception case: if a function change property of script arg,
151-
* simppleflow does not control.
152-
*/
153-
var referenceProperties = new List<Expression>();
154-
var checkForSameReference = Expression.Call(null,
155-
typeof(ArgumentImmutabilityCheck).GetMethod(nameof(ArgumentImmutabilityCheck.CheckForSameReference)),
156-
arg0: InputParam,
157-
arg1: variable);
158-
159-
return
160-
Expression.IfThenElse(
161-
Expression.Or(
162-
Expression.IsTrue(Expression.Property(ScriptHelperContextParam, nameof(ScriptHelperContext.IsArgumentMutable))),
163-
Expression.IsFalse(checkForSameReference)),
164-
Expression.Block(propExpressions),
165-
Expression.Throw(Expression.New(typeof(ArgumentImmutableExeception)))
166-
);
149+
return Expression.Block(propExpressions);
150+
167151
}
168152
}
169153
}

src/Simpleflow/Exceptions/ArgumentImmutableExeception.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Simpleflow/FlowOptions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ namespace Simpleflow
77
/// <inheritdoc />
88
public class FlowOptions : IOptions
99
{
10-
/// <summary>
11-
/// Gets or sets AllowArgumentToMutate
12-
/// </summary>
13-
public bool AllowArgumentToMutate { get; set; }
14-
1510
/// <summary>
1611
/// Gets or sets AllowFunctions
1712
/// </summary>

src/Simpleflow/IOptions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ namespace Simpleflow
88
/// </summary>
99
public interface IOptions
1010
{
11-
/// <summary>
12-
/// Gets or sets AllowArgumentToMutate
13-
/// </summary>
14-
bool AllowArgumentToMutate { get; }
15-
1611
/// <summary>
1712
/// Gets or sets AllowFunctions
1813
/// </summary>

src/Simpleflow/ScriptHelperContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ public sealed class ScriptHelperContext
1212

1313
private ScriptHelperContext() { }
1414

15-
internal ScriptHelperContext(FlowOutput flowOutput, bool isArgumentMutable, CancellationToken token)
15+
internal ScriptHelperContext(FlowOutput flowOutput, CancellationToken token)
1616
{
1717
_flowOutput = flowOutput;
1818
_token = token;
19-
IsArgumentMutable = isArgumentMutable;
2019
}
21-
22-
public bool IsArgumentMutable { get; }
20+
2321
public bool HasErrors => _flowOutput.Errors.Count > 0;
2422
public bool HasMessages => _flowOutput.Messages.Count > 0;
2523
public bool HasOutputs => _flowOutput.Output.Count > 0;

src/Simpleflow/Services/ExecutionService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public void Run<TArg>(FlowContext<TArg> context, NextPipelineService<TArg> next)
3636
context.Trace?.CreateNewTracePoint(nameof(ExecutionService));
3737

3838
var scriptHelperContext = new ScriptHelperContext(context.Output,
39-
(context.Options?.AllowArgumentToMutate ?? _options?.AllowArgumentToMutate) ?? true,
4039
context.Options?.CancellationToken ?? default);
4140

4241
context.Internals.CompiledScript?.Invoke(context.Argument, context.Output, scriptHelperContext);

src/Simpleflow/Simpleflow.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
44
<PackageIcon>PackageIcon.png</PackageIcon>
55
<VersionPrefix>1.0.4</VersionPrefix>
6-
<VersionSuffix>beta3</VersionSuffix>
6+
<VersionSuffix></VersionSuffix>
77
<PackageReadmeFile>README.md</PackageReadmeFile>
88
</PropertyGroup>
99

src/Simpleflow/Simpleflow.xml

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/Simpleflow.Tests/Infrastructure/ScriptHelperContextTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ output x
2121

2222
// Act
2323
var result = SimpleflowEngine.Run(script, new object());
24-
var scriptHelperContext = new ScriptHelperContext(result, true, System.Threading.CancellationToken.None);
24+
var scriptHelperContext = new ScriptHelperContext(result, System.Threading.CancellationToken.None);
2525

2626
// Assert
2727
Assert.True(scriptHelperContext.HasErrors);
@@ -41,7 +41,7 @@ public void HasNoErrorsMessagesOutput()
4141

4242
// Act
4343
var result = SimpleflowEngine.Run(script, new object());
44-
var scriptHelperContext = new ScriptHelperContext(result, true, System.Threading.CancellationToken.None);
44+
var scriptHelperContext = new ScriptHelperContext(result, System.Threading.CancellationToken.None);
4545

4646
// Assert
4747
Assert.False(scriptHelperContext.HasErrors);

0 commit comments

Comments
 (0)