Skip to content

Commit ed10ac2

Browse files
authored
Merge pull request #103 from codingseb/dev
Dev
2 parents 242641e + c2aaec2 commit ed10ac2

File tree

4 files changed

+150
-104
lines changed

4 files changed

+150
-104
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ public object OnTheFlyIndexingEvaluation(string expression)
13301330

13311331
private void Evaluator_PreEvaluateIndexing(object sender, IndexingPreEvaluationEventArg e)
13321332
{
1333-
if(e.This is int intValue && e.EvaluateArg() is string text)
1333+
if(e.This is int intValue && e.EvaluateArg(0) is string text)
13341334
{
13351335
e.Value = string.Join(",", Enumerable.Repeat(text, intValue));
13361336
}
@@ -2701,6 +2701,16 @@ ExpressionEvaluator evaluatorForMethodArgs()
27012701

27022702
#endregion
27032703

2704+
#region For multidimensional indexing
2705+
2706+
yield return new TestCaseData(new ExpressionEvaluator(new Dictionary<string, object> { { "doubleIndexObject", new ClassForIndexing() } })
2707+
, "doubleIndexObject[2,3]"
2708+
, null)
2709+
.Returns(5)
2710+
.SetCategory("Multidimensional indexing");
2711+
2712+
#endregion
2713+
27042714
#endregion
27052715
}
27062716
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace CodingSeb.ExpressionEvaluator.Tests
2+
{
3+
public class ClassForIndexing
4+
{
5+
public int this[int i1, int i2]
6+
{
7+
get
8+
{
9+
return i1 + i2;
10+
}
11+
set
12+
{}
13+
}
14+
15+
public string this[string test]
16+
{
17+
get
18+
{
19+
return test + test;
20+
}
21+
set
22+
{}
23+
}
24+
}
25+
}

CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<Product>CodingSeb.ExpressionEvaluator</Product>
66
<Description>A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts</Description>
77
<Copyright>Copyright © Coding Seb 2017</Copyright>
8-
<Version>1.4.28.0</Version>
9-
<AssemblyVersion>1.4.28.0</AssemblyVersion>
10-
<FileVersion>1.4.28.0</FileVersion>
8+
<Version>1.4.29.0</Version>
9+
<AssemblyVersion>1.4.29.0</AssemblyVersion>
10+
<FileVersion>1.4.29.0</FileVersion>
1111
<OutputPath>bin\$(Configuration)\</OutputPath>
1212
<Authors>Coding Seb</Authors>
1313
<PackageId>CodingSeb.ExpressionEvaluator</PackageId>
@@ -19,8 +19,7 @@
1919
<PackageIconUrl>https://github.com/codingseb/ExpressionEvaluator/blob/master/Icon.png?raw=true</PackageIconUrl>
2020
<PackageIcon>Icon.png</PackageIcon>
2121
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
22-
<PackageReleaseNotes>* Correction of a bug : Int32, Int16 and Int64 were not evaluated when OptionCaseSensitiveEvaluationActive = false
23-
* Array types are now correctly evaluate in typeof and cast ex: typeof(double[]) or (string[])myArray</PackageReleaseNotes>
22+
<PackageReleaseNotes>* Add Multidimensional indexing management like myStuffToIndex[1,4]</PackageReleaseNotes>
2423
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
2524
<RepositoryUrl>https://github.com/codingseb/ExpressionEvaluator</RepositoryUrl>
2625
</PropertyGroup>

0 commit comments

Comments
 (0)