Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alecsg77 committed May 31, 2020
2 parents 86f6700 + 4be9af6 commit 9206a0b
Show file tree
Hide file tree
Showing 36 changed files with 483 additions and 183 deletions.
11 changes: 8 additions & 3 deletions .azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ pool:
vmImage: vs2017-win2016
variables:
BuildConfiguration: 'Release'
GitVersion.SemVer: ''

steps:
- task: gittools.gitversion.gitversion-task.GitVersion@5
- task: GitVersion@5
displayName: GitVersion
inputs:
runtime: full
updateAssemblyInfo: true
gitVersionPath: 'C:\ProgramData\chocolatey\bin\GitVersion.exe'

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
Expand All @@ -24,21 +24,26 @@ steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: '**/*.sln'
arguments: '--configuration $(BuildConfiguration) --no-restore'
versioningScheme: byEnvVar
versionEnvVar: 'GitVersion.SemVer'

- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: 'test/**/*.UnitTests/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'
arguments: '--configuration $(BuildConfiguration)'
nobuild: true

- task: DotNetCoreCLI@2
displayName: 'dotnet pack release'
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
configurationToPack: '$(BuildConfiguration)'
nobuild: true
versioningScheme: byEnvVar
versionEnvVar: GitVersion.NuGetVersion
Expand Down
7 changes: 7 additions & 0 deletions .issuetracker
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Integration with Issue Tracker
#
# (note that '\' need to be escaped).

[issuetracker "GitHub Rule"]
regex = "#(\\d+)"
url = "https://github.com/alecsg77/ExpressionTreeToolkit/issues/$1"
5 changes: 3 additions & 2 deletions ExpressionTreeToolkit.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExpressionTreeToolkit.Core", "src\ExpressionTreeToolkit.Core\ExpressionTreeToolkit.Core.csproj", "{425CF5CA-C402-4863-B808-BF6FC39F3260}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExpressionTreeToolkit.UnitTests", "test\ExpressionTreeToolkit.UnitTests\ExpressionTreeToolkit.UnitTests.csproj", "{60E75D07-7E65-4781-900E-3F64545F5F8E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E878ADD7-C825-4E9E-9153-E58CDD6FC750}"
ProjectSection(SolutionItems) = preProject
src\Annotations.cs = src\Annotations.cs
src\Directory.Build.props = src\Directory.Build.props
src\SolutionInfo.cs = src\SolutionInfo.cs
EndProjectSection
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.1.200"
"version": "3.1.202"
}
}
12 changes: 12 additions & 0 deletions src/Annotations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#if JETBRAINS_ANNOTATIONS

#else
namespace System.Diagnostics.CodeAnalysis
{
[Conditional("JETBRAINS_ANNOTATIONS")]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property)]
internal sealed class AllowItemNullAttribute : Attribute
{
}
}
#endif
12 changes: 11 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net45;netstandard2.1;</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ExpressionTreeToolkit.snk</AssemblyOriginatorKeyFile>
Expand All @@ -24,4 +24,14 @@
<UseFullSemVerForNuGet>true</UseFullSemVerForNuGet>
<UpdateAssemblyInfo>true</UpdateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<DefineConstants Condition="'$(TargetFramework)'!='netstandard2.1'">JETBRAINS_ANNOTATIONS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="11.1.0" Condition="'$(TargetFramework)'!='netstandard2.1'" />
<Compile Include="$(MSBuildThisFileDirectory)Annotations.cs" Link="Annotations.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;

#if JETBRAINS_ANNOTATIONS
using AllowNullAttribute = JetBrains.Annotations.CanBeNullAttribute;
using DisallowNullAttribute = JetBrains.Annotations.NotNullAttribute;
using AllowItemNullAttribute = JetBrains.Annotations.ItemCanBeNullAttribute;
#endif

namespace ExpressionTreeToolkit
{
Expand All @@ -14,20 +20,23 @@ partial class ExpressionEqualityComparer : IEqualityComparer<BinaryExpression>
/// <param name="x">The first BinaryExpression to compare.</param>
/// <param name="y">The second BinaryExpression to compare.</param>
/// <returns>true if the specified BinaryExpression are equal; otherwise, false.</returns>
protected virtual bool EqualsBinary([NotNull] BinaryExpression x, [NotNull] BinaryExpression y)
protected virtual bool EqualsBinary([DisallowNull] BinaryExpression x, [DisallowNull] BinaryExpression y)
{
if (x == null) throw new ArgumentNullException(nameof(x));
if (y == null) throw new ArgumentNullException(nameof(y));
return x.Type == y.Type
&& Equals(x.Method, y.Method)
&& Equals(x.Left, y.Left)
&& Equals(x.Right, y.Right)
&& Equals(x.Conversion, y.Conversion);
&& Equals(x.Method, y.Method)
&& Equals(x.Left, y.Left)
&& Equals(x.Right, y.Right)
&& Equals(x.Conversion, y.Conversion);
}

/// <summary>Gets the hash code for the specified BinaryExpression.</summary>
/// <param name="node">The BinaryExpression for which to get a hash code.</param>
/// <returns>A hash code for the specified BinaryExpression.</returns>
protected virtual int GetHashCodeBinary([NotNull] BinaryExpression node)
protected virtual int GetHashCodeBinary([DisallowNull] BinaryExpression node)
{
if (node == null) throw new ArgumentNullException(nameof(node));
return GetHashCode(
GetDefaultHashCode(node.Type),
GetDefaultHashCode(node.Method),
Expand All @@ -40,7 +49,7 @@ protected virtual int GetHashCodeBinary([NotNull] BinaryExpression node)
/// <param name="x">The first BinaryExpression to compare.</param>
/// <param name="y">The second BinaryExpression to compare.</param>
/// <returns>true if the specified BinaryExpressions are equal; otherwise, false.</returns>
bool IEqualityComparer<BinaryExpression>.Equals(BinaryExpression x, BinaryExpression y)
bool IEqualityComparer<BinaryExpression>.Equals([AllowNull] BinaryExpression? x, [AllowNull] BinaryExpression? y)
{
if (ReferenceEquals(x, y))
return true;
Expand All @@ -55,7 +64,7 @@ bool IEqualityComparer<BinaryExpression>.Equals(BinaryExpression x, BinaryExpres
/// <param name="obj">The <see cref="BinaryExpression"></see> for which a hash code is to be returned.</param>
/// <returns>A hash code for the specified BinaryExpression.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="obj">obj</paramref> is null.</exception>
int IEqualityComparer<BinaryExpression>.GetHashCode(BinaryExpression obj)
int IEqualityComparer<BinaryExpression>.GetHashCode([DisallowNull] BinaryExpression obj)
{
if (obj == null) throw new ArgumentNullException(nameof(obj));

Expand Down
19 changes: 14 additions & 5 deletions src/ExpressionTreeToolkit.Core/ExpressionEqualityComparer.Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;

#if JETBRAINS_ANNOTATIONS
using AllowNullAttribute = JetBrains.Annotations.CanBeNullAttribute;
using DisallowNullAttribute = JetBrains.Annotations.NotNullAttribute;
using AllowItemNullAttribute = JetBrains.Annotations.ItemCanBeNullAttribute;
#endif

namespace ExpressionTreeToolkit
{
Expand All @@ -14,8 +20,10 @@ partial class ExpressionEqualityComparer : IEqualityComparer<BlockExpression>
/// <param name="x">The first BlockExpression to compare.</param>
/// <param name="y">The second BlockExpression to compare.</param>
/// <returns>true if the specified BlockExpression are equal; otherwise, false.</returns>
protected virtual bool EqualsBlock([NotNull] BlockExpression x, [NotNull] BlockExpression y)
protected virtual bool EqualsBlock([DisallowNull] BlockExpression x, [DisallowNull] BlockExpression y)
{
if (x == null) throw new ArgumentNullException(nameof(x));
if (y == null) throw new ArgumentNullException(nameof(y));
return x.Type == y.Type
&& Equals(x.Expressions, y.Expressions)
&& Equals(x.Variables, y.Variables, EqualsParameter)
Expand All @@ -25,8 +33,9 @@ protected virtual bool EqualsBlock([NotNull] BlockExpression x, [NotNull] BlockE
/// <summary>Gets the hash code for the specified BlockExpression.</summary>
/// <param name="node">The BlockExpression for which to get a hash code.</param>
/// <returns>A hash code for the specified BlockExpression.</returns>
protected virtual int GetHashCodeBlock([NotNull] BlockExpression node)
protected virtual int GetHashCodeBlock([DisallowNull] BlockExpression node)
{
if (node == null) throw new ArgumentNullException(nameof(node));
return GetHashCode(
GetDefaultHashCode(node.Type),
GetHashCode(node.Expressions),
Expand All @@ -38,7 +47,7 @@ protected virtual int GetHashCodeBlock([NotNull] BlockExpression node)
/// <param name="x">The first BlockExpression to compare.</param>
/// <param name="y">The second BlockExpression to compare.</param>
/// <returns>true if the specified BlockExpressions are equal; otherwise, false.</returns>
bool IEqualityComparer<BlockExpression>.Equals(BlockExpression x, BlockExpression y)
bool IEqualityComparer<BlockExpression>.Equals([AllowNull] BlockExpression? x, [AllowNull] BlockExpression? y)
{
if (ReferenceEquals(x, y))
return true;
Expand All @@ -53,7 +62,7 @@ bool IEqualityComparer<BlockExpression>.Equals(BlockExpression x, BlockExpressio
/// <param name="obj">The <see cref="BlockExpression"></see> for which a hash code is to be returned.</param>
/// <returns>A hash code for the specified BlockExpression.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="obj">obj</paramref> is null.</exception>
int IEqualityComparer<BlockExpression>.GetHashCode(BlockExpression obj)
int IEqualityComparer<BlockExpression>.GetHashCode([DisallowNull] BlockExpression obj)
{
if (obj == null) throw new ArgumentNullException(nameof(obj));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;

#if JETBRAINS_ANNOTATIONS
using AllowNullAttribute = JetBrains.Annotations.CanBeNullAttribute;
using DisallowNullAttribute = JetBrains.Annotations.NotNullAttribute;
using AllowItemNullAttribute = JetBrains.Annotations.ItemCanBeNullAttribute;
#endif

namespace ExpressionTreeToolkit
{
Expand All @@ -14,8 +20,10 @@ partial class ExpressionEqualityComparer : IEqualityComparer<ConditionalExpressi
/// <param name="x">The first ConditionalExpression to compare.</param>
/// <param name="y">The second ConditionalExpression to compare.</param>
/// <returns>true if the specified ConditionalExpression are equal; otherwise, false.</returns>
protected virtual bool EqualsConditional([NotNull] ConditionalExpression x, [NotNull] ConditionalExpression y)
protected virtual bool EqualsConditional([DisallowNull] ConditionalExpression x, [DisallowNull] ConditionalExpression y)
{
if (x == null) throw new ArgumentNullException(nameof(x));
if (y == null) throw new ArgumentNullException(nameof(y));
return x.Type == y.Type
&& Equals(x.Test, y.Test)
&& Equals(x.IfTrue, y.IfTrue)
Expand All @@ -25,8 +33,9 @@ protected virtual bool EqualsConditional([NotNull] ConditionalExpression x, [Not
/// <summary>Gets the hash code for the specified ConditionalExpression.</summary>
/// <param name="node">The ConditionalExpression for which to get a hash code.</param>
/// <returns>A hash code for the specified ConditionalExpression.</returns>
protected virtual int GetHashCodeConditional([NotNull] ConditionalExpression node)
protected virtual int GetHashCodeConditional([DisallowNull] ConditionalExpression node)
{
if (node == null) throw new ArgumentNullException(nameof(node));
return GetHashCode(
GetDefaultHashCode(node.Type),
GetHashCode(node.Test),
Expand All @@ -38,7 +47,7 @@ protected virtual int GetHashCodeConditional([NotNull] ConditionalExpression nod
/// <param name="x">The first ConditionalExpression to compare.</param>
/// <param name="y">The second ConditionalExpression to compare.</param>
/// <returns>true if the specified ConditionalExpressions are equal; otherwise, false.</returns>
bool IEqualityComparer<ConditionalExpression>.Equals(ConditionalExpression x, ConditionalExpression y)
bool IEqualityComparer<ConditionalExpression>.Equals([AllowNull] ConditionalExpression? x, [AllowNull] ConditionalExpression? y)
{
if (ReferenceEquals(x, y))
return true;
Expand All @@ -53,7 +62,7 @@ bool IEqualityComparer<ConditionalExpression>.Equals(ConditionalExpression x, Co
/// <param name="obj">The <see cref="ConditionalExpression"></see> for which a hash code is to be returned.</param>
/// <returns>A hash code for the specified ConditionalExpression.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="obj">obj</paramref> is null.</exception>
int IEqualityComparer<ConditionalExpression>.GetHashCode(ConditionalExpression obj)
int IEqualityComparer<ConditionalExpression>.GetHashCode([DisallowNull] ConditionalExpression obj)
{
if (obj == null) throw new ArgumentNullException(nameof(obj));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;

#if JETBRAINS_ANNOTATIONS
using AllowNullAttribute = JetBrains.Annotations.CanBeNullAttribute;
using DisallowNullAttribute = JetBrains.Annotations.NotNullAttribute;
using AllowItemNullAttribute = JetBrains.Annotations.ItemCanBeNullAttribute;
#endif

namespace ExpressionTreeToolkit
{
Expand All @@ -14,17 +20,20 @@ partial class ExpressionEqualityComparer : IEqualityComparer<ConstantExpression>
/// <param name="x">The first ConstantExpression to compare.</param>
/// <param name="y">The second ConstantExpression to compare.</param>
/// <returns>true if the specified ConstantExpression are equal; otherwise, false.</returns>
protected virtual bool EqualsConstant([NotNull] ConstantExpression x, [NotNull] ConstantExpression y)
protected virtual bool EqualsConstant([DisallowNull] ConstantExpression x, [DisallowNull] ConstantExpression y)
{
if (x == null) throw new ArgumentNullException(nameof(x));
if (y == null) throw new ArgumentNullException(nameof(y));
return x.Type == y.Type
&& Equals(x.Value, y.Value);
}

/// <summary>Gets the hash code for the specified ConstantExpression.</summary>
/// <param name="node">The ConstantExpression for which to get a hash code.</param>
/// <returns>A hash code for the specified ConstantExpression.</returns>
protected virtual int GetHashCodeConstant([NotNull] ConstantExpression node)
protected virtual int GetHashCodeConstant([DisallowNull] ConstantExpression node)
{
if (node == null) throw new ArgumentNullException(nameof(node));
return GetHashCode(
GetDefaultHashCode(node.Type),
GetDefaultHashCode(node.Value));
Expand All @@ -34,7 +43,7 @@ protected virtual int GetHashCodeConstant([NotNull] ConstantExpression node)
/// <param name="x">The first ConstantExpression to compare.</param>
/// <param name="y">The second ConstantExpression to compare.</param>
/// <returns>true if the specified ConstantExpressions are equal; otherwise, false.</returns>
bool IEqualityComparer<ConstantExpression>.Equals(ConstantExpression x, ConstantExpression y)
bool IEqualityComparer<ConstantExpression>.Equals([AllowNull] ConstantExpression? x, [AllowNull] ConstantExpression? y)
{
if (ReferenceEquals(x, y))
return true;
Expand All @@ -49,7 +58,7 @@ bool IEqualityComparer<ConstantExpression>.Equals(ConstantExpression x, Constant
/// <param name="obj">The <see cref="ConstantExpression"></see> for which a hash code is to be returned.</param>
/// <returns>A hash code for the specified ConstantExpression.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="obj">obj</paramref> is null.</exception>
int IEqualityComparer<ConstantExpression>.GetHashCode(ConstantExpression obj)
int IEqualityComparer<ConstantExpression>.GetHashCode([DisallowNull] ConstantExpression obj)
{
if (obj == null) throw new ArgumentNullException(nameof(obj));

Expand Down
Loading

0 comments on commit 9206a0b

Please sign in to comment.