Skip to content

Commit 1b07b3b

Browse files
author
Sébastien Geiser
committed
Better array content assignation
1 parent 4624138 commit 1b07b3b

File tree

6 files changed

+36
-5
lines changed

6 files changed

+36
-5
lines changed

CodingSeb.ExpressionEvaluator.Tests/CodingSeb.ExpressionEvaluator.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
11-
<PackageReference Include="NUnit" Version="3.10.1" />
12-
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
10+
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
11+
<PackageReference Include="NUnit" Version="3.11.0" />
12+
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
1313
<PackageReference Include="Shouldly" Version="3.0.2" />
1414
</ItemGroup>
1515
<ItemGroup>

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorScriptEvaluateTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,16 @@ public static IEnumerable<TestCaseData> TestCasesForScriptEvaluateTests
566566

567567
#endregion
568568

569+
#region Array content assignation
570+
571+
yield return new TestCaseData(Resources.Script0033, null, null, null)
572+
.SetCategory("Script")
573+
.SetCategory("Array Assignation")
574+
.SetCategory("=")
575+
.Returns("[0,5,0]");
576+
577+
#endregion
578+
569579
#endregion
570580

571581
#region while

CodingSeb.ExpressionEvaluator.Tests/Resources.Designer.cs

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

CodingSeb.ExpressionEvaluator.Tests/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,7 @@
214214
<data name="Script0032" type="System.Resources.ResXFileRef, System.Windows.Forms">
215215
<value>resources\script0032.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
216216
</data>
217+
<data name="Script0033" type="System.Resources.ResXFileRef, System.Windows.Forms">
218+
<value>resources\script0033.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
219+
</data>
217220
</root>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* Script0033 */
2+
3+
array = Array.CreateInstance(typeof(int), 3);
4+
array[1] = 5;
5+
array.Json;

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************************************
22
Title : ExpressionEvaluator (https://github.com/codingseb/ExpressionEvaluator)
3-
Version : 1.3.0.0
3+
Version : 1.3.0.1
44
(if last digit not zero version is an intermediate version and can be unstable)
55
66
Author : Coding Seb
@@ -1920,7 +1920,7 @@ private bool EvaluateIndexing(string expr, string s, Stack<object> stack, ref in
19201920

19211921
Match assignationOrPostFixOperatorMatch = null;
19221922

1923-
object valueToPush = null;
1923+
dynamic valueToPush = null;
19241924

19251925
if (OptionIndexingAssignationActive && (assignationOrPostFixOperatorMatch = assignationOrPostFixOperatorRegex.Match(expr.Substring(i + 1))).Success)
19261926
{

0 commit comments

Comments
 (0)