Skip to content

Commit 0176947

Browse files
authored
Merge pull request #24 from navtech-io/develop
Cleanup
2 parents a74e498 + cbaa501 commit 0176947

File tree

7 files changed

+3993
-13
lines changed

7 files changed

+3993
-13
lines changed

src/Simpleflow/CodeGenerator/FastExpressionCompiler.cs

Lines changed: 3545 additions & 0 deletions
Large diffs are not rendered by default.

src/Simpleflow/CodeGenerator/SimpleflowCodeVisitor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ public SimpleflowCodeVisitor(IFunctionRegister functionRegister, ParserEventPubl
4242
InputParam = Expression.Parameter(typeof(TArg));
4343
OutputParam = Expression.Parameter(typeof(FlowOutput));
4444
// use context parameter name in order to access in script
45-
ScriptHelperContextParam = Expression.Parameter(typeof(ScriptHelperContext), "context");
46-
45+
ScriptHelperContextParam = Expression.Parameter(typeof(ScriptHelperContext));
4746

4847
/* A label expression of the void type that is the target for Expression.Return(). */
4948
TargetLabelToExitFunction = Expression.Label();
5049
}
5150

52-
5351
public override Expression VisitProgram(SimpleflowParser.ProgramContext context)
5452
{
5553
if (context.exception != null)
@@ -236,13 +234,15 @@ private void ReplaceVirtualSmartVariablesWithReal(List<Expression> statementExpr
236234
private List<Expression> CreateDefaultVariablesAndAssign()
237235
{
238236
var argVar = Expression.Variable(typeof(TArg), "arg");
237+
var contextVar = Expression.Variable(typeof(ScriptHelperContext), "context");
239238

240-
Variables.Add(argVar); // arg
241-
Variables.Add(ScriptHelperContextParam); // script
239+
Variables.Add(argVar);
240+
Variables.Add(contextVar);
242241

243242
return new List<Expression>()
244243
{
245-
Expression.Assign(argVar, InputParam)
244+
Expression.Assign(argVar, InputParam),
245+
Expression.Assign(contextVar, ScriptHelperContextParam)
246246
};
247247
}
248248

src/Simpleflow/CodeGenerator/SimpleflowCompiler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Linq.Expressions;
7-
8-
using Antlr4.Runtime;
97
using FastExpressionCompiler;
8+
using Antlr4.Runtime;
109

1110
using Simpleflow.Exceptions;
1211
using Simpleflow.Parser;

src/Simpleflow/Simpleflow.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
44
<PackageIcon>PackageIcon.png</PackageIcon>
5-
<VersionPrefix>1.0.6</VersionPrefix>
5+
<VersionPrefix>1.0.7</VersionPrefix>
66
<VersionSuffix></VersionSuffix>
77
<PackageReadmeFile>README.md</PackageReadmeFile>
88
</PropertyGroup>
@@ -13,7 +13,6 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.10.1" />
16-
<PackageReference Include="FastExpressionCompiler" Version="3.3.0" />
1716
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
1817
</ItemGroup>
1918

src/Simpleflow/Simpleflow.xml

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

test/Simpleflow.Tests/Scripting/ArrayTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void AccessArrayValue()
102102
var script =
103103
@"
104104
let i = 1
105-
let x=arg[i]
105+
let x=arg[i] # don't provide space here, like arg [ i ], intended this way for testing
106106
output x
107107
108108
";

test/Simpleflow.Tests/Simpleflow.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

0 commit comments

Comments
 (0)