提交 36fb4301 编写于 作者: P Paul Harrington

Replace more instances

上级 bc18e661
......@@ -6,6 +6,7 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis.Collections;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
......@@ -1936,12 +1937,9 @@ private TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kin
return new TypedConstant(type, kind, value);
}
private readonly static object s_boxedTrue = true;
private readonly static object s_boxedFalse = false;
private TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kind, bool value)
{
return CreateTypedConstant(type, kind, value ? s_boxedTrue : s_boxedFalse);
return CreateTypedConstant(type, kind, Boxes.Box(value));
}
/// <summary>
......
......@@ -4,6 +4,7 @@
using System.Diagnostics;
using System.IO;
using System.Text;
using Microsoft.CodeAnalysis.Collections;
namespace Roslyn.Utilities
{
......@@ -181,10 +182,6 @@ public uint ReadCompressedUInt()
}
}
private static readonly object s_int32Zero = 0;
private static readonly object s_booleanTrue = true;
private static readonly object s_booleanFalse = false;
/// <summary>
/// Read a value from the stream. The value must have been written using ObjectWriter.WriteValue.
/// </summary>
......@@ -196,9 +193,9 @@ public object ReadValue()
case DataKind.Null:
return null;
case DataKind.Boolean_T:
return s_booleanTrue;
return Boxes.BoxedTrue;
case DataKind.Boolean_F:
return s_booleanFalse;
return Boxes.BoxedFalse;
case DataKind.Int8:
return _reader.ReadSByte();
case DataKind.UInt8:
......@@ -214,7 +211,7 @@ public object ReadValue()
case DataKind.Int32_S:
return (int)_reader.ReadUInt16();
case DataKind.Int32_Z:
return s_int32Zero;
return Boxes.BoxedInt32Zero;
case DataKind.UInt32:
return _reader.ReadUInt32();
case DataKind.Int64:
......
......@@ -48,6 +48,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup Label="Linked Files">
<Compile Include="..\..\..\Compilers\Core\Portable\Collections\Boxes.cs">
<Link>InternalUtilities\Boxes.cs</Link>
</Compile>
<Compile Include="..\..\..\Compilers\Core\Portable\Collections\ImmutableArrayExtensions.cs">
<Link>InternalUtilities\ImmutableArrayExtensions.cs</Link>
</Compile>
......@@ -925,4 +928,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册