Skip to content

Commit f8f4d8d

Browse files
authored
v3.3 (#108)
* Handling null custom Expression values, re: #105 * Including ref and out parameter keywords in lambda parameter declarations, re: #106 * Tidying * Improving variable declaration analysis * Improving joined assignment evaluation * Pushing more logic into ExpressionScope * Removing method group argument parameters from variable scope considerations * Adding .NET 5 +6 test projects * Removing redundant project references * Improving variable scoping analysis * Variable scoping improvements / Updating to v3.2.1 * Support for translating VB.NET named, indexed properties * Support for translating unused output variables or lambda parameters to discards (_) * Translating to verbatim strings for strings containing any new line characters, re: #107 * v3.3 NuGet package * Updated release notes
1 parent 428cef3 commit f8f4d8d

File tree

46 files changed

+1832
-639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1832
-639
lines changed
Binary file not shown.
Binary file not shown.

NuGetPack.bat

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Public Class PublicNamedIndex(Of T)
2+
3+
Public ReadOnly Property Value(
4+
Optional indexOne As Integer = 1,
5+
Optional indexTwo As Integer? = Nothing) As T
6+
Get
7+
Return Nothing
8+
End Get
9+
End Property
10+
11+
End Class
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net35;net461;netstandard1.3</TargetFrameworks>
5+
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Common.Vb</AssemblyName>
6+
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests.Common.Vb</RootNamespace>
7+
</PropertyGroup>
8+
9+
</Project>

ReadableExpressions.UnitTests.Common/ReadableExpressions.UnitTests.Common.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19+
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common.Vb\ReadableExpressions.UnitTests.Common.Vb.vbproj" />
1920
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
2021
</ItemGroup>
2122

ReadableExpressions.UnitTests.Net35/ReadableExpressions.UnitTests.Net35.csproj

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
88
<WarningsAsErrors></WarningsAsErrors>
99
<IsPackable>false</IsPackable>
10-
<ProjectGuid>{9EB2525F-48E7-4057-98E5-7FE325ECCD32}</ProjectGuid>
1110
</PropertyGroup>
1211

1312
<PropertyGroup>
1413
<FrameworkPathOverride>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
1514
</PropertyGroup>
1615

1716
<PropertyGroup>
18-
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
17+
<DefineConstants>$(DefineConstants);TRACE;FEATURE_PROPERTY_INDEX_DEFAULTS</DefineConstants>
1918
</PropertyGroup>
2019

2120
<ItemGroup>
@@ -25,18 +24,15 @@
2524
</ItemGroup>
2625

2726
<ItemGroup>
28-
<Reference Include="System" />
29-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
30-
<PackageReference Include="NUnit" Version="3.12.0" />
31-
<PackageReference Include="NUnit3TestAdapter" Version="3.7.0">
27+
<PackageReference Include="NUnit" Version="3.13.3" />
28+
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
3229
<PrivateAssets>all</PrivateAssets>
3330
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3431
</PackageReference>
3532
</ItemGroup>
3633

3734
<ItemGroup>
3835
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
39-
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
4036
</ItemGroup>
4137

4238
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Net5</AssemblyName>
6+
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8+
<WarningsAsErrors></WarningsAsErrors>
9+
<NoWarn>0649;1701;1702</NoWarn>
10+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
11+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
12+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
13+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
14+
<IsPackable>false</IsPackable>
15+
</PropertyGroup>
16+
17+
<PropertyGroup>
18+
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<Compile Include="..\ClsCompliant.cs">
23+
<Link>Properties\ClsCompliant.cs</Link>
24+
</Compile>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
29+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
30+
</Compile>
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
39+
<PackageReference Include="xunit" Version="2.4.1" />
40+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
41+
<PrivateAssets>all</PrivateAssets>
42+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
43+
</PackageReference>
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
48+
</ItemGroup>
49+
50+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Net6</AssemblyName>
6+
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8+
<WarningsAsErrors></WarningsAsErrors>
9+
<NoWarn>0649;1701;1702</NoWarn>
10+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
11+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
12+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
13+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
14+
<IsPackable>false</IsPackable>
15+
</PropertyGroup>
16+
17+
<PropertyGroup>
18+
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<Compile Include="..\ClsCompliant.cs">
23+
<Link>Properties\ClsCompliant.cs</Link>
24+
</Compile>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
29+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
30+
</Compile>
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
39+
<PackageReference Include="xunit" Version="2.4.1" />
40+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
41+
<PrivateAssets>all</PrivateAssets>
42+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
43+
</PackageReference>
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
48+
</ItemGroup>
49+
50+
</Project>

ReadableExpressions.UnitTests.NetCore/ReadableExpressions.UnitTests.NetCore.csproj renamed to ReadableExpressions.UnitTests.NetCore1/ReadableExpressions.UnitTests.NetCore1.csproj

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp1.0</TargetFramework>
5-
<RuntimeFrameworkVersion>1.1.13</RuntimeFrameworkVersion>
65
<LangVersion>8.0</LangVersion>
76
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore</AssemblyName>
87
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
@@ -36,7 +35,7 @@
3635
</ItemGroup>
3736

3837
<ItemGroup>
39-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
38+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
4039
<PackageReference Include="System.Data.Common" Version="4.3.0" />
4140
<PackageReference Include="xunit" Version="2.4.1" />
4241
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
@@ -47,7 +46,6 @@
4746

4847
<ItemGroup>
4948
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
50-
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
5149
</ItemGroup>
5250

5351
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore2</AssemblyName>
6+
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8+
<WarningsAsErrors></WarningsAsErrors>
9+
<NoWarn>0649;1701;1702</NoWarn>
10+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
11+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
12+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
13+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
14+
<IsPackable>false</IsPackable>
15+
</PropertyGroup>
16+
17+
<PropertyGroup>
18+
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<Compile Include="..\ClsCompliant.cs">
23+
<Link>Properties\ClsCompliant.cs</Link>
24+
</Compile>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
29+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
30+
</Compile>
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
39+
<PackageReference Include="xunit" Version="2.4.1" />
40+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
41+
<PrivateAssets>all</PrivateAssets>
42+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
43+
</PackageReference>
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
48+
</ItemGroup>
49+
50+
</Project>

ReadableExpressions.UnitTests.NetCore3.1/ReadableExpressions.UnitTests.NetCore3.1.csproj renamed to ReadableExpressions.UnitTests.NetCore3/ReadableExpressions.UnitTests.NetCore3.csproj

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
<RuntimeFrameworkVersion>3.1.3</RuntimeFrameworkVersion>
6-
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore3_1</AssemblyName>
5+
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore3</AssemblyName>
76
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
87
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
98
<WarningsAsErrors></WarningsAsErrors>
@@ -36,7 +35,7 @@
3635
</ItemGroup>
3736

3837
<ItemGroup>
39-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
38+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
4039
<PackageReference Include="xunit" Version="2.4.1" />
4140
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
4241
<PrivateAssets>all</PrivateAssets>
@@ -46,7 +45,6 @@
4645

4746
<ItemGroup>
4847
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
49-
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
5048
</ItemGroup>
5149

5250
</Project>

ReadableExpressions.UnitTests/ReadableExpressions.UnitTests.csproj

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
</PropertyGroup>
1111

1212
<PropertyGroup>
13-
<DefineConstants>$(DefineConstants);TRACE;FEATURE_EF;FEATURE_PARTIAL_TRUST;FEATURE_DYNAMIC;FEATURE_VALUE_TUPLE;FEATURE_HTML</DefineConstants>
13+
<DefineConstants>$(DefineConstants);TRACE;FEATURE_EF;FEATURE_PARTIAL_TRUST;FEATURE_DYNAMIC;FEATURE_VALUE_TUPLE;FEATURE_HTML;FEATURE_PROPERTY_INDEX_DEFAULTS</DefineConstants>
1414
</PropertyGroup>
1515

1616
<ItemGroup>
1717
<PackageReference Include="EntityFramework" Version="6.4.4" />
1818
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.6.0" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
2019
<PackageReference Include="xunit" Version="2.4.1" />
2120
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
2221
<PrivateAssets>all</PrivateAssets>
@@ -28,7 +27,6 @@
2827
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
2928
<ProjectReference Include="..\ReadableExpressions.Visualizers.Core\ReadableExpressions.Visualizers.Core.csproj" />
3029
<ProjectReference Include="..\ReadableExpressions.Visualizers.ObjectSource\ReadableExpressions.Visualizers.ObjectSource.csproj" />
31-
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
3230
</ItemGroup>
3331

3432
</Project>

ReadableExpressions.UnitTests/Translations/WhenTranslatingMethodCalls.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public void ShouldTranslateAnInstanceCallExpression()
3434
[Fact]
3535
public void ShouldTranslateAStaticCallExpression()
3636
{
37-
// ReSharper disable once ReferenceEqualsWithValueType
38-
var oneEqualsTwo = CreateLambda(() => ReferenceEquals(1, 2));
37+
var oneEqualsTwo = CreateLambda(() => ReferenceEquals("1", "2"));
3938
var referenceEqualsCall = (MethodCallExpression)oneEqualsTwo.Body;
4039
var context = new TestTranslationContext(referenceEqualsCall);
4140
var referenceEqualsMethod = new ClrMethodWrapper(referenceEqualsCall.Method, context);
@@ -45,7 +44,7 @@ public void ShouldTranslateAStaticCallExpression()
4544

4645
var translated = new TestTranslationWriter(translation).GetContent();
4746

48-
translated.ShouldBe("object.ReferenceEquals(1, 2)");
47+
translated.ShouldBe("object.ReferenceEquals(\"1\", \"2\")");
4948
}
5049

5150
[Fact]

0 commit comments

Comments
 (0)