提交 7527e962 编写于 作者: T Tomas Matousek

Revert "Address new warnings"

This reverts commit a03d8b8e.
上级 7963abe6
......@@ -30,7 +30,7 @@ internal LoweredDynamicOperationFactory(SyntheticBoundNodeFactory factory, int m
// that redefines these constants and is not supposed to run existing programs.
/// <summary>
/// Corresponds to Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.
/// Corresponds to <see cref="Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags"/>.
/// </summary>
[Flags]
private enum CSharpBinderFlags
......@@ -48,7 +48,7 @@ private enum CSharpBinderFlags
}
/// <summary>
/// Corresponds to Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.
/// Corresponds to <see cref="Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags"/>.
/// </summary>
[Flags]
private enum CSharpArgumentInfoFlags
......
......@@ -478,8 +478,8 @@ internal void DecodeClassInterfaceAttribute(AttributeSyntax nodeOpt, DiagnosticB
switch (interfaceType)
{
case ClassInterfaceType.None:
case Cci.Constants.ClassInterfaceType_AutoDispatch:
case Cci.Constants.ClassInterfaceType_AutoDual:
case ClassInterfaceType.AutoDispatch:
case ClassInterfaceType.AutoDual:
break;
default:
......@@ -503,8 +503,8 @@ internal void DecodeInterfaceTypeAttribute(AttributeSyntax node, DiagnosticBag d
switch (interfaceType)
{
case Cci.Constants.ComInterfaceType_InterfaceIsDual:
case Cci.Constants.ComInterfaceType_InterfaceIsIDispatch:
case ComInterfaceType.InterfaceIsDual:
case ComInterfaceType.InterfaceIsIDispatch:
case ComInterfaceType.InterfaceIsIInspectable:
case ComInterfaceType.InterfaceIsIUnknown:
break;
......
......@@ -9,7 +9,7 @@
namespace Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE
{
/// <summary>
/// Decodes System.Runtime.CompilerServices.DynamicAttribute applied to a specified metadata symbol and
/// Decodes <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> applied to a specified metadata symbol and
/// transforms the specified metadata type, using the decoded dynamic transforms attribute argument,
/// by replacing each occurrence of <see cref="System.Object"/> type with dynamic type.
/// </summary>
......@@ -48,10 +48,10 @@ private DynamicTypeDecoder(ImmutableArray<bool> dynamicTransformFlags, bool have
}
/// <summary>
/// Decodes the attributes applied to the given <see paramref="targetSymbol"/> from metadata and checks if System.Runtime.CompilerServices.DynamicAttribute is applied.
/// Decodes the attributes applied to the given <see paramref="targetSymbol"/> from metadata and checks if <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> is applied.
/// If so, it transforms the given <see paramref="metadataType"/>, using the decoded dynamic transforms attribute argument,
/// by replacing each occurrence of <see cref="System.Object"/> type with dynamic type.
/// If no System.Runtime.CompilerServices.DynamicAttribute is applied or the decoded dynamic transforms attribute argument is erroneous,
/// If no <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> is applied or the decoded dynamic transforms attribute argument is erroneous,
/// returns the unchanged <see paramref="metadataType"/>.
/// </summary>
/// <remarks>This method is a port of TypeManager::ImportDynamicTransformType from the native compiler.</remarks>
......
......@@ -91,7 +91,7 @@ internal bool IsMarshalAsObject
{
case UnmanagedType.Interface:
case UnmanagedType.IUnknown:
case Cci.Constants.UnmanagedType_IDispatch:
case UnmanagedType.IDispatch:
return true;
}
......
......@@ -14,8 +14,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFrameworkProfile></TargetFrameworkProfile>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<RestorePackages>true</RestorePackages>
<DefineConstants>$(DefineConstants);COMPILERCORE</DefineConstants>
......@@ -367,6 +366,7 @@
<Compile Include="InternalUtilities\ReadOnlyUnmanagedMemoryStream.cs" />
<Compile Include="InternalUtilities\ReferenceEqualityComparer.cs" />
<Compile Include="InternalUtilities\SpecializedCollections.cs" />
<Compile Include="InternalUtilities\SpecializedCollections.Empty.Array.cs" />
<Compile Include="InternalUtilities\SpecializedCollections.Empty.Collection.cs" />
<Compile Include="InternalUtilities\SpecializedCollections.Empty.cs" />
<Compile Include="InternalUtilities\SpecializedCollections.Empty.Dictionary.cs" />
......@@ -797,4 +797,4 @@
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -70,7 +70,7 @@ public void TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCo
s_transformFinalBlock.Invoke(_hashInstance, new object[] { inputBuffer, inputOffset, inputCount });
}
public byte[] Hash => (byte[])s_hash.GetMethod.Invoke(_hashInstance, Array.Empty<object>());
public byte[] Hash => (byte[])s_hash.GetMethod.Invoke(_hashInstance, new object[] { });
public void Dispose()
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Roslyn.Utilities
{
internal partial class SpecializedCollections
{
private partial class Empty
{
internal class Array<T>
{
public static readonly T[] Instance = new T[0];
}
}
}
}
......@@ -11,7 +11,7 @@ internal static partial class SpecializedCollections
public static T[] EmptyArray<T>()
{
return System.Array.Empty<T>();
return Empty.Array<T>.Instance;
}
public static IEnumerator<T> EmptyEnumerator<T>()
......
......@@ -142,24 +142,17 @@ internal interface IVsSqm2
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IVsSqmMulti
{
#pragma warning disable CS0618 // API is obsolete (https://github.com/dotnet/roslyn/issues/10637)
[return: MarshalAs(UnmanagedType.VariantBool)]
#pragma warning restore CS0618
bool GetOptInStatus();
void UnloadSessions(
);
void EndAllSessionsAndAbortUploads(
);
#pragma warning disable CS0618 // API is obsolete (https://github.com/dotnet/roslyn/issues/10637)
void BeginSession(
[In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionType,
[In, MarshalAs(UnmanagedType.VariantBool)] System.Boolean alwaysSend,
[Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 sessionHandle
);
#pragma warning restore CS0618
void EndSession(
[In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle
);
......
......@@ -1192,8 +1192,8 @@ private static bool IsValidComInterfaceType(int comInterfaceType)
{
switch (comInterfaceType)
{
case (int)Cci.Constants.ComInterfaceType_InterfaceIsDual:
case (int)Cci.Constants.ComInterfaceType_InterfaceIsIDispatch:
case (int)ComInterfaceType.InterfaceIsDual:
case (int)ComInterfaceType.InterfaceIsIDispatch:
case (int)ComInterfaceType.InterfaceIsIInspectable:
case (int)ComInterfaceType.InterfaceIsIUnknown:
return true;
......
......@@ -1262,9 +1262,7 @@ private void DefineLocalConstant(string name, object value, PrimitiveTypeCode ty
private unsafe void DefineLocalConstantImpl(string name, object value, uint sigToken)
{
VariantStructure variant = new VariantStructure();
#pragma warning disable CS0618 // API is obsolete (https://github.com/dotnet/roslyn/issues/10637)
Marshal.GetNativeVariantForObject(value, new IntPtr(&variant));
#pragma warning restore CS0618
_symWriter.DefineConstant2(name, variant, sigToken);
}
......
......@@ -16,17 +16,6 @@ internal static class Constants
// Non-portable UnmanagedType values:
public const UnmanagedType UnmanagedType_CustomMarshaler = (UnmanagedType)44;
public const UnmanagedType UnmanagedType_IDispatch = (UnmanagedType)26;
public const UnmanagedType UnmanagedType_SafeArray = (UnmanagedType)29;
public const UnmanagedType UnmanagedType_VBByRefStr = (UnmanagedType)34;
public const UnmanagedType UnmanagedType_AnsiBStr = (UnmanagedType)35;
public const UnmanagedType UnmanagedType_TBStr = (UnmanagedType)36;
public const ComInterfaceType ComInterfaceType_InterfaceIsDual = 0;
public const ComInterfaceType ComInterfaceType_InterfaceIsIDispatch = (ComInterfaceType)2;
public const ClassInterfaceType ClassInterfaceType_AutoDispatch = (ClassInterfaceType)1;
public const ClassInterfaceType ClassInterfaceType_AutoDual = (ClassInterfaceType)2;
// Non-portable CompilationRelaxations value:
public const int CompilationRelaxations_NoStringInterning = 0x0008;
......@@ -118,55 +107,4 @@ internal enum TypeFlags : uint
RTSpecialNameReserved = 0x00000800,
HasSecurityReserved = 0x00040000,
}
/// <summary>
/// System.Runtime.InteropServices.VarEnum is obsolete.
/// </summary>
internal enum VarEnum
{
VT_EMPTY = 0,
VT_NULL = 1,
VT_I2 = 2,
VT_I4 = 3,
VT_R4 = 4,
VT_R8 = 5,
VT_CY = 6,
VT_DATE = 7,
VT_BSTR = 8,
VT_DISPATCH = 9,
VT_ERROR = 10,
VT_BOOL = 11,
VT_VARIANT = 12,
VT_UNKNOWN = 13,
VT_DECIMAL = 14,
VT_I1 = 16,
VT_UI1 = 17,
VT_UI2 = 18,
VT_UI4 = 19,
VT_I8 = 20,
VT_UI8 = 21,
VT_INT = 22,
VT_UINT = 23,
VT_VOID = 24,
VT_HRESULT = 25,
VT_PTR = 26,
VT_SAFEARRAY = 27,
VT_CARRAY = 28,
VT_USERDEFINED = 29,
VT_LPSTR = 30,
VT_LPWSTR = 31,
VT_RECORD = 36,
VT_FILETIME = 64,
VT_BLOB = 65,
VT_STREAM = 66,
VT_STORAGE = 67,
VT_STREAMED_OBJECT = 68,
VT_STORED_OBJECT = 69,
VT_BLOB_OBJECT = 70,
VT_CF = 71,
VT_CLSID = 72,
VT_VECTOR = 0x1000,
VT_ARRAY = 0x2000,
VT_BYREF = 0x4000
}
}
......@@ -4924,7 +4924,7 @@ private void SerializeMarshallingDescriptor(IMarshallingInformation marshallingI
break;
case Constants.UnmanagedType_SafeArray:
case UnmanagedType.SafeArray:
if (marshallingInformation.SafeArrayElementSubtype >= 0)
{
writer.WriteCompressedInteger((uint)marshallingInformation.SafeArrayElementSubtype);
......@@ -4942,7 +4942,7 @@ private void SerializeMarshallingDescriptor(IMarshallingInformation marshallingI
break;
case UnmanagedType.Interface:
case Constants.UnmanagedType_IDispatch:
case UnmanagedType.IDispatch:
case UnmanagedType.IUnknown:
if (marshallingInformation.IidParameterIndex >= 0)
{
......
......@@ -3,8 +3,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using Roslyn.Utilities;
using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext;
namespace Microsoft.Cci
......@@ -163,7 +166,7 @@ short ParamIndex
/// (The element type of a safe array is VARIANT. The "sub type" specifies the value of all of the tag fields (vt) of the element values. )
/// -1 if it should be omitted from the marshal blob.
/// </summary>
VarEnum SafeArrayElementSubtype
System.Runtime.InteropServices.VarEnum SafeArrayElementSubtype
{
get;
}
......
......@@ -142,7 +142,7 @@ internal static class Path
internal static readonly Func<string> GetTempFileName = (Func<string>)Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(GetTempFileName), paramTypes: Array.Empty<Type>())
.GetDeclaredMethod(nameof(GetTempFileName), paramTypes: new Type[] { })
.CreateDelegate(typeof(Func<string>));
}
......@@ -441,7 +441,7 @@ internal static class Process
internal static readonly Func<object> GetCurrentProcess = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(GetCurrentProcess), paramTypes: Array.Empty<Type>())
.GetDeclaredMethod(nameof(GetCurrentProcess), paramTypes: new Type[] { })
.CreateDelegate<Func<object>>();
}
......@@ -455,7 +455,7 @@ internal static class RuntimeHelpers
internal static readonly Action EnsureSufficientExecutionStack = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(EnsureSufficientExecutionStack), paramTypes: Array.Empty<Type>())
.GetDeclaredMethod(nameof(EnsureSufficientExecutionStack), paramTypes: new Type[] { })
.CreateDelegate<Action>();
}
......@@ -469,11 +469,11 @@ internal static class StackTrace
private static readonly ConstructorInfo s_Ctor = Type
.GetTypeInfo()
.GetDeclaredConstructor(Array.Empty<Type>());
.GetDeclaredConstructor(new Type[] { });
private static readonly MethodInfo s_ToString = Type
.GetTypeInfo()
.GetDeclaredMethod("ToString", Array.Empty<Type>());
.GetDeclaredMethod("ToString", new Type[] { });
internal static string GetString()
{
......@@ -603,7 +603,7 @@ internal static class SHA1
internal static readonly Func<IDisposable> Create = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(Create), Array.Empty<Type>())
.GetDeclaredMethod(nameof(Create), new Type[] { })
.CreateDelegate<Func<IDisposable>>();
}
......@@ -617,7 +617,7 @@ internal static class SHA256
internal static readonly Func<IDisposable> Create = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(Create), Array.Empty<Type>())
.GetDeclaredMethod(nameof(Create), new Type[] { })
.CreateDelegate<Func<IDisposable>>();
}
......@@ -631,7 +631,7 @@ internal static class SHA384
internal static readonly Func<IDisposable> Create = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(Create), Array.Empty<Type>())
.GetDeclaredMethod(nameof(Create), new Type[] { })
.CreateDelegate<Func<IDisposable>>();
}
......@@ -645,7 +645,7 @@ internal static class SHA512
internal static readonly Func<IDisposable> Create = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(Create), Array.Empty<Type>())
.GetDeclaredMethod(nameof(Create), new Type[] { })
.CreateDelegate<Func<IDisposable>>();
}
......@@ -659,7 +659,7 @@ internal static class MD5
internal static readonly Func<IDisposable> Create = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(Create), Array.Empty<Type>())
.GetDeclaredMethod(nameof(Create), new Type[] { })
.CreateDelegate<Func<IDisposable>>();
}
}
......
......@@ -67,9 +67,7 @@ private static QueryServiceDelegate TryGetSqmServiceDelegateCore(string baseDire
if (vssqmdll != IntPtr.Zero)
{
IntPtr queryServicePtr = SqmServiceProvider.GetProcAddress(vssqmdll, "QueryService");
#pragma warning disable CS0618 // API is obsolete (https://github.com/dotnet/roslyn/issues/10637)
return (QueryServiceDelegate)Marshal.GetDelegateForFunctionPointer(queryServicePtr, typeof(QueryServiceDelegate));
#pragma warning restore CS0618
}
}
catch (Exception e)
......
......@@ -213,10 +213,8 @@ private static ImmutableArray<byte> CreateSnPublicKeyBlob(BlobHeader header, Rsa
private unsafe static bool TryGetPublicKeyFromPublicKeyBlob(byte* blob, int blobLen, out ImmutableArray<byte> publicKey)
{
#pragma warning disable CS0618 // API is obsolete (https://github.com/dotnet/roslyn/issues/10637)
var header = (BlobHeader)Marshal.PtrToStructure((IntPtr)blob, typeof(BlobHeader));
var rsaPubKey = (RsaPubKey)Marshal.PtrToStructure((IntPtr)(blob + sizeof(BlobHeader)), typeof(RsaPubKey));
#pragma warning restore CS0618
var modulus = new byte[rsaPubKey.BitLen >> 3];
// The key blob data just contains the modulus
......
......@@ -25,7 +25,7 @@ internal static void Decode(ref DecodeWellKnownAttributeArguments<TAttributeSynt
break;
case UnmanagedType.Interface:
case Cci.Constants.UnmanagedType_IDispatch:
case UnmanagedType.IDispatch:
case UnmanagedType.IUnknown:
DecodeMarshalAsComInterface(ref arguments, unmanagedType, messageProvider);
break;
......@@ -46,7 +46,7 @@ internal static void Decode(ref DecodeWellKnownAttributeArguments<TAttributeSynt
break;
case Cci.Constants.UnmanagedType_SafeArray:
case UnmanagedType.SafeArray:
DecodeMarshalAsSafeArray(ref arguments, messageProvider);
break;
......@@ -62,7 +62,7 @@ internal static void Decode(ref DecodeWellKnownAttributeArguments<TAttributeSynt
break;
case Cci.Constants.UnmanagedType_VBByRefStr:
case UnmanagedType.VBByRefStr:
if (target == AttributeTargets.Field)
{
messageProvider.ReportMarshalUnmanagedTypeNotValidForFields(arguments.Diagnostics, arguments.AttributeSyntaxOpt, 0, "VBByRefStr", arguments.Attribute);
......@@ -281,7 +281,7 @@ private static void DecodeMarshalAsSafeArray(ref DecodeWellKnownAttributeArgumen
{
Debug.Assert((object)arguments.AttributeSyntaxOpt != null);
Cci.VarEnum? elementTypeVariant = null;
VarEnum? elementTypeVariant = null;
ITypeSymbol elementTypeSymbol = null;
int symbolIndex = -1;
bool hasErrors = false;
......@@ -292,7 +292,7 @@ private static void DecodeMarshalAsSafeArray(ref DecodeWellKnownAttributeArgumen
switch (namedArg.Key)
{
case "SafeArraySubType":
elementTypeVariant = namedArg.Value.DecodeValue<Cci.VarEnum>(SpecialType.System_Enum);
elementTypeVariant = namedArg.Value.DecodeValue<VarEnum>(SpecialType.System_Enum);
if (elementTypeVariant < 0 || (int)elementTypeVariant > MarshalPseudoCustomAttributeData.MaxMarshalInteger)
{
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key);
......@@ -320,9 +320,9 @@ private static void DecodeMarshalAsSafeArray(ref DecodeWellKnownAttributeArgumen
switch (elementTypeVariant)
{
case Cci.VarEnum.VT_DISPATCH:
case Cci.VarEnum.VT_UNKNOWN:
case Cci.VarEnum.VT_RECORD:
case VarEnum.VT_DISPATCH:
case VarEnum.VT_UNKNOWN:
case VarEnum.VT_RECORD:
// only these variants accept specification of user defined subtype
break;
......
......@@ -21,7 +21,7 @@ internal sealed class MarshalPseudoCustomAttributeData : Cci.IMarshallingInforma
internal const int Invalid = -1;
private const UnmanagedType InvalidUnmanagedType = (UnmanagedType)Invalid;
private const Cci.VarEnum InvalidVariantType = (Cci.VarEnum)Invalid;
private const VarEnum InvalidVariantType = (VarEnum)Invalid;
internal const int MaxMarshalInteger = 0x1fffffff;
#region Initialization
......@@ -66,11 +66,11 @@ internal void SetMarshalAsFixedArray(UnmanagedType? elementType, int? elementCou
_marshalArrayElementCount = elementCount ?? Invalid;
}
internal void SetMarshalAsSafeArray(Cci.VarEnum? elementType, ITypeSymbol elementTypeSymbol)
internal void SetMarshalAsSafeArray(VarEnum? elementType, ITypeSymbol elementTypeSymbol)
{
Debug.Assert(elementType == null || elementType >= 0 && (int)elementType <= MaxMarshalInteger);
_marshalType = Cci.Constants.UnmanagedType_SafeArray;
_marshalType = UnmanagedType.SafeArray;
_marshalArrayElementType = (int)(elementType ?? InvalidVariantType);
_marshalTypeNameOrSymbol = elementTypeSymbol;
}
......@@ -103,7 +103,7 @@ int Cci.IMarshallingInformation.IidParameterIndex
Debug.Assert(
_marshalType == UnmanagedType.Interface ||
_marshalType == UnmanagedType.IUnknown ||
_marshalType == Cci.Constants.UnmanagedType_IDispatch);
_marshalType == UnmanagedType.IDispatch);
return _marshalParameterIndex;
}
......@@ -137,7 +137,7 @@ int Cci.IMarshallingInformation.NumberOfElements
{
get
{
Debug.Assert(_marshalType == UnmanagedType.ByValTStr || _marshalType == UnmanagedType.LPArray || _marshalType == Cci.Constants.UnmanagedType_SafeArray || _marshalType == UnmanagedType.ByValArray);
Debug.Assert(_marshalType == UnmanagedType.ByValTStr || _marshalType == UnmanagedType.LPArray || _marshalType == UnmanagedType.SafeArray || _marshalType == UnmanagedType.ByValArray);
return _marshalArrayElementCount;
}
}
......@@ -160,18 +160,18 @@ UnmanagedType Cci.IMarshallingInformation.ElementType
}
}
Cci.VarEnum Cci.IMarshallingInformation.SafeArrayElementSubtype
VarEnum Cci.IMarshallingInformation.SafeArrayElementSubtype
{
get
{
Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray);
return (Cci.VarEnum)_marshalArrayElementType;
Debug.Assert(_marshalType == UnmanagedType.SafeArray);
return (VarEnum)_marshalArrayElementType;
}
}
Cci.ITypeReference Cci.IMarshallingInformation.GetSafeArrayElementUserDefinedSubtype(EmitContext context)
{
Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray);
Debug.Assert(_marshalType == UnmanagedType.SafeArray);
if (_marshalTypeNameOrSymbol == null)
{
......@@ -189,7 +189,7 @@ Cci.ITypeReference Cci.IMarshallingInformation.GetSafeArrayElementUserDefinedSub
Func<TTypeSymbol, TArg, TTypeSymbol> translator, TArg arg)
where TTypeSymbol : ITypeSymbol
{
if (_marshalType != Cci.Constants.UnmanagedType_SafeArray || _marshalTypeNameOrSymbol == null)
if (_marshalType != UnmanagedType.SafeArray || _marshalTypeNameOrSymbol == null)
{
return this;
}
......@@ -201,7 +201,7 @@ Cci.ITypeReference Cci.IMarshallingInformation.GetSafeArrayElementUserDefinedSub
}
var result = new MarshalPseudoCustomAttributeData();
result.SetMarshalAsSafeArray((Cci.VarEnum)_marshalArrayElementType, translatedType);
result.SetMarshalAsSafeArray((VarEnum)_marshalArrayElementType, translatedType);
return result;
}
......
......@@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return parsedImportList.ToArray()
Else
Return Array.Empty(Of GlobalImport)
Return New GlobalImport() {}
End If
End Function
......
......@@ -423,7 +423,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
CType(ctorArgument.DecodeValue(Of Short)(SpecialType.System_Int16), ClassInterfaceType))
Select Case interfaceType
Case ClassInterfaceType.None, Cci.Constants.ClassInterfaceType_AutoDispatch, Cci.Constants.ClassInterfaceType_AutoDual
Case ClassInterfaceType.None, ClassInterfaceType.AutoDispatch, ClassInterfaceType.AutoDual
Exit Select
Case Else
diagnostics.Add(ERRID.ERR_BadAttribute1, If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton), Me.AttributeClass)
......@@ -448,7 +448,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
CType(ctorArgument.DecodeValue(Of Short)(SpecialType.System_Int16), ComInterfaceType))
Select Case interfaceType
Case Cci.Constants.ComInterfaceType_InterfaceIsDual, Cci.Constants.ComInterfaceType_InterfaceIsIDispatch, ComInterfaceType.InterfaceIsIInspectable, ComInterfaceType.InterfaceIsIUnknown
Case ComInterfaceType.InterfaceIsDual, ComInterfaceType.InterfaceIsIDispatch, ComInterfaceType.InterfaceIsIInspectable, ComInterfaceType.InterfaceIsIUnknown
Return True
Case Else
Return False
......
......@@ -1421,7 +1421,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
' Is interface marked with 'InterfaceTypeAttribute( flags with ComInterfaceType.InterfaceIsIDispatch )' attribute
Dim interfaceType As ComInterfaceType = Nothing
If metadataModule.HasInterfaceTypeAttribute(Me._handle, interfaceType) AndAlso
(interfaceType And Cci.Constants.ComInterfaceType_InterfaceIsIDispatch) <> 0 Then
(interfaceType And ComInterfaceType.InterfaceIsIDispatch) <> 0 Then
Return True
End If
......
......@@ -90,7 +90,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend ReadOnly Property IsMarshalAsObject As Boolean
Get
Select Case Me.MarshallingType
Case UnmanagedType.Interface, UnmanagedType.IUnknown, Cci.Constants.UnmanagedType_IDispatch
Case UnmanagedType.Interface, UnmanagedType.IUnknown, UnmanagedType.IDispatch
Return True
End Select
......
......@@ -2029,7 +2029,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
If Not attrdata.HasErrors Then
Dim interfaceType As ComInterfaceType = Nothing
If attrdata.DecodeInterfaceTypeAttribute(interfaceType) AndAlso
(interfaceType And Cci.Constants.ComInterfaceType_InterfaceIsIDispatch) <> 0 Then
(interfaceType And ComInterfaceType.InterfaceIsIDispatch) <> 0 Then
arguments.GetOrCreateData(Of TypeEarlyWellKnownAttributeData).HasAttributeForExtensibleInterface = True
End If
......
......@@ -988,7 +988,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
ImmutableArray.Create(
New TypedConstant(_comClass.GetSpecialType(SpecialType.System_Int16),
TypedConstantKind.Primitive,
CShort(Cci.Constants.ComInterfaceType_InterfaceIsIDispatch)))))
CShort(ComInterfaceType.InterfaceIsIDispatch)))))
End If
AddSynthesizedAttribute(attributes, compilation.TrySynthesizeAttribute(
......
......@@ -400,10 +400,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Select Case pinvoke.CharacterSet
Case Cci.Constants.CharSet_None, CharSet.Ansi
info.SetMarshalAsSimpleType(Cci.Constants.UnmanagedType_AnsiBStr)
info.SetMarshalAsSimpleType(UnmanagedType.AnsiBStr)
Case Cci.Constants.CharSet_Auto
info.SetMarshalAsSimpleType(Cci.Constants.UnmanagedType_TBStr)
info.SetMarshalAsSimpleType(UnmanagedType.TBStr)
Case CharSet.Unicode
info.SetMarshalAsSimpleType(UnmanagedType.BStr)
......@@ -412,7 +412,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Throw ExceptionUtilities.UnexpectedValue(pinvoke.CharacterSet)
End Select
Else
info.SetMarshalAsSimpleType(Cci.Constants.UnmanagedType_VBByRefStr)
info.SetMarshalAsSimpleType(UnmanagedType.VBByRefStr)
End If
Return info
......
......@@ -27,6 +27,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
' TODO (tomat): Consider changing this to an empty name. This name shouldn't ever leak to the user in error messages.
Friend Shared ReadOnly ImplicitTypeName As String = "<invalid-global-code>"
Private Shared ReadOnly s_EmptyTypeSymbols() As TypeSymbol = {}
Private _lazyAllInterfaces As ImmutableArray(Of NamedTypeSymbol)
Private _lazyInterfacesAndTheirBaseInterfaces As ImmutableHashSet(Of NamedTypeSymbol)
......@@ -43,7 +45,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Public Shared ReadOnly Property EmptyTypeSymbolsList As IList(Of TypeSymbol)
Get
Return Array.Empty(Of TypeSymbol)
Return s_EmptyTypeSymbols
End Get
End Property
......
......@@ -292,7 +292,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Property
' an empty collection of syntax errors.
Friend Shared EmptyErrorCollection As New ReadOnlyCollection(Of Diagnostic)(Array.Empty(Of VBDiagnostic))
Friend Shared EmptyErrorCollection As New ReadOnlyCollection(Of Diagnostic)(New VBDiagnostic() {})
''' <summary>
''' Get all syntax errors associated with this node, or any child nodes, grand-child nodes, etc. The errors
......
......@@ -364,7 +364,7 @@ private static MethodSymbol GetSynthesizedMethod(CommonPEModuleBuilder moduleBui
}
}
private static readonly ReadOnlyCollection<byte> s_emptyBytes = new ReadOnlyCollection<byte>(Array.Empty<byte>());
private static readonly ReadOnlyCollection<byte> s_emptyBytes = new ReadOnlyCollection<byte>(new byte[0]);
internal override ReadOnlyCollection<byte> CompileGetLocals(
ArrayBuilder<LocalAndMethod> locals,
......
......@@ -68,7 +68,7 @@ private DynamicFlagsCustomTypeInfo(ArrayBuilder<bool> dynamicFlags, int startInd
/// <remarks>
/// Not guaranteed to add the same number of flags as would
/// appear in a System.Runtime.CompilerServices.DynamicAttribute.
/// appear in a <see cref="System.Runtime.CompilerServices.DynamicAttribute"/>.
/// It may have more (for padding) or fewer (for compactness) falses.
/// It is, however, guaranteed to include the last true.
/// </remarks>
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#pragma warning disable RS0007 // Avoid zero-length array allocations.
using System;
using System.Collections.ObjectModel;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#pragma warning disable RS0007 // Avoid zero-length array allocations.
using System.Collections.Generic;
using System.Collections.ObjectModel;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#pragma warning disable RS0007 // Avoid zero-length array allocations.
using System;
using System.Collections.ObjectModel;
......
......@@ -463,7 +463,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
End Using
End Function
Private Shared ReadOnly s_emptyBytes As New ReadOnlyCollection(Of Byte)(Array.Empty(Of Byte))
Private Shared ReadOnly s_emptyBytes As New ReadOnlyCollection(Of Byte)(New Byte() {})
Friend Overrides Function CompileGetLocals(
locals As ArrayBuilder(Of LocalAndMethod),
......
......@@ -268,7 +268,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
' Property: Attributes Modifiers [|Identifier$ Initializer|] ImplementsClause
Dim propertyStatement = DirectCast(node, PropertyStatementSyntax)
If propertyStatement.Initializer IsNot Nothing Then
Return {propertyStatement.Identifier}.Concat(If(propertyStatement.AsClause?.DescendantTokens(), Array.Empty(Of SyntaxToken)())).Concat(propertyStatement.Initializer.DescendantTokens())
Return {propertyStatement.Identifier}.Concat(If(propertyStatement.AsClause?.DescendantTokens(), {})).Concat(propertyStatement.Initializer.DescendantTokens())
End If
If HasAsNewClause(propertyStatement) Then
......
......@@ -45,7 +45,7 @@ public DiagnosticResultLocation[] Locations
{
if (this.locations == null)
{
return Array.Empty<DiagnosticResultLocation>();
this.locations = new DiagnosticResultLocation[] { };
}
return this.locations;
}
......
......@@ -217,7 +217,7 @@ public static string DecodeForwardIteratorRecord(ImmutableArray<byte> bytes)
}
/// <summary>
/// Does for locals what System.Runtime.CompilerServices.DynamicAttribute does for parameters, return types, and fields.
/// Does for locals what <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> does for parameters, return types, and fields.
/// In particular, indicates which occurrences of <see cref="object"/> in the signature are really dynamic.
/// </summary>
/// <remarks>
......
......@@ -14,8 +14,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\</SolutionDir>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFrameworkProfile></TargetFrameworkProfile>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<ItemGroup Label="Project References">
......@@ -124,6 +123,9 @@
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.cs">
<Link>InternalUtilities\SpecializedCollections.cs</Link>
</Compile>
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Empty.Array.cs">
<Link>InternalUtilities\SpecializedCollections.Empty.Array.cs</Link>
</Compile>
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Empty.Collection.cs">
<Link>InternalUtilities\SpecializedCollections.Empty.Collection.cs</Link>
</Compile>
......@@ -968,4 +970,4 @@
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册