Skip to content

Commit

Permalink
v3.3 (#108)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SteveWilkes authored Apr 6, 2022
1 parent 428cef3 commit f8f4d8d
Show file tree
Hide file tree
Showing 46 changed files with 1,832 additions and 639 deletions.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions NuGetPack.bat

This file was deleted.

11 changes: 11 additions & 0 deletions ReadableExpressions.UnitTests.Common.Vb/PublicNamedIndex.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Public Class PublicNamedIndex(Of T)

Public ReadOnly Property Value(
Optional indexOne As Integer = 1,
Optional indexTwo As Integer? = Nothing) As T
Get
Return Nothing
End Get
End Property

End Class
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net461;netstandard1.3</TargetFrameworks>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Common.Vb</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests.Common.Vb</RootNamespace>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common.Vb\ReadableExpressions.UnitTests.Common.Vb.vbproj" />
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
<IsPackable>false</IsPackable>
<ProjectGuid>{9EB2525F-48E7-4057-98E5-7FE325ECCD32}</ProjectGuid>
</PropertyGroup>

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

<PropertyGroup>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_PROPERTY_INDEX_DEFAULTS</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,18 +24,15 @@
</ItemGroup>

<ItemGroup>
<Reference Include="System" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.7.0">
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Net5</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
<NoWarn>0649;1701;1702</NoWarn>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\ClsCompliant.cs">
<Link>Properties\ClsCompliant.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.Net6</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
<NoWarn>0649;1701;1702</NoWarn>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\ClsCompliant.cs">
<Link>Properties\ClsCompliant.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<RuntimeFrameworkVersion>1.1.13</RuntimeFrameworkVersion>
<LangVersion>8.0</LangVersion>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
Expand Down Expand Up @@ -36,7 +35,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
Expand All @@ -47,7 +46,6 @@

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore2</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
<NoWarn>0649;1701;1702</NoWarn>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_VALUE_TUPLE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\ClsCompliant.cs">
<Link>Properties\ClsCompliant.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Include="..\ReadableExpressions.UnitTests\**\*.cs" Exclude="..\ReadableExpressions.UnitTests\obj\**\*.cs;">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Remove="..\ReadableExpressions.UnitTests\ShouldExtensions.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeFrameworkVersion>3.1.3</RuntimeFrameworkVersion>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore3_1</AssemblyName>
<AssemblyName>AgileObjects.ReadableExpressions.UnitTests.NetCore3</AssemblyName>
<RootNamespace>AgileObjects.ReadableExpressions.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
Expand Down Expand Up @@ -36,7 +35,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -46,7 +45,6 @@

<ItemGroup>
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_EF;FEATURE_PARTIAL_TRUST;FEATURE_DYNAMIC;FEATURE_VALUE_TUPLE;FEATURE_HTML</DefineConstants>
<DefineConstants>$(DefineConstants);TRACE;FEATURE_EF;FEATURE_PARTIAL_TRUST;FEATURE_DYNAMIC;FEATURE_VALUE_TUPLE;FEATURE_HTML;FEATURE_PROPERTY_INDEX_DEFAULTS</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -28,7 +27,6 @@
<ProjectReference Include="..\ReadableExpressions.UnitTests.Common\ReadableExpressions.UnitTests.Common.csproj" />
<ProjectReference Include="..\ReadableExpressions.Visualizers.Core\ReadableExpressions.Visualizers.Core.csproj" />
<ProjectReference Include="..\ReadableExpressions.Visualizers.ObjectSource\ReadableExpressions.Visualizers.ObjectSource.csproj" />
<ProjectReference Include="..\ReadableExpressions\ReadableExpressions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public void ShouldTranslateAnInstanceCallExpression()
[Fact]
public void ShouldTranslateAStaticCallExpression()
{
// ReSharper disable once ReferenceEqualsWithValueType
var oneEqualsTwo = CreateLambda(() => ReferenceEquals(1, 2));
var oneEqualsTwo = CreateLambda(() => ReferenceEquals("1", "2"));
var referenceEqualsCall = (MethodCallExpression)oneEqualsTwo.Body;
var context = new TestTranslationContext(referenceEqualsCall);
var referenceEqualsMethod = new ClrMethodWrapper(referenceEqualsCall.Method, context);
Expand All @@ -45,7 +44,7 @@ public void ShouldTranslateAStaticCallExpression()

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

translated.ShouldBe("object.ReferenceEquals(1, 2)");
translated.ShouldBe("object.ReferenceEquals(\"1\", \"2\")");
}

[Fact]
Expand Down
Loading

0 comments on commit f8f4d8d

Please sign in to comment.