You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@@ -1,7 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Expressions.Tests", "tests\System.Linq.Expressions.Tests.csproj", "{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -9,33 +8,43 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Expressions.Tes
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Expressions", "src\System.Linq.Expressions.csproj", "{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427} = {33B6ACE2-0B53-4054-8BF6-482F9E0E9427}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Expressions", "ref\System.Linq.Expressions.csproj", "{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{4B4AA59B-89F9-4A34-B3C3-C97EF531EE00} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
|
||||
{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
|
||||
{33B6ACE2-0B53-4054-8BF6-482F9E0E9427} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.2.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{33B6ACE2-0B53-4054-8BF6-482F9E0E9427}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
net461-Windows_NT;
|
||||
uap-Windows_NT;
|
||||
uapaot-Windows_NT;
|
||||
netcoreapp;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,64 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
@@ -150,9 +91,6 @@
|
||||
<data name="TypeMustNotBePointer" xml:space="preserve">
|
||||
<value>Type must not be a pointer type</value>
|
||||
</data>
|
||||
<data name="TypeDoesNotHaveConstructorForTheSignature" xml:space="preserve">
|
||||
<value>Type doesn't have constructor with a given signature</value>
|
||||
</data>
|
||||
<data name="SetterMustBeVoid" xml:space="preserve">
|
||||
<value>Setter should have void type.</value>
|
||||
</data>
|
||||
|
||||
@@ -9,28 +9,51 @@
|
||||
<ProjectGuid>{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}</ProjectGuid>
|
||||
<AssemblyName>System.Linq.Expressions</AssemblyName>
|
||||
<RootNamespace>System.Linq.Expressions</RootNamespace>
|
||||
<IsInterpreting Condition="'$(TargetGroup)' == 'netcore50'">true</IsInterpreting>
|
||||
<IsInterpreting Condition="'$(TargetGroup)' == 'uapaot'">true</IsInterpreting>
|
||||
<DefineConstants Condition=" '$(IsInterpreting)' != 'true' ">$(DefineConstants);FEATURE_COMPILE</DefineConstants>
|
||||
<DefineConstants Condition=" '$(FeatureInterpret)' == 'true' ">$(DefineConstants);FEATURE_INTERPRET</DefineConstants>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net461'">true</IsPartialFacadeAssembly>
|
||||
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net461'">None</ResourcesSourceOutputDirectory>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
|
||||
<!-- netcore50 project.json fork is shared for both netcore50 and netcore50aot. This redirects netcore50aot. -->
|
||||
<PropertyGroup Condition="'$(TargetGroup)' == 'netcore50aot'">
|
||||
<ProjectJson>netcore50/project.json</ProjectJson>
|
||||
<ProjectLockJson>netcore50/project.lock.json</ProjectLockJson>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(TargetGroup)' == 'uapaot'">
|
||||
<DefineConstants>$(DefineConstants);FEATURE_DYNAMIC_DELEGATE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcore50aot'">
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'uapaot'">
|
||||
<EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
|
||||
<TargetingPackReference Include="System.Private.CoreLib.DynamicDelegate" />
|
||||
<!-- Needed for DynamicDelegate -->
|
||||
<ReferenceFromRuntime Include="System.Private.CoreLib" />
|
||||
<!-- Causes us to use project references to avoid duplicate definitions that the ref assemblies would give us -->
|
||||
<ProjectReference Include="..\..\System.Diagnostics.Tools\src\System.Diagnostics.Tools.csproj" />
|
||||
<ProjectReference Include="..\..\System.Collections\src\System.Collections.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Diagnostics.Tools\src\System.Diagnostics.Tools.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj" />
|
||||
<ProjectReference Include="..\..\System.ObjectModel\src\System.ObjectModel.csproj" />
|
||||
<ProjectReference Include="..\..\System.Reflection.Primitives\src\System.Reflection.Primitives.csproj" />
|
||||
<ProjectReference Include="..\..\System.Linq\src\System.Linq.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'net461'">
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'uapaot'">
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Diagnostics.Contracts" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.Linq" />
|
||||
<Reference Include="System.ObjectModel" />
|
||||
<Reference Include="System.Reflection.Emit" />
|
||||
<Reference Include="System.Reflection.Emit.ILGeneration" />
|
||||
<Reference Include="System.Reflection.Emit.Lightweight" />
|
||||
<Reference Include="System.Reflection.Primitives" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Threading" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CommonPath)\System\Collections\Generic\ArrayBuilder.cs">
|
||||
<Link>Common\System\Collections\Generic\ArrayBuilder.cs</Link>
|
||||
</Compile>
|
||||
@@ -46,6 +69,9 @@
|
||||
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.cs">
|
||||
<Link>Common\System\Dynamic\Utils\ContractUtils.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs">
|
||||
<Link>Common\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Dynamic\Utils\Error.cs">
|
||||
<Link>Common\System\Dynamic\Utils\Error.cs</Link>
|
||||
</Compile>
|
||||
@@ -130,22 +156,8 @@
|
||||
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.RuntimeVariables.cs" />
|
||||
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.MergedRuntimeVariables.cs" />
|
||||
<Compile Include="System\Runtime\CompilerServices\ReadOnlyCollectionBuilder.cs" />
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Diagnostics.Contracts" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.Linq" />
|
||||
<Reference Include="System.ObjectModel" />
|
||||
<Reference Include="System.Reflection.Emit" />
|
||||
<Reference Include="System.Reflection.Emit.ILGeneration" />
|
||||
<Reference Include="System.Reflection.Emit.Lightweight" />
|
||||
<Reference Include="System.Reflection.Primitives" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Threading" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
|
||||
<ItemGroup>
|
||||
<Compile Include="System\Linq\Expressions\DynamicExpressionVisitor.cs" />
|
||||
<Compile Include="System\Linq\Expressions\DynamicExpression.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Expression.netstandard.cs" />
|
||||
@@ -195,13 +207,10 @@
|
||||
<Compile Include="System\Dynamic\UnaryOperationBinder.cs" />
|
||||
<Compile Include="System\Dynamic\IInvokeOnGetBinder.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(IsInterpreting)' != 'true' And '$(TargetGroup)' != 'net461'">
|
||||
<ItemGroup Condition=" '$(IsInterpreting)' != 'true'">
|
||||
<Compile Include="$(CommonPath)\System\Collections\Generic\ReferenceEqualityComparer.cs">
|
||||
<Link>Common\System\Collections\Generic\ReferenceEqualityComparer.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs">
|
||||
<Link>Common\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\AssemblyGen.cs">
|
||||
<Link>Common\System\Linq\Expressions\Compiler\AssemblyGen.cs</Link>
|
||||
</Compile>
|
||||
@@ -212,7 +221,7 @@
|
||||
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.Storage.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\HoistedLocals.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\ILGen.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\KeyedQueue.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\KeyedStack.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\LabelInfo.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs" />
|
||||
@@ -235,7 +244,7 @@
|
||||
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.ExpressionQuoter.cs" />
|
||||
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.RuntimeVariableList.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" ('$(IsInterpreting)' == 'true' Or '$(FeatureInterpret)' == 'true') And '$(TargetGroup)' != 'net461' ">
|
||||
<ItemGroup Condition="'$(IsInterpreting)' == 'true' Or '$(FeatureInterpret)' == 'true'">
|
||||
<Compile Include="$(CommonPath)\System\Dynamic\Utils\DelegateHelpers.cs">
|
||||
<Link>Common\System\Dynamic\Utils\DelegateHelpers.cs</Link>
|
||||
</Compile>
|
||||
@@ -278,7 +287,6 @@
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\NumericConvertInstruction.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\NullCheckInstruction.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\OrInstruction.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\OnesComplementInstruction.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\RightShiftInstruction.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\RuntimeVariables.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\StackOperations.cs" />
|
||||
@@ -287,12 +295,8 @@
|
||||
<Compile Include="System\Linq\Expressions\Interpreter\Utilities.cs" />
|
||||
<Compile Include="System\Linq\Expressions\Compiler\DelegateHelpers.Generated.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net461'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -79,7 +79,7 @@ namespace System.Dynamic
|
||||
{
|
||||
Type ct = Expression.Type;
|
||||
// valuetype at compile time, type cannot change.
|
||||
if (ct.GetTypeInfo().IsValueType)
|
||||
if (ct.IsValueType)
|
||||
{
|
||||
return ct;
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ namespace System.Dynamic
|
||||
|
||||
Expression condition;
|
||||
// If the return type can not be assigned null then just check for type assignability otherwise allow null.
|
||||
if (binder.ReturnType.GetTypeInfo().IsValueType && Nullable.GetUnderlyingType(binder.ReturnType) == null)
|
||||
if (binder.ReturnType.IsValueType && Nullable.GetUnderlyingType(binder.ReturnType) == null)
|
||||
{
|
||||
condition = Expression.TypeIs(resultMO.Expression, binder.ReturnType);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace System.Dynamic.Utils
|
||||
public static Type GetNullableType(this Type type)
|
||||
{
|
||||
Debug.Assert(type != null, "type cannot be null");
|
||||
if (type.GetTypeInfo().IsValueType && !IsNullableType(type))
|
||||
if (type.IsValueType && !IsNullableType(type))
|
||||
{
|
||||
return typeof(Nullable<>).MakeGenericType(type);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace System.Dynamic.Utils
|
||||
|
||||
public static bool IsNullableOrReferenceType(this Type type)
|
||||
{
|
||||
return !type.GetTypeInfo().IsValueType || IsNullableType(type);
|
||||
return !type.IsValueType || IsNullableType(type);
|
||||
}
|
||||
|
||||
public static bool IsBool(this Type type)
|
||||
@@ -47,7 +47,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsNumeric(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (!type.GetTypeInfo().IsEnum)
|
||||
if (!type.IsEnum)
|
||||
{
|
||||
switch (type.GetTypeCode())
|
||||
{
|
||||
@@ -71,7 +71,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsInteger(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (type.GetTypeInfo().IsEnum)
|
||||
if (type.IsEnum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsInteger64(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (type.GetTypeInfo().IsEnum)
|
||||
if (type.IsEnum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsArithmetic(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (!type.GetTypeInfo().IsEnum)
|
||||
if (!type.IsEnum)
|
||||
{
|
||||
switch (type.GetTypeCode())
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsUnsignedInt(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (!type.GetTypeInfo().IsEnum)
|
||||
if (!type.IsEnum)
|
||||
{
|
||||
switch (type.GetTypeCode())
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsIntegerOrBool(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (!type.GetTypeInfo().IsEnum)
|
||||
if (!type.IsEnum)
|
||||
{
|
||||
switch (type.GetTypeCode())
|
||||
{
|
||||
@@ -184,7 +184,7 @@ namespace System.Dynamic.Utils
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (instanceType.GetTypeInfo().IsValueType)
|
||||
if (instanceType.IsValueType)
|
||||
{
|
||||
if (AreReferenceAssignable(targetType, typeof(object)))
|
||||
{
|
||||
@@ -194,13 +194,13 @@ namespace System.Dynamic.Utils
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (instanceType.GetTypeInfo().IsEnum && AreReferenceAssignable(targetType, typeof(Enum)))
|
||||
if (instanceType.IsEnum && AreReferenceAssignable(targetType, typeof(Enum)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// A call to an interface implemented by a struct is legal whether the struct has
|
||||
// been boxed or not.
|
||||
if (targetType.GetTypeInfo().IsInterface)
|
||||
if (targetType.IsInterface)
|
||||
{
|
||||
foreach (Type interfaceType in instanceType.GetTypeInfo().ImplementedInterfaces)
|
||||
{
|
||||
@@ -236,12 +236,12 @@ namespace System.Dynamic.Utils
|
||||
// Primitive runtime conversions
|
||||
// All conversions amongst enum, bool, char, integer and float types
|
||||
// (and their corresponding nullable types) are legal except for
|
||||
// nonbool==>bool and nonbool==>bool?
|
||||
// Since we have already covered bool==>bool, bool==>bool?, etc, above,
|
||||
// we can just disallow having a bool or bool? destination type here.
|
||||
if (IsConvertible(source) && IsConvertible(dest) && GetNonNullableType(dest) != typeof(bool))
|
||||
// nonbool==>bool and nonbool==>bool? which are only legal from
|
||||
// bool-backed enums.
|
||||
if (IsConvertible(source) && IsConvertible(dest))
|
||||
{
|
||||
return true;
|
||||
return GetNonNullableType(dest) != typeof(bool)
|
||||
|| source.IsEnum && source.GetEnumUnderlyingType() == typeof(bool);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -262,17 +262,17 @@ namespace System.Dynamic.Utils
|
||||
Type nnDestType = GetNonNullableType(dest);
|
||||
|
||||
// Down conversion
|
||||
if (nnSourceType.GetTypeInfo().IsAssignableFrom(nnDestType.GetTypeInfo()))
|
||||
if (nnSourceType.IsAssignableFrom(nnDestType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Up conversion
|
||||
if (nnDestType.GetTypeInfo().IsAssignableFrom(nnSourceType.GetTypeInfo()))
|
||||
if (nnDestType.IsAssignableFrom(nnSourceType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Interface conversion
|
||||
if (source.GetTypeInfo().IsInterface || dest.GetTypeInfo().IsInterface)
|
||||
if (source.IsInterface || dest.IsInterface)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -291,25 +291,25 @@ namespace System.Dynamic.Utils
|
||||
private static bool IsCovariant(Type t)
|
||||
{
|
||||
Debug.Assert(t != null);
|
||||
return 0 != (t.GetTypeInfo().GenericParameterAttributes & GenericParameterAttributes.Covariant);
|
||||
return 0 != (t.GenericParameterAttributes & GenericParameterAttributes.Covariant);
|
||||
}
|
||||
|
||||
private static bool IsContravariant(Type t)
|
||||
{
|
||||
Debug.Assert(t != null);
|
||||
return 0 != (t.GetTypeInfo().GenericParameterAttributes & GenericParameterAttributes.Contravariant);
|
||||
return 0 != (t.GenericParameterAttributes & GenericParameterAttributes.Contravariant);
|
||||
}
|
||||
|
||||
private static bool IsInvariant(Type t)
|
||||
{
|
||||
Debug.Assert(t != null);
|
||||
return 0 == (t.GetTypeInfo().GenericParameterAttributes & GenericParameterAttributes.VarianceMask);
|
||||
return 0 == (t.GenericParameterAttributes & GenericParameterAttributes.VarianceMask);
|
||||
}
|
||||
|
||||
private static bool IsDelegate(Type t)
|
||||
{
|
||||
Debug.Assert(t != null);
|
||||
return t.GetTypeInfo().IsSubclassOf(typeof(MulticastDelegate));
|
||||
return t.IsSubclassOf(typeof(MulticastDelegate));
|
||||
}
|
||||
|
||||
public static bool IsLegalExplicitVariantDelegateConversion(Type source, Type dest)
|
||||
@@ -326,7 +326,7 @@ namespace System.Dynamic.Utils
|
||||
// o If type parameter Xi is declared to be contravariant ("in") then either Si must be identical to Ti,
|
||||
// or Si and Ti must both be reference types.
|
||||
|
||||
if (!IsDelegate(source) || !IsDelegate(dest) || !source.GetTypeInfo().IsGenericType || !dest.GetTypeInfo().IsGenericType)
|
||||
if (!IsDelegate(source) || !IsDelegate(dest) || !source.IsGenericType || !dest.IsGenericType)
|
||||
return false;
|
||||
|
||||
Type genericDelegate = source.GetGenericTypeDefinition();
|
||||
@@ -375,7 +375,7 @@ namespace System.Dynamic.Utils
|
||||
}
|
||||
else if (IsContravariant(genericParameter))
|
||||
{
|
||||
if (sourceArgument.GetTypeInfo().IsValueType || destArgument.GetTypeInfo().IsValueType)
|
||||
if (sourceArgument.IsValueType || destArgument.IsValueType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ namespace System.Dynamic.Utils
|
||||
public static bool IsConvertible(this Type type)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
if (type.GetTypeInfo().IsEnum)
|
||||
if (type.IsEnum)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ namespace System.Dynamic.Utils
|
||||
|
||||
public static bool HasReferenceEquality(Type left, Type right)
|
||||
{
|
||||
if (left.GetTypeInfo().IsValueType || right.GetTypeInfo().IsValueType)
|
||||
if (left.IsValueType || right.IsValueType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -424,7 +424,7 @@ namespace System.Dynamic.Utils
|
||||
// If we have two reference types and one is assignable to the
|
||||
// other then we can do reference equality.
|
||||
|
||||
return left.GetTypeInfo().IsInterface || right.GetTypeInfo().IsInterface ||
|
||||
return left.IsInterface || right.IsInterface ||
|
||||
AreReferenceAssignable(left, right) ||
|
||||
AreReferenceAssignable(right, left);
|
||||
}
|
||||
@@ -433,17 +433,17 @@ namespace System.Dynamic.Utils
|
||||
{
|
||||
// If we have an interface and a reference type then we can do
|
||||
// reference equality.
|
||||
if (left.GetTypeInfo().IsInterface && !right.GetTypeInfo().IsValueType)
|
||||
if (left.IsInterface && !right.IsValueType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (right.GetTypeInfo().IsInterface && !left.GetTypeInfo().IsValueType)
|
||||
if (right.IsInterface && !left.IsValueType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// If we have two reference types and one is assignable to the
|
||||
// other then we can do reference equality.
|
||||
if (!left.GetTypeInfo().IsValueType && !right.GetTypeInfo().IsValueType)
|
||||
if (!left.IsValueType && !right.IsValueType)
|
||||
{
|
||||
if (AreReferenceAssignable(left, right) || AreReferenceAssignable(right, left))
|
||||
{
|
||||
@@ -458,11 +458,11 @@ namespace System.Dynamic.Utils
|
||||
}
|
||||
// We have two identical value types, modulo nullability. (If they were both the
|
||||
// same reference type then we would have returned true earlier.)
|
||||
Debug.Assert(left.GetTypeInfo().IsValueType);
|
||||
Debug.Assert(left.IsValueType);
|
||||
// Equality between struct types is only defined for numerics, bools, enums,
|
||||
// and their nullable equivalents.
|
||||
Type nnType = GetNonNullableType(left);
|
||||
if (nnType == typeof(bool) || IsNumeric(nnType) || nnType.GetTypeInfo().IsEnum)
|
||||
if (nnType == typeof(bool) || IsNumeric(nnType) || nnType.IsEnum)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -644,14 +644,14 @@ namespace System.Dynamic.Utils
|
||||
|
||||
private static bool IsImplicitReferenceConversion(Type source, Type destination)
|
||||
{
|
||||
return destination.GetTypeInfo().IsAssignableFrom(source.GetTypeInfo());
|
||||
return destination.IsAssignableFrom(source);
|
||||
}
|
||||
|
||||
private static bool IsImplicitBoxingConversion(Type source, Type destination)
|
||||
{
|
||||
if (source.GetTypeInfo().IsValueType && (destination == typeof(object) || destination == typeof(ValueType)))
|
||||
if (source.IsValueType && (destination == typeof(object) || destination == typeof(ValueType)))
|
||||
return true;
|
||||
if (source.GetTypeInfo().IsEnum && destination == typeof(Enum))
|
||||
if (source.IsEnum && destination == typeof(Enum))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -671,7 +671,7 @@ namespace System.Dynamic.Utils
|
||||
{
|
||||
return type;
|
||||
}
|
||||
if (definition.GetTypeInfo().IsInterface)
|
||||
if (definition.IsInterface)
|
||||
{
|
||||
foreach (Type itype in type.GetTypeInfo().ImplementedInterfaces)
|
||||
{
|
||||
@@ -680,7 +680,7 @@ namespace System.Dynamic.Utils
|
||||
return found;
|
||||
}
|
||||
}
|
||||
type = type.GetTypeInfo().BaseType;
|
||||
type = type.BaseType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ namespace System.Dynamic.Utils
|
||||
{
|
||||
return result;
|
||||
}
|
||||
type = type.GetTypeInfo().BaseType;
|
||||
type = type.BaseType;
|
||||
} while (type != null);
|
||||
return null;
|
||||
}
|
||||
@@ -714,10 +714,11 @@ namespace System.Dynamic.Utils
|
||||
}
|
||||
|
||||
#if FEATURE_COMPILE
|
||||
internal static bool IsUnsigned(this Type type)
|
||||
internal static bool IsUnsigned(this Type type) => IsUnsigned(GetNonNullableType(type).GetTypeCode());
|
||||
|
||||
internal static bool IsUnsigned(this TypeCode typeCode)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
switch (type.GetTypeCode())
|
||||
switch (typeCode)
|
||||
{
|
||||
case TypeCode.Byte:
|
||||
case TypeCode.UInt16:
|
||||
@@ -730,10 +731,11 @@ namespace System.Dynamic.Utils
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsFloatingPoint(this Type type)
|
||||
internal static bool IsFloatingPoint(this Type type) => IsFloatingPoint(GetNonNullableType(type).GetTypeCode());
|
||||
|
||||
internal static bool IsFloatingPoint(this TypeCode typeCode)
|
||||
{
|
||||
type = GetNonNullableType(type);
|
||||
switch (type.GetTypeCode())
|
||||
switch (typeCode)
|
||||
{
|
||||
case TypeCode.Single:
|
||||
case TypeCode.Double:
|
||||
@@ -744,12 +746,5 @@ namespace System.Dynamic.Utils
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsVector(this Type type)
|
||||
{
|
||||
// Unfortunately, the IsSzArray property of System.Type is inaccessible to us,
|
||||
// so we use a little equality comparison trick instead. This omission is being
|
||||
// tracked at https://github.com/dotnet/coreclr/issues/1877.
|
||||
return type == type.GetElementType().MakeArrayType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
e82308f0f7472fcabe2867667b5f3a790f9972e9
|
||||
7866f44723ea1ae12b3293a36f7dd1856eedb124
|
||||
@@ -15,35 +15,59 @@ namespace System.Linq.Expressions
|
||||
s_ArrayOfType_Bool ??
|
||||
(s_ArrayOfType_Bool = new[] { typeof(bool) });
|
||||
|
||||
private static ConstructorInfo s_Nullable_Boolean_Ctor;
|
||||
|
||||
public static ConstructorInfo Nullable_Boolean_Ctor
|
||||
=> s_Nullable_Boolean_Ctor ?? (s_Nullable_Boolean_Ctor = typeof(bool?).GetConstructor(new[] {typeof(bool)}));
|
||||
|
||||
private static ConstructorInfo s_Decimal_Ctor_Int32;
|
||||
public static ConstructorInfo Decimal_Ctor_Int32 =>
|
||||
s_Decimal_Ctor_Int32 ??
|
||||
(s_Decimal_Ctor_Int32 = typeof(decimal).GetConstructor(new[] { typeof(int) }));
|
||||
|
||||
private static ConstructorInfo s_Decimal_Ctor_UInt32;
|
||||
public static ConstructorInfo Decimal_Ctor_UInt32 =>
|
||||
s_Decimal_Ctor_UInt32 ??
|
||||
(s_Decimal_Ctor_UInt32 = typeof(decimal).GetConstructor(new[] { typeof(uint) }));
|
||||
|
||||
private static ConstructorInfo s_Decimal_Ctor_Int64;
|
||||
public static ConstructorInfo Decimal_Ctor_Int64 =>
|
||||
s_Decimal_Ctor_Int64 ??
|
||||
(s_Decimal_Ctor_Int64 = typeof(decimal).GetConstructor(new[] { typeof(long) }));
|
||||
|
||||
private static ConstructorInfo s_Decimal_Ctor_UInt64;
|
||||
public static ConstructorInfo Decimal_Ctor_UInt64 =>
|
||||
s_Decimal_Ctor_UInt64 ??
|
||||
(s_Decimal_Ctor_UInt64 = typeof(decimal).GetConstructor(new[] { typeof(ulong) }));
|
||||
|
||||
private static ConstructorInfo s_Decimal_Ctor_Int32_Int32_Int32_Bool_Byte;
|
||||
public static ConstructorInfo Decimal_Ctor_Int32_Int32_Int32_Bool_Byte =>
|
||||
s_Decimal_Ctor_Int32_Int32_Int32_Bool_Byte ??
|
||||
(s_Decimal_Ctor_Int32_Int32_Int32_Bool_Byte = typeof(decimal).GetConstructor(new[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) }));
|
||||
|
||||
private static ConstructorInfo s_Closure_ObjectArray_ObjectArray;
|
||||
public static ConstructorInfo Closure_ObjectArray_ObjectArray =>
|
||||
s_Closure_ObjectArray_ObjectArray ??
|
||||
(s_Closure_ObjectArray_ObjectArray = typeof(Closure).GetConstructor(new[] { typeof(object[]), typeof(object[]) }));
|
||||
private static FieldInfo s_Decimal_One;
|
||||
public static FieldInfo Decimal_One
|
||||
=> s_Decimal_One ?? (s_Decimal_One = typeof(decimal).GetField(nameof(decimal.One)));
|
||||
|
||||
private static FieldInfo s_Closure_Constants;
|
||||
public static FieldInfo Closure_Constants =>
|
||||
s_Closure_Constants ??
|
||||
(s_Closure_Constants = typeof(Closure).GetField(nameof(Closure.Constants)));
|
||||
private static FieldInfo s_Decimal_MinusOne;
|
||||
public static FieldInfo Decimal_MinusOne
|
||||
=> s_Decimal_MinusOne ?? (s_Decimal_MinusOne = typeof(decimal).GetField(nameof(decimal.MinusOne)));
|
||||
|
||||
private static FieldInfo s_Closure_Locals;
|
||||
public static FieldInfo Closure_Locals =>
|
||||
s_Closure_Locals ??
|
||||
(s_Closure_Locals = typeof(Closure).GetField(nameof(Closure.Locals)));
|
||||
private static FieldInfo s_Decimal_MinValue;
|
||||
public static FieldInfo Decimal_MinValue
|
||||
=> s_Decimal_MinValue ?? (s_Decimal_MinValue = typeof(decimal).GetField(nameof(decimal.MinValue)));
|
||||
|
||||
private static FieldInfo s_Decimal_MaxValue;
|
||||
public static FieldInfo Decimal_MaxValue
|
||||
=> s_Decimal_MaxValue ?? (s_Decimal_MaxValue = typeof(decimal).GetField(nameof(decimal.MaxValue)));
|
||||
|
||||
private static FieldInfo s_Decimal_Zero;
|
||||
public static FieldInfo Decimal_Zero
|
||||
=> s_Decimal_Zero ?? (s_Decimal_Zero = typeof(decimal).GetField(nameof(decimal.Zero)));
|
||||
|
||||
private static FieldInfo s_DateTime_MinValue;
|
||||
public static FieldInfo DateTime_MinValue
|
||||
=> s_DateTime_MinValue ?? (s_DateTime_MinValue = typeof(DateTime).GetField(nameof(DateTime.MinValue)));
|
||||
|
||||
private static MethodInfo s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle;
|
||||
public static MethodInfo MethodBase_GetMethodFromHandle_RuntimeMethodHandle =>
|
||||
@@ -65,26 +89,6 @@ namespace System.Linq.Expressions
|
||||
s_String_op_Equality_String_String ??
|
||||
(s_String_op_Equality_String_String = typeof(string).GetMethod("op_Equality", new[] { typeof(string), typeof(string) }));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array;
|
||||
public static MethodInfo RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array =>
|
||||
s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array ??
|
||||
(s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.CreateRuntimeVariables), new[] { typeof(object[]), typeof(long[]) }));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_CreateRuntimeVariables;
|
||||
public static MethodInfo RuntimeOps_CreateRuntimeVariables =>
|
||||
s_RuntimeOps_CreateRuntimeVariables ??
|
||||
(s_RuntimeOps_CreateRuntimeVariables = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.CreateRuntimeVariables), Type.EmptyTypes));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_MergeRuntimeVariables;
|
||||
public static MethodInfo RuntimeOps_MergeRuntimeVariables =>
|
||||
s_RuntimeOps_MergeRuntimeVariables ??
|
||||
(s_RuntimeOps_MergeRuntimeVariables = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.MergeRuntimeVariables)));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_Quote;
|
||||
public static MethodInfo RuntimeOps_Quote =>
|
||||
s_RuntimeOps_Quote ??
|
||||
(s_RuntimeOps_Quote = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.Quote)));
|
||||
|
||||
private static MethodInfo s_DictionaryOfStringInt32_Add_String_Int32;
|
||||
public static MethodInfo DictionaryOfStringInt32_Add_String_Int32 =>
|
||||
s_DictionaryOfStringInt32_Add_String_Int32 ??
|
||||
@@ -154,5 +158,43 @@ namespace System.Linq.Expressions
|
||||
public static MethodInfo Math_Pow_Double_Double =>
|
||||
s_Math_Pow_Double_Double ??
|
||||
(s_Math_Pow_Double_Double = typeof(Math).GetMethod(nameof(Math.Pow), new[] { typeof(double), typeof(double) }));
|
||||
|
||||
// Closure and RuntimeOps helpers are used only in the compiler.
|
||||
#if FEATURE_COMPILE
|
||||
private static ConstructorInfo s_Closure_ObjectArray_ObjectArray;
|
||||
public static ConstructorInfo Closure_ObjectArray_ObjectArray =>
|
||||
s_Closure_ObjectArray_ObjectArray ??
|
||||
(s_Closure_ObjectArray_ObjectArray = typeof(Closure).GetConstructor(new[] { typeof(object[]), typeof(object[]) }));
|
||||
|
||||
private static FieldInfo s_Closure_Constants;
|
||||
public static FieldInfo Closure_Constants =>
|
||||
s_Closure_Constants ??
|
||||
(s_Closure_Constants = typeof(Closure).GetField(nameof(Closure.Constants)));
|
||||
|
||||
private static FieldInfo s_Closure_Locals;
|
||||
public static FieldInfo Closure_Locals =>
|
||||
s_Closure_Locals ??
|
||||
(s_Closure_Locals = typeof(Closure).GetField(nameof(Closure.Locals)));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array;
|
||||
public static MethodInfo RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array =>
|
||||
s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array ??
|
||||
(s_RuntimeOps_CreateRuntimeVariables_ObjectArray_Int64Array = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.CreateRuntimeVariables), new[] { typeof(object[]), typeof(long[]) }));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_CreateRuntimeVariables;
|
||||
public static MethodInfo RuntimeOps_CreateRuntimeVariables =>
|
||||
s_RuntimeOps_CreateRuntimeVariables ??
|
||||
(s_RuntimeOps_CreateRuntimeVariables = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.CreateRuntimeVariables), Type.EmptyTypes));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_MergeRuntimeVariables;
|
||||
public static MethodInfo RuntimeOps_MergeRuntimeVariables =>
|
||||
s_RuntimeOps_MergeRuntimeVariables ??
|
||||
(s_RuntimeOps_MergeRuntimeVariables = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.MergeRuntimeVariables)));
|
||||
|
||||
private static MethodInfo s_RuntimeOps_Quote;
|
||||
public static MethodInfo RuntimeOps_Quote =>
|
||||
s_RuntimeOps_Quote ??
|
||||
(s_RuntimeOps_Quote = typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.Quote)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace System.Linq.Expressions
|
||||
return testType == typeof(void) ? AnalyzeTypeIsResult.KnownTrue : AnalyzeTypeIsResult.KnownFalse;
|
||||
}
|
||||
|
||||
if (testType == typeof(void))
|
||||
if (testType == typeof(void) || testType.IsPointer)
|
||||
{
|
||||
return AnalyzeTypeIsResult.KnownFalse;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace System.Linq.Expressions
|
||||
{
|
||||
// If the operand is a value type (other than nullable), we
|
||||
// know the result is always true.
|
||||
if (operandType.GetTypeInfo().IsValueType && !operandType.IsNullableType())
|
||||
if (operandType.IsValueType && !operandType.IsNullableType())
|
||||
{
|
||||
return AnalyzeTypeIsResult.KnownTrue;
|
||||
}
|
||||
|
||||
@@ -84,9 +84,8 @@ namespace System.Linq.Expressions.Compiler
|
||||
/// </summary>
|
||||
internal void AddReference(object value, Type type)
|
||||
{
|
||||
if (!_indexes.ContainsKey(value))
|
||||
if (_indexes.TryAdd(value, _values.Count))
|
||||
{
|
||||
_indexes.Add(value, _values.Count);
|
||||
_values.Add(value);
|
||||
}
|
||||
Helpers.IncrementCount(new TypedConstant(value, type), _references);
|
||||
@@ -191,9 +190,9 @@ namespace System.Linq.Expressions.Compiler
|
||||
_values.Add(value);
|
||||
}
|
||||
|
||||
lc.IL.EmitInt(index);
|
||||
lc.IL.EmitPrimitive(index);
|
||||
lc.IL.Emit(OpCodes.Ldelem_Ref);
|
||||
if (type.GetTypeInfo().IsValueType)
|
||||
if (type.IsValueType)
|
||||
{
|
||||
lc.IL.Emit(OpCodes.Unbox_Any, type);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
internal void EmitLoadBox()
|
||||
{
|
||||
_array.EmitLoad();
|
||||
Compiler.IL.EmitInt(_index);
|
||||
Compiler.IL.EmitPrimitive(_index);
|
||||
Compiler.IL.Emit(OpCodes.Ldelem_Ref);
|
||||
Compiler.IL.Emit(OpCodes.Castclass, _boxType);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
}
|
||||
|
||||
// create the array
|
||||
lc.IL.EmitInt(_hoistedLocals.Variables.Count);
|
||||
lc.IL.EmitPrimitive(_hoistedLocals.Variables.Count);
|
||||
lc.IL.Emit(OpCodes.Newarr, typeof(object));
|
||||
|
||||
// initialize all elements
|
||||
@@ -321,7 +321,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
{
|
||||
// array[i] = new StrongBox<T>(...);
|
||||
lc.IL.Emit(OpCodes.Dup);
|
||||
lc.IL.EmitInt(i++);
|
||||
lc.IL.EmitPrimitive(i++);
|
||||
Type boxType = typeof(StrongBox<>).MakeGenericType(v.Type);
|
||||
|
||||
int index;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,48 +0,0 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq.Expressions.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple dictionary of queues, keyed off a particular type
|
||||
/// This is useful for storing free lists of variables
|
||||
/// </summary>
|
||||
internal sealed class KeyedQueue<K, V>
|
||||
{
|
||||
private readonly Dictionary<K, Queue<V>> _data;
|
||||
|
||||
internal KeyedQueue()
|
||||
{
|
||||
_data = new Dictionary<K, Queue<V>>();
|
||||
}
|
||||
|
||||
internal void Enqueue(K key, V value)
|
||||
{
|
||||
Queue<V> queue;
|
||||
if (!_data.TryGetValue(key, out queue))
|
||||
{
|
||||
_data.Add(key, queue = new Queue<V>());
|
||||
}
|
||||
queue.Enqueue(value);
|
||||
}
|
||||
|
||||
internal bool TryDequeue(K key, out V value)
|
||||
{
|
||||
Queue<V> queue;
|
||||
if (_data.TryGetValue(key, out queue) && queue.Count > 0)
|
||||
{
|
||||
value = queue.Dequeue();
|
||||
if (queue.Count == 0)
|
||||
{
|
||||
_data.Remove(key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
value = default(V);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/KeyedStack.cs
vendored
Normal file
35
external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/KeyedStack.cs
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq.Expressions.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple dictionary of stacks, keyed off a particular type
|
||||
/// This is useful for storing free lists of variables
|
||||
/// </summary>
|
||||
internal sealed class KeyedStack<TKey, TValue> where TValue : class
|
||||
{
|
||||
private readonly Dictionary<TKey, Stack<TValue>> _data = new Dictionary<TKey, Stack<TValue>>();
|
||||
|
||||
internal void Push(TKey key, TValue value)
|
||||
{
|
||||
Stack<TValue> stack;
|
||||
if (!_data.TryGetValue(key, out stack))
|
||||
{
|
||||
_data.Add(key, stack = new Stack<TValue>());
|
||||
}
|
||||
|
||||
stack.Push(value);
|
||||
}
|
||||
|
||||
internal TValue TryPop(TKey key)
|
||||
{
|
||||
Stack<TValue> stack;
|
||||
TValue value;
|
||||
return _data.TryGetValue(key, out stack) && stack.TryPop(out value) ? value : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
Type indexType = rightType.GetNonNullableType();
|
||||
if (indexType != typeof(int))
|
||||
{
|
||||
_ilg.EmitConvertToType(indexType, typeof(int), isChecked: true);
|
||||
_ilg.EmitConvertToType(indexType, typeof(int), isChecked: true, locals: this);
|
||||
}
|
||||
_ilg.Emit(OpCodes.Ldelema, node.Type);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
private void AddressOf(UnaryExpression node, Type type)
|
||||
{
|
||||
Debug.Assert(node.NodeType == ExpressionType.Unbox);
|
||||
Debug.Assert(type.GetTypeInfo().IsValueType);
|
||||
Debug.Assert(type.IsValueType);
|
||||
|
||||
// Unbox leaves a pointer to the boxed value on the stack
|
||||
EmitExpression(node.Operand);
|
||||
@@ -391,7 +391,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
|
||||
private LocalBuilder GetInstanceLocal(Type type)
|
||||
{
|
||||
Type instanceLocalType = type.GetTypeInfo().IsValueType ? type.MakeByRefType() : type;
|
||||
Type instanceLocalType = type.IsValueType ? type.MakeByRefType() : type;
|
||||
return GetLocal(instanceLocalType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
if (isLiftedToNull)
|
||||
{
|
||||
EmitExpressionAsVoid(e);
|
||||
_ilg.EmitDefault(typeof(bool?));
|
||||
_ilg.EmitDefault(typeof(bool?), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,7 +160,6 @@ namespace System.Linq.Expressions.Compiler
|
||||
else
|
||||
{
|
||||
EmitUnliftedBinaryOp(op, leftType, rightType);
|
||||
EmitConvertArithmeticResult(op, resultType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,10 +175,11 @@ namespace System.Linq.Expressions.Compiler
|
||||
EmitUnliftedEquality(op, leftType);
|
||||
return;
|
||||
}
|
||||
if (!leftType.GetTypeInfo().IsPrimitive)
|
||||
if (!leftType.IsPrimitive)
|
||||
{
|
||||
throw Error.OperatorNotImplementedForType(op, leftType);
|
||||
}
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
@@ -210,6 +210,8 @@ namespace System.Linq.Expressions.Compiler
|
||||
else if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Sub_Ovf_Un);
|
||||
// Guaranteed to fit within result type: no conversion
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -234,94 +236,46 @@ namespace System.Linq.Expressions.Compiler
|
||||
}
|
||||
break;
|
||||
case ExpressionType.Divide:
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Div_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Div);
|
||||
}
|
||||
_ilg.Emit(leftType.IsUnsigned() ? OpCodes.Div_Un : OpCodes.Div);
|
||||
break;
|
||||
case ExpressionType.Modulo:
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Rem_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Rem);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() ? OpCodes.Rem_Un : OpCodes.Rem);
|
||||
// Guaranteed to fit within result type: no conversion
|
||||
return;
|
||||
case ExpressionType.And:
|
||||
case ExpressionType.AndAlso:
|
||||
_ilg.Emit(OpCodes.And);
|
||||
break;
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.Or:
|
||||
case ExpressionType.OrElse:
|
||||
_ilg.Emit(OpCodes.Or);
|
||||
break;
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.LessThan:
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Clt_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Clt);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() ? OpCodes.Clt_Un : OpCodes.Clt);
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
{
|
||||
Label labFalse = _ilg.DefineLabel();
|
||||
Label labEnd = _ilg.DefineLabel();
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Ble_Un_S, labFalse);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Ble_S, labFalse);
|
||||
}
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Br_S, labEnd);
|
||||
_ilg.MarkLabel(labFalse);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_1);
|
||||
_ilg.MarkLabel(labEnd);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() || leftType.IsFloatingPoint() ? OpCodes.Cgt_Un : OpCodes.Cgt);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.GreaterThan:
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Cgt_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Cgt);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() ? OpCodes.Cgt_Un : OpCodes.Cgt);
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
{
|
||||
Label labFalse = _ilg.DefineLabel();
|
||||
Label labEnd = _ilg.DefineLabel();
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Bge_Un_S, labFalse);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Bge_S, labFalse);
|
||||
}
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Br_S, labEnd);
|
||||
_ilg.MarkLabel(labFalse);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_1);
|
||||
_ilg.MarkLabel(labEnd);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() || leftType.IsFloatingPoint() ? OpCodes.Clt_Un : OpCodes.Clt);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.ExclusiveOr:
|
||||
_ilg.Emit(OpCodes.Xor);
|
||||
break;
|
||||
// Not an arithmetic operation: no conversion
|
||||
return;
|
||||
case ExpressionType.LeftShift:
|
||||
if (rightType != typeof(int))
|
||||
{
|
||||
@@ -336,18 +290,14 @@ namespace System.Linq.Expressions.Compiler
|
||||
throw ContractUtils.Unreachable;
|
||||
}
|
||||
EmitShiftMask(leftType);
|
||||
if (leftType.IsUnsigned())
|
||||
{
|
||||
_ilg.Emit(OpCodes.Shr_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Emit(OpCodes.Shr);
|
||||
}
|
||||
break;
|
||||
_ilg.Emit(leftType.IsUnsigned() ? OpCodes.Shr_Un : OpCodes.Shr);
|
||||
// Guaranteed to fit within result type: no conversion
|
||||
return;
|
||||
default:
|
||||
throw Error.UnhandledBinary(op, nameof(op));
|
||||
}
|
||||
|
||||
EmitConvertArithmeticResult(op, leftType);
|
||||
}
|
||||
|
||||
// Shift operations have undefined behavior if the shift amount exceeds
|
||||
@@ -356,7 +306,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
private void EmitShiftMask(Type leftType)
|
||||
{
|
||||
int mask = leftType.IsInteger64() ? 0x3F : 0x1F;
|
||||
_ilg.EmitInt(mask);
|
||||
_ilg.EmitPrimitive(mask);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
}
|
||||
|
||||
@@ -388,7 +338,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
private void EmitUnliftedEquality(ExpressionType op, Type type)
|
||||
{
|
||||
Debug.Assert(op == ExpressionType.Equal || op == ExpressionType.NotEqual);
|
||||
if (!type.GetTypeInfo().IsPrimitive && type.GetTypeInfo().IsValueType && !type.GetTypeInfo().IsEnum)
|
||||
if (!type.IsPrimitive && type.IsValueType && !type.IsEnum)
|
||||
{
|
||||
throw Error.OperatorNotImplementedForType(op, type);
|
||||
}
|
||||
@@ -446,7 +396,17 @@ namespace System.Linq.Expressions.Compiler
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
case ExpressionType.Equal:
|
||||
case ExpressionType.NotEqual:
|
||||
EmitLiftedRelational(op, leftType, rightType, resultType, liftedToNull);
|
||||
Debug.Assert(leftType == rightType);
|
||||
if (liftedToNull)
|
||||
{
|
||||
Debug.Assert(resultType == typeof(bool?));
|
||||
EmitLiftedToNullRelational(op, leftType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(resultType == typeof(bool));
|
||||
EmitLiftedRelational(op, leftType);
|
||||
}
|
||||
break;
|
||||
case ExpressionType.AndAlso:
|
||||
case ExpressionType.OrElse:
|
||||
@@ -455,123 +415,74 @@ namespace System.Linq.Expressions.Compiler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void EmitLiftedRelational(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull)
|
||||
private void EmitLiftedRelational(ExpressionType op, Type type)
|
||||
{
|
||||
Debug.Assert(leftType.IsNullableType());
|
||||
// Equal is (left.GetValueOrDefault() == right.GetValueOrDefault()) & (left.HasValue == right.HasValue)
|
||||
// NotEqual is !((left.GetValueOrDefault() == right.GetValueOrDefault()) & (left.HasValue == right.HasValue))
|
||||
// Others are (left.GetValueOrDefault() op right.GetValueOrDefault()) & (left.HasValue & right.HasValue)
|
||||
|
||||
Label shortCircuit = _ilg.DefineLabel();
|
||||
LocalBuilder locLeft = GetLocal(leftType);
|
||||
LocalBuilder locRight = GetLocal(rightType);
|
||||
bool invert = op == ExpressionType.NotEqual;
|
||||
if (invert)
|
||||
{
|
||||
op = ExpressionType.Equal;
|
||||
}
|
||||
|
||||
LocalBuilder locLeft = GetLocal(type);
|
||||
LocalBuilder locRight = GetLocal(type);
|
||||
|
||||
// store values (reverse order since they are already on the stack)
|
||||
_ilg.Emit(OpCodes.Stloc, locRight);
|
||||
_ilg.Emit(OpCodes.Stloc, locLeft);
|
||||
|
||||
if (op == ExpressionType.Equal)
|
||||
{
|
||||
// test for both null -> true
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
_ilg.Emit(OpCodes.Dup);
|
||||
_ilg.Emit(OpCodes.Brtrue_S, shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
|
||||
// test for either is null -> false
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
|
||||
_ilg.Emit(OpCodes.Dup);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
}
|
||||
else if (op == ExpressionType.NotEqual)
|
||||
{
|
||||
// test for both null -> false
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.Or);
|
||||
_ilg.Emit(OpCodes.Dup);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
|
||||
// test for either is null -> true
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Or);
|
||||
_ilg.Emit(OpCodes.Dup);
|
||||
_ilg.Emit(OpCodes.Brtrue_S, shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
}
|
||||
else
|
||||
{
|
||||
// test for either is null -> false
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
_ilg.Emit(OpCodes.Dup);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
}
|
||||
|
||||
// do op on values
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitGetValueOrDefault(leftType);
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitGetValueOrDefault(rightType);
|
||||
|
||||
//RELEASING locLeft locRight
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
Type unnullable = type.GetNonNullableType();
|
||||
EmitUnliftedBinaryOp(op, unnullable, unnullable);
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(type);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(type);
|
||||
FreeLocal(locLeft);
|
||||
FreeLocal(locRight);
|
||||
|
||||
EmitBinaryOperator(
|
||||
op,
|
||||
leftType.GetNonNullableType(),
|
||||
rightType.GetNonNullableType(),
|
||||
resultType.GetNonNullableType(),
|
||||
liftedToNull: false
|
||||
);
|
||||
|
||||
if (!liftedToNull)
|
||||
_ilg.Emit(op == ExpressionType.Equal ? OpCodes.Ceq : OpCodes.And);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
if (invert)
|
||||
{
|
||||
_ilg.MarkLabel(shortCircuit);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
}
|
||||
}
|
||||
|
||||
if (!TypeUtils.AreEquivalent(resultType, resultType.GetNonNullableType()))
|
||||
{
|
||||
_ilg.EmitConvertToType(resultType.GetNonNullableType(), resultType, isChecked: true);
|
||||
}
|
||||
private void EmitLiftedToNullRelational(ExpressionType op, Type type)
|
||||
{
|
||||
// (left.HasValue & right.HasValue) ? left.GetValueOrDefault() op right.GetValueOrDefault() : default(bool?)
|
||||
Label notNull = _ilg.DefineLabel();
|
||||
Label end = _ilg.DefineLabel();
|
||||
|
||||
if (liftedToNull)
|
||||
{
|
||||
Label labEnd = _ilg.DefineLabel();
|
||||
_ilg.Emit(OpCodes.Br, labEnd);
|
||||
_ilg.MarkLabel(shortCircuit);
|
||||
_ilg.Emit(OpCodes.Pop);
|
||||
_ilg.Emit(OpCodes.Ldnull);
|
||||
_ilg.Emit(OpCodes.Unbox_Any, resultType);
|
||||
_ilg.MarkLabel(labEnd);
|
||||
}
|
||||
LocalBuilder locLeft = GetLocal(type);
|
||||
LocalBuilder locRight = GetLocal(type);
|
||||
|
||||
_ilg.Emit(OpCodes.Stloc, locRight);
|
||||
_ilg.Emit(OpCodes.Stloc, locLeft);
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(type);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(type);
|
||||
_ilg.Emit(OpCodes.And);
|
||||
_ilg.Emit(OpCodes.Brtrue_S, notNull);
|
||||
_ilg.EmitDefault(typeof(bool?), this);
|
||||
_ilg.Emit(OpCodes.Br_S, end);
|
||||
_ilg.MarkLabel(notNull);
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
FreeLocal(locLeft);
|
||||
FreeLocal(locRight);
|
||||
Type unnullable = type.GetNonNullableType();
|
||||
EmitUnliftedBinaryOp(op, unnullable, unnullable);
|
||||
_ilg.Emit(OpCodes.Newobj, Nullable_Boolean_Ctor);
|
||||
_ilg.MarkLabel(end);
|
||||
}
|
||||
|
||||
|
||||
@@ -593,20 +504,25 @@ namespace System.Linq.Expressions.Compiler
|
||||
_ilg.Emit(OpCodes.Stloc, locLeft);
|
||||
|
||||
// test for null
|
||||
// use short circuiting
|
||||
// don't use short circuiting
|
||||
if (leftIsNullable)
|
||||
{
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitHasValue(leftType);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, labIfNull);
|
||||
}
|
||||
|
||||
if (rightIsNullable)
|
||||
{
|
||||
_ilg.Emit(OpCodes.Ldloca, locRight);
|
||||
_ilg.EmitHasValue(rightType);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, labIfNull);
|
||||
if (leftIsNullable)
|
||||
{
|
||||
_ilg.Emit(OpCodes.And);
|
||||
}
|
||||
}
|
||||
|
||||
_ilg.Emit(OpCodes.Brfalse_S, labIfNull);
|
||||
|
||||
// do op on values
|
||||
if (leftIsNullable)
|
||||
{
|
||||
@@ -675,9 +591,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
_ilg.Emit(OpCodes.Brfalse, labComputeRight);
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Brtrue, labReturnFalse);
|
||||
_ilg.Emit(OpCodes.Brfalse, labReturnFalse);
|
||||
|
||||
// compute right
|
||||
_ilg.MarkLabel(labComputeRight);
|
||||
@@ -690,9 +604,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
FreeLocal(locRight);
|
||||
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Brtrue_S, labReturnFalse);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, labReturnFalse);
|
||||
|
||||
// check left for null again
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
@@ -748,9 +660,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
_ilg.Emit(OpCodes.Brfalse, labComputeRight);
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Brfalse, labReturnTrue);
|
||||
_ilg.Emit(OpCodes.Brtrue, labReturnTrue);
|
||||
|
||||
// compute right
|
||||
_ilg.MarkLabel(labComputeRight);
|
||||
@@ -763,9 +673,7 @@ namespace System.Linq.Expressions.Compiler
|
||||
FreeLocal(locRight);
|
||||
|
||||
_ilg.EmitGetValueOrDefault(type);
|
||||
_ilg.Emit(OpCodes.Ldc_I4_0);
|
||||
_ilg.Emit(OpCodes.Ceq);
|
||||
_ilg.Emit(OpCodes.Brfalse_S, labReturnTrue);
|
||||
_ilg.Emit(OpCodes.Brtrue_S, labReturnTrue);
|
||||
|
||||
// check left for null again
|
||||
_ilg.Emit(OpCodes.Ldloca, locLeft);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user