Skip to content

Commit

Permalink
Use netstandard2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Dec 10, 2023
1 parent b850bed commit 3fe7b46
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 60 deletions.
2 changes: 1 addition & 1 deletion VYaml.SourceGenerator/Shims/GlobalAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override int GetHashCode()
{
var hashCode = 0;
foreach (var tuple in this.AliasAndSymbolNames)
hashCode = HashCode.Combine(tuple.GetHashCode(), hashCode);
hashCode = Hash.Combine(tuple.GetHashCode(), hashCode);

_hashCode = hashCode == 0 ? 1 : hashCode;
}
Expand Down
26 changes: 26 additions & 0 deletions VYaml.SourceGenerator/Shims/Hash.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// Copied from https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Roslyn/Hash.cs

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;

namespace Roslyn.Utilities
{
internal static class Hash
{
/// <summary>
/// This is how VB Anonymous Types combine hash values for fields.
/// </summary>
internal static int Combine(int newKey, int currentKey)
{
return unchecked((currentKey * (int)0xA5555529) + newKey);
}

// The rest of this file was removed as they were not currently needed in the polyfill of SyntaxValueProvider.ForAttributeWithMetadataName.
// If that changes, they should be added back as necessary.
}
}
3 changes: 2 additions & 1 deletion VYaml.SourceGenerator/Shims/ImmutableArrayValueComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions;

Expand All @@ -23,7 +24,7 @@ public int GetHashCode(ImmutableArray<T> obj)
{
var hashCode = 0;
foreach (var value in obj)
hashCode = HashCode.Combine(hashCode, EqualityComparer<T>.Default.GetHashCode(value!));
hashCode = Hash.Combine(hashCode, EqualityComparer<T>.Default.GetHashCode(value!));

return hashCode;
}
Expand Down
2 changes: 1 addition & 1 deletion VYaml.SourceGenerator/VYaml.SourceGenerator.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>

Expand Down
2 changes: 1 addition & 1 deletion VYaml.Unity/Assets/VYaml/PerformanceTest/SampleEnvoy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class TypedConfig

[YamlObject]
public partial class RouteConfig
{1
{
public string Name { get; set; }

[YamlMember("virtual_hosts")]
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 3fe7b46

Please sign in to comment.