1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-11 18:20:26 +09:00

Enable IDE0074 (Use compound assignment) (#70402)

This commit is contained in:
Stephen Toub 2022-06-09 00:23:35 -04:00 committed by GitHub
parent 8ce62ab80e
commit 76b5b76ceb
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
183 changed files with 834 additions and 1426 deletions

View file

@ -1507,7 +1507,7 @@ dotnet_diagnostic.IDE0072.severity = silent
dotnet_diagnostic.IDE0073.severity = warning
# IDE0074: Use compound assignment
dotnet_diagnostic.IDE0074.severity = suggestion
dotnet_diagnostic.IDE0074.severity = warning
# IDE0075: Simplify conditional expression
dotnet_diagnostic.IDE0075.severity = silent

View file

@ -62,7 +62,7 @@ namespace System.Runtime.InteropServices
//
// Marshalling a managed delegate created from managed code into a native function pointer
//
return GetPInvokeDelegates().GetValue(del, s_AllocateThunk ?? (s_AllocateThunk = AllocateThunk)).Thunk;
return GetPInvokeDelegates().GetValue(del, s_AllocateThunk ??= AllocateThunk).Thunk;
}
}

View file

@ -60,7 +60,7 @@ namespace System.Reflection.Runtime.Assemblies.NativeFormat
{
get
{
return _lazyCaseInsensitiveTypeDictionary ?? (_lazyCaseInsensitiveTypeDictionary = CreateCaseInsensitiveTypeDictionary());
return _lazyCaseInsensitiveTypeDictionary ??= CreateCaseInsensitiveTypeDictionary();
}
}

View file

@ -248,7 +248,7 @@ namespace System.Reflection.Runtime.Assemblies
{
get
{
return _lazyCaseSensitiveTypeTable ?? (_lazyCaseSensitiveTypeTable = new CaseSensitiveTypeCache(this));
return _lazyCaseSensitiveTypeTable ??= new CaseSensitiveTypeCache(this);
}
}

View file

@ -32,7 +32,7 @@ namespace System.Reflection.Runtime.ParameterInfos
{
get
{
return _lazyParameterType ?? (_lazyParameterType = QualifiedParameterTypeHandle.Resolve(_typeContext));
return _lazyParameterType ??= QualifiedParameterTypeHandle.Resolve(_typeContext);
}
}

View file

@ -231,7 +231,7 @@ namespace System.Reflection.Runtime.TypeInfos
{
get
{
return _lazyGeneratedName ?? (_lazyGeneratedName = BlockedRuntimeTypeNameGenerator.GetNameForBlockedRuntimeType(_typeHandle));
return _lazyGeneratedName ??= BlockedRuntimeTypeNameGenerator.GetNameForBlockedRuntimeType(_typeHandle);
}
}

View file

@ -212,7 +212,7 @@ namespace System.Reflection.Runtime.TypeInfos
return new QueryResult<M>(bindingAttr, queriedMembers);
}
private TypeComponentsCache Cache => _lazyCache ?? (_lazyCache = new TypeComponentsCache(this));
private TypeComponentsCache Cache => _lazyCache ??= new TypeComponentsCache(this);
private volatile TypeComponentsCache _lazyCache;

View file

@ -74,7 +74,7 @@ namespace System.Reflection.Runtime.TypeInfos
return Unsafe.As<QueriedMemberList<M>>(result);
}
public EnumInfo EnumInfo => _lazyEnumInfo ?? (_lazyEnumInfo = ReflectionCoreExecution.ExecutionDomain.ExecutionEnvironment.GetEnumInfo(_type.TypeHandle));
public EnumInfo EnumInfo => _lazyEnumInfo ??= ReflectionCoreExecution.ExecutionDomain.ExecutionEnvironment.GetEnumInfo(_type.TypeHandle);
private static object[] CreatePerNameQueryCaches(RuntimeTypeInfo type, bool ignoreCase)
{

View file

@ -186,7 +186,7 @@ namespace ILCompiler
{
if (!type.IsArrayTypeWithoutGenericInterfaces())
{
MetadataType arrayShadowType = _arrayOfTType ?? (_arrayOfTType = SystemModule.GetType("System", "Array`1"));
MetadataType arrayShadowType = _arrayOfTType ??= SystemModule.GetType("System", "Array`1");
return arrayShadowType.MakeInstantiatedType(((ArrayType)type).ElementType);
}

View file

@ -41,7 +41,7 @@ namespace ILCompiler.Metadata
{
Debug.Assert(field.GetTypicalFieldDefinition() == field);
Debug.Assert(_policy.GeneratesMetadata(field));
return (Field)_fields.GetOrCreate(field, _initFieldDef ?? (_initFieldDef = InitializeFieldDefinition));
return (Field)_fields.GetOrCreate(field, _initFieldDef ??= InitializeFieldDefinition);
}
private void InitializeFieldDefinition(Cts.FieldDesc entity, Field record)
@ -79,7 +79,7 @@ namespace ILCompiler.Metadata
private MemberReference HandleFieldReference(Cts.FieldDesc field)
{
return (MemberReference)_fields.GetOrCreate(field, _initFieldRef ?? (_initFieldRef = InitializeFieldReference));
return (MemberReference)_fields.GetOrCreate(field, _initFieldRef ??= InitializeFieldReference);
}
private void InitializeFieldReference(Cts.FieldDesc entity, MemberReference record)

View file

@ -55,7 +55,7 @@ namespace ILCompiler.Metadata
{
Debug.Assert(method.IsTypicalMethodDefinition);
Debug.Assert(_policy.GeneratesMetadata(method));
return (Method)_methods.GetOrCreate(method, _initMethodDef ?? (_initMethodDef = InitializeMethodDefinition));
return (Method)_methods.GetOrCreate(method, _initMethodDef ??= InitializeMethodDefinition);
}
private void InitializeMethodDefinition(Cts.MethodDesc entity, Method record)
@ -123,7 +123,7 @@ namespace ILCompiler.Metadata
private MemberReference HandleMethodReference(Cts.MethodDesc method)
{
Debug.Assert(method.IsMethodDefinition);
return (MemberReference)_methods.GetOrCreate(method, _initMethodRef ?? (_initMethodRef = InitializeMethodReference));
return (MemberReference)_methods.GetOrCreate(method, _initMethodRef ??= InitializeMethodReference);
}
private void InitializeMethodReference(Cts.MethodDesc entity, MemberReference record)
@ -135,7 +135,7 @@ namespace ILCompiler.Metadata
private MethodInstantiation HandleMethodInstantiation(Cts.MethodDesc method)
{
return (MethodInstantiation)_methods.GetOrCreate(method, _initMethodInst ?? (_initMethodInst = InitializeMethodInstantiation));
return (MethodInstantiation)_methods.GetOrCreate(method, _initMethodInst ??= InitializeMethodInstantiation);
}
private void InitializeMethodInstantiation(Cts.MethodDesc entity, MethodInstantiation record)

View file

@ -24,7 +24,7 @@ namespace ILCompiler.Metadata
private ScopeDefinition HandleScopeDefinition(Cts.ModuleDesc module)
{
return _scopeDefs.GetOrCreate(module, _initScopeDef ?? (_initScopeDef = InitializeScopeDefinition));
return _scopeDefs.GetOrCreate(module, _initScopeDef ??= InitializeScopeDefinition);
}
private void InitializeScopeDefinition(Cts.ModuleDesc module, ScopeDefinition scopeDefinition)
@ -122,7 +122,7 @@ namespace ILCompiler.Metadata
private ScopeReference HandleScopeReference(AssemblyName assemblyName)
{
return _scopeRefs.GetOrCreate(assemblyName, _initScopeRef ?? (_initScopeRef = InitializeScopeReference));
return _scopeRefs.GetOrCreate(assemblyName, _initScopeRef ??= InitializeScopeReference);
}
private void InitializeScopeReference(AssemblyName assemblyName, ScopeReference scopeReference)

View file

@ -40,25 +40,25 @@ namespace ILCompiler.Metadata
switch (type.Category)
{
case Cts.TypeFlags.SzArray:
rec = _types.Create((Cts.ArrayType)type, _initSzArray ?? (_initSzArray = InitializeSzArray));
rec = _types.Create((Cts.ArrayType)type, _initSzArray ??= InitializeSzArray);
break;
case Cts.TypeFlags.Array:
rec = _types.Create((Cts.ArrayType)type, _initArray ?? (_initArray = InitializeArray));
rec = _types.Create((Cts.ArrayType)type, _initArray ??= InitializeArray);
break;
case Cts.TypeFlags.ByRef:
rec = _types.Create((Cts.ByRefType)type, _initByRef ?? (_initByRef = InitializeByRef));
rec = _types.Create((Cts.ByRefType)type, _initByRef ??= InitializeByRef);
break;
case Cts.TypeFlags.Pointer:
rec = _types.Create((Cts.PointerType)type, _initPointer ?? (_initPointer = InitializePointer));
rec = _types.Create((Cts.PointerType)type, _initPointer ??= InitializePointer);
break;
case Cts.TypeFlags.FunctionPointer:
rec = _types.Create((Cts.FunctionPointerType)type, _initFunctionPointer ?? (_initFunctionPointer = InitializeFunctionPointer));
rec = _types.Create((Cts.FunctionPointerType)type, _initFunctionPointer ??= InitializeFunctionPointer);
break;
case Cts.TypeFlags.SignatureTypeVariable:
rec = _types.Create((Cts.SignatureTypeVariable)type, _initTypeVar ?? (_initTypeVar = InitializeTypeVariable));
rec = _types.Create((Cts.SignatureTypeVariable)type, _initTypeVar ??= InitializeTypeVariable);
break;
case Cts.TypeFlags.SignatureMethodVariable:
rec = _types.Create((Cts.SignatureMethodVariable)type, _initMethodVar ?? (_initMethodVar = InitializeMethodVariable));
rec = _types.Create((Cts.SignatureMethodVariable)type, _initMethodVar ??= InitializeMethodVariable);
break;
default:
{
@ -67,7 +67,7 @@ namespace ILCompiler.Metadata
if (!type.IsTypeDefinition)
{
// Instantiated generic type
rec = _types.Create(type, _initTypeInst ?? (_initTypeInst = InitializeTypeInstance));
rec = _types.Create(type, _initTypeInst ??= InitializeTypeInstance);
}
else
{
@ -76,11 +76,11 @@ namespace ILCompiler.Metadata
if (_policy.GeneratesMetadata(metadataType))
{
Debug.Assert(!_policy.IsBlocked(metadataType));
rec = _types.Create(metadataType, _initTypeDef ?? (_initTypeDef = InitializeTypeDef));
rec = _types.Create(metadataType, _initTypeDef ??= InitializeTypeDef);
}
else
{
rec = _types.Create(metadataType, _initTypeRef ?? (_initTypeRef = InitializeTypeRef));
rec = _types.Create(metadataType, _initTypeRef ??= InitializeTypeRef);
}
}
}

View file

@ -46,7 +46,7 @@ namespace ILCompiler.Metadata
private TypeForwarder HandleTypeForwarder(Cts.Ecma.EcmaModule module, Ecma.ExportedTypeHandle handle)
{
return _forwarders.GetOrCreate(new ForwarderKey(module, handle), _initForwarder ?? (_initForwarder = InitializeTypeForwarder));
return _forwarders.GetOrCreate(new ForwarderKey(module, handle), _initForwarder ??= InitializeTypeForwarder);
}
private void InitializeTypeForwarder(ForwarderKey key, TypeForwarder record)

View file

@ -22,6 +22,6 @@ namespace System.Runtime.Serialization
public CodeObject() { }
public IDictionary UserData => _userData ?? (_userData = new ListDictionary());
public IDictionary UserData => _userData ??= new ListDictionary();
}
}

View file

@ -144,7 +144,7 @@ namespace System.Data.ProviderBase
private static Task<DbConnectionInternal?> GetCompletedTask()
{
Debug.Assert(Monitor.IsEntered(s_pendingOpenNonPooled), $"Expected {nameof(s_pendingOpenNonPooled)} lock to be held.");
return s_completedTask ?? (s_completedTask = Task.FromResult<DbConnectionInternal?>(null));
return s_completedTask ??= Task.FromResult<DbConnectionInternal?>(null);
}
private DbConnectionPool? GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup)

View file

@ -70,13 +70,13 @@ namespace Microsoft.CSharp.RuntimeBinder
{
if (o.Value is double && double.IsNaN((double)o.Value))
{
MethodInfo isNaN = s_DoubleIsNaN ?? (s_DoubleIsNaN = typeof(double).GetMethod("IsNaN"));
MethodInfo isNaN = s_DoubleIsNaN ??= typeof(double).GetMethod("IsNaN");
Expression e = Expression.Call(null, isNaN, o.Expression);
restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(e));
}
else if (o.Value is float && float.IsNaN((float)o.Value))
{
MethodInfo isNaN = s_SingleIsNaN ?? (s_SingleIsNaN = typeof(float).GetMethod("IsNaN"));
MethodInfo isNaN = s_SingleIsNaN ??= typeof(float).GetMethod("IsNaN");
Expression e = Expression.Call(null, isNaN, o.Expression);
restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(e));
}

View file

@ -119,7 +119,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
private static OperatorInfo GetInfo(OperatorKind op) => s_operatorInfos[(int)op];
public static string OperatorOfMethodName(Name name) =>
(s_operatorsByName ?? (s_operatorsByName = GetOperatorByName()))[name];
(s_operatorsByName ??= GetOperatorByName())[name];
public static string GetDisplayName(OperatorKind op) => TokenFacts.GetText(GetInfo(op).TokenKind);

View file

@ -153,7 +153,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
public TypeArray TypeArgsAll { get; }
public TypeArray IfacesAll => _ifacesAll ?? (_ifacesAll = TypeManager.SubstTypeArray(OwningAggregate.GetIfacesAll(), TypeArgsAll));
public TypeArray IfacesAll => _ifacesAll ??= TypeManager.SubstTypeArray(OwningAggregate.GetIfacesAll(), TypeArgsAll);
private bool IsCollectionType
{
@ -303,7 +303,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
public override Type AssociatedSystemType
{
[RequiresUnreferencedCode(Binder.TrimmerWarning)]
get => _associatedSystemType ?? (_associatedSystemType = CalculateAssociatedSystemType());
get => _associatedSystemType ??= CalculateAssociatedSystemType();
}
[RequiresUnreferencedCode(Binder.TrimmerWarning)]

View file

@ -27,7 +27,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
[RequiresUnreferencedCode(Binder.TrimmerWarning)]
public override AggregateType GetAts() =>
_ats ?? (_ats = TypeManager.GetAggregate(TypeManager.GetNullable(), TypeArray.Allocate(UnderlyingType)));
_ats ??= TypeManager.GetAggregate(TypeManager.GetNullable(), TypeArray.Allocate(UnderlyingType));
public override CType StripNubs() => UnderlyingType;

View file

@ -13,7 +13,7 @@ namespace Microsoft.NETCore.Platforms.BuildTasks
internal Log Log
{
get { return _log ?? (_log = new Log(new TaskLoggingHelper(this))); }
get { return _log ??= new Log(new TaskLoggingHelper(this)); }
}
public BuildTask()

View file

@ -68,7 +68,7 @@ namespace System.CodeDom
public CodeTypeReference CreateType
{
get => _createType ?? (_createType = new CodeTypeReference(""));
get => _createType ??= new CodeTypeReference("");
set => _createType = value;
}

View file

@ -17,6 +17,6 @@ namespace System.CodeDom
public CodeExpression TargetObject { get; set; }
public CodeExpressionCollection Indices => _indices ?? (_indices = new CodeExpressionCollection());
public CodeExpressionCollection Indices => _indices ??= new CodeExpressionCollection();
}
}

View file

@ -22,7 +22,7 @@ namespace System.CodeDom
public CodeEventReferenceExpression Event
{
get => _eventRef ?? (_eventRef = new CodeEventReferenceExpression());
get => _eventRef ??= new CodeEventReferenceExpression();
set => _eventRef = value;
}

View file

@ -29,7 +29,7 @@ namespace System.CodeDom
public CodeTypeReference TargetType
{
get => _targetType ?? (_targetType = new CodeTypeReference(""));
get => _targetType ??= new CodeTypeReference("");
set => _targetType = value;
}

View file

@ -37,10 +37,10 @@ namespace System.CodeDom
public CodeTypeReference CatchExceptionType
{
get => _catchExceptionType ?? (_catchExceptionType = new CodeTypeReference(typeof(Exception)));
get => _catchExceptionType ??= new CodeTypeReference(typeof(Exception));
set => _catchExceptionType = value;
}
public CodeStatementCollection Statements => _statements ?? (_statements = new CodeStatementCollection());
public CodeStatementCollection Statements => _statements ??= new CodeStatementCollection();
}
}

View file

@ -17,12 +17,12 @@ namespace System.CodeDom
public CodeNamespaceCollection Namespaces { get; } = new CodeNamespaceCollection();
public StringCollection ReferencedAssemblies => _assemblies ?? (_assemblies = new StringCollection());
public StringCollection ReferencedAssemblies => _assemblies ??= new StringCollection();
public CodeAttributeDeclarationCollection AssemblyCustomAttributes => _attributes ?? (_attributes = new CodeAttributeDeclarationCollection());
public CodeAttributeDeclarationCollection AssemblyCustomAttributes => _attributes ??= new CodeAttributeDeclarationCollection();
public CodeDirectiveCollection StartDirectives => _startDirectives ?? (_startDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection StartDirectives => _startDirectives ??= new CodeDirectiveCollection();
public CodeDirectiveCollection EndDirectives => _endDirectives ?? (_endDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection EndDirectives => _endDirectives ??= new CodeDirectiveCollection();
}
}

View file

@ -16,7 +16,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}
}

View file

@ -19,7 +19,7 @@ namespace System.CodeDom
public CodeTypeReference DelegateType
{
get => _delegateType ?? (_delegateType = new CodeTypeReference(""));
get => _delegateType ??= new CodeTypeReference("");
set => _delegateType = value;
}

View file

@ -17,6 +17,6 @@ namespace System.CodeDom
public CodeExpression TargetObject { get; set; }
public CodeExpressionCollection Indices => _indices ?? (_indices = new CodeExpressionCollection());
public CodeExpressionCollection Indices => _indices ??= new CodeExpressionCollection();
}
}

View file

@ -12,12 +12,12 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}
public CodeTypeReference PrivateImplementationType { get; set; }
public CodeTypeReferenceCollection ImplementationTypes => _implementationTypes ?? (_implementationTypes = new CodeTypeReferenceCollection());
public CodeTypeReferenceCollection ImplementationTypes => _implementationTypes ??= new CodeTypeReferenceCollection();
}
}

View file

@ -29,7 +29,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}

View file

@ -23,7 +23,7 @@ namespace System.CodeDom
public CodeTypeReference ReturnType
{
get => _returnType ?? (_returnType = new CodeTypeReference(typeof(void).FullName));
get => _returnType ??= new CodeTypeReference(typeof(void).FullName);
set => _returnType = value;
}
@ -76,8 +76,8 @@ namespace System.CodeDom
}
}
public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes => _returnAttributes ?? (_returnAttributes = new CodeAttributeDeclarationCollection());
public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes => _returnAttributes ??= new CodeAttributeDeclarationCollection();
public CodeTypeParameterCollection TypeParameters => _typeParameters ?? (_typeParameters = new CodeTypeParameterCollection());
public CodeTypeParameterCollection TypeParameters => _typeParameters ??= new CodeTypeParameterCollection();
}
}

View file

@ -12,11 +12,11 @@ namespace System.CodeDom
public CodeTypeReference PrivateImplementationType { get; set; }
public CodeTypeReferenceCollection ImplementationTypes => _implementationTypes ?? (_implementationTypes = new CodeTypeReferenceCollection());
public CodeTypeReferenceCollection ImplementationTypes => _implementationTypes ??= new CodeTypeReferenceCollection();
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}

View file

@ -23,7 +23,7 @@ namespace System.CodeDom
public CodeMethodReferenceExpression Method
{
get => _method ?? (_method = new CodeMethodReferenceExpression());
get => _method ??= new CodeMethodReferenceExpression();
set => _method = value;
}

View file

@ -29,7 +29,7 @@ namespace System.CodeDom
public CodeTypeReference CreateType
{
get => _createType ?? (_createType = new CodeTypeReference(""));
get => _createType ??= new CodeTypeReference("");
set => _createType = value;
}

View file

@ -31,7 +31,7 @@ namespace System.CodeDom
public CodeAttributeDeclarationCollection CustomAttributes
{
get => _customAttributes ?? (_customAttributes = new CodeAttributeDeclarationCollection());
get => _customAttributes ??= new CodeAttributeDeclarationCollection();
set => _customAttributes = value;
}
@ -39,7 +39,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}

View file

@ -23,7 +23,7 @@ namespace System.CodeDom
public CodeEventReferenceExpression Event
{
get => _eventRef ?? (_eventRef = new CodeEventReferenceExpression());
get => _eventRef ??= new CodeEventReferenceExpression();
set => _eventRef = value;
}

View file

@ -10,8 +10,8 @@ namespace System.CodeDom
public CodeLinePragma LinePragma { get; set; }
public CodeDirectiveCollection StartDirectives => _startDirectives ?? (_startDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection StartDirectives => _startDirectives ??= new CodeDirectiveCollection();
public CodeDirectiveCollection EndDirectives => _endDirectives ?? (_endDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection EndDirectives => _endDirectives ??= new CodeDirectiveCollection();
}
}

View file

@ -122,6 +122,6 @@ namespace System.CodeDom
}
}
public CodeTypeParameterCollection TypeParameters => _typeParameters ?? (_typeParameters = new CodeTypeParameterCollection());
public CodeTypeParameterCollection TypeParameters => _typeParameters ??= new CodeTypeParameterCollection();
}
}

View file

@ -24,7 +24,7 @@ namespace System.CodeDom
public CodeTypeReference ReturnType
{
get => _returnType ?? (_returnType = new CodeTypeReference(""));
get => _returnType ??= new CodeTypeReference("");
set => _returnType = value;
}

View file

@ -20,7 +20,7 @@ namespace System.CodeDom
public CodeAttributeDeclarationCollection CustomAttributes
{
get => _customAttributes ?? (_customAttributes = new CodeAttributeDeclarationCollection());
get => _customAttributes ??= new CodeAttributeDeclarationCollection();
set => _customAttributes = value;
}
@ -28,8 +28,8 @@ namespace System.CodeDom
public CodeCommentStatementCollection Comments { get; } = new CodeCommentStatementCollection();
public CodeDirectiveCollection StartDirectives => _startDirectives ?? (_startDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection StartDirectives => _startDirectives ??= new CodeDirectiveCollection();
public CodeDirectiveCollection EndDirectives => _endDirectives ?? (_endDirectives = new CodeDirectiveCollection());
public CodeDirectiveCollection EndDirectives => _endDirectives ??= new CodeDirectiveCollection();
}
}

View file

@ -26,7 +26,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}
}

View file

@ -22,9 +22,9 @@ namespace System.CodeDom
set => _name = value;
}
public CodeTypeReferenceCollection Constraints => _constraints ?? (_constraints = new CodeTypeReferenceCollection());
public CodeTypeReferenceCollection Constraints => _constraints ??= new CodeTypeReferenceCollection();
public CodeAttributeDeclarationCollection CustomAttributes => _customAttributes ?? (_customAttributes = new CodeAttributeDeclarationCollection());
public CodeAttributeDeclarationCollection CustomAttributes => _customAttributes ??= new CodeAttributeDeclarationCollection();
public bool HasConstructorConstraint { get; set; }
}

View file

@ -26,7 +26,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}
}

View file

@ -59,7 +59,7 @@ namespace System.CodeDom
public CodeTypeReference Type
{
get => _type ?? (_type = new CodeTypeReference(""));
get => _type ??= new CodeTypeReference("");
set => _type = value;
}
}

View file

@ -60,7 +60,7 @@ namespace System.CodeDom.Compiler
public TempFileCollection TempFiles
{
get => _tempFiles ?? (_tempFiles = new TempFileCollection());
get => _tempFiles ??= new TempFileCollection();
set => _tempFiles = value;
}

View file

@ -34,6 +34,6 @@ namespace System.CodeDom
set => _methodName = value;
}
public CodeTypeReferenceCollection TypeArguments => _typeArguments ?? (_typeArguments = new CodeTypeReferenceCollection());
public CodeTypeReferenceCollection TypeArguments => _typeArguments ??= new CodeTypeReferenceCollection();
}
}

View file

@ -58,6 +58,6 @@ namespace System.Collections.Immutable
/// Gets the contents of the enumerable for display in the debugger.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Contents => _cachedContents ?? (_cachedContents = _enumerable.ToArray());
public T[] Contents => _cachedContents ??= _enumerable.ToArray();
}
}

View file

@ -29,8 +29,7 @@ namespace System.Collections
public static CaseInsensitiveHashCodeProvider Default => new CaseInsensitiveHashCodeProvider();
public static CaseInsensitiveHashCodeProvider DefaultInvariant => s_invariantCaseInsensitiveHashCodeProvider ??
(s_invariantCaseInsensitiveHashCodeProvider = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture));
public static CaseInsensitiveHashCodeProvider DefaultInvariant => s_invariantCaseInsensitiveHashCodeProvider ??= new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
public int GetHashCode(object obj)
{

View file

@ -99,7 +99,7 @@ namespace System.ComponentModel.DataAnnotations
// If the method throws (indicating that the input params are invalid) this property will throw
// every time it's accessed.
public IDictionary<string, object?> ControlParameters =>
_controlParameters ?? (_controlParameters = BuildControlParametersDictionary());
_controlParameters ??= BuildControlParametersDictionary();
/// <summary>
/// Returns the hash code for this UIHintAttribute.

View file

@ -91,7 +91,7 @@ namespace System.ComponentModel.DataAnnotations
/// This property will never be null.
/// </value>
public ValidationResult ValidationResult =>
_validationResult ?? (_validationResult = new ValidationResult(Message));
_validationResult ??= new ValidationResult(Message);
/// <summary>
/// Gets the value that caused the validating attribute to trigger the exception

View file

@ -41,7 +41,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Action
{
get => s_action ?? (s_action = new CategoryAttribute(nameof(Action)));
get => s_action ??= new CategoryAttribute(nameof(Action));
}
/// <summary>
@ -49,7 +49,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Appearance
{
get => s_appearance ?? (s_appearance = new CategoryAttribute(nameof(Appearance)));
get => s_appearance ??= new CategoryAttribute(nameof(Appearance));
}
/// <summary>
@ -57,7 +57,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Asynchronous
{
get => s_asynchronous ?? (s_asynchronous = new CategoryAttribute(nameof(Asynchronous)));
get => s_asynchronous ??= new CategoryAttribute(nameof(Asynchronous));
}
/// <summary>
@ -65,7 +65,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Behavior
{
get => s_behavior ?? (s_behavior = new CategoryAttribute(nameof(Behavior)));
get => s_behavior ??= new CategoryAttribute(nameof(Behavior));
}
/// <summary>
@ -73,7 +73,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Data
{
get => s_data ?? (s_data = new CategoryAttribute(nameof(Data)));
get => s_data ??= new CategoryAttribute(nameof(Data));
}
/// <summary>
@ -81,7 +81,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Default
{
get => s_defAttr ?? (s_defAttr = new CategoryAttribute());
get => s_defAttr ??= new CategoryAttribute();
}
/// <summary>
@ -89,7 +89,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Design
{
get => s_design ?? (s_design = new CategoryAttribute(nameof(Design)));
get => s_design ??= new CategoryAttribute(nameof(Design));
}
/// <summary>
@ -97,7 +97,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute DragDrop
{
get => s_dragDrop ?? (s_dragDrop = new CategoryAttribute(nameof(DragDrop)));
get => s_dragDrop ??= new CategoryAttribute(nameof(DragDrop));
}
/// <summary>
@ -105,7 +105,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Focus
{
get => s_focus ?? (s_focus = new CategoryAttribute(nameof(Focus)));
get => s_focus ??= new CategoryAttribute(nameof(Focus));
}
/// <summary>
@ -113,7 +113,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Format
{
get => s_format ?? (s_format = new CategoryAttribute(nameof(Format)));
get => s_format ??= new CategoryAttribute(nameof(Format));
}
/// <summary>
@ -121,7 +121,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Key
{
get => s_key ?? (s_key = new CategoryAttribute(nameof(Key)));
get => s_key ??= new CategoryAttribute(nameof(Key));
}
/// <summary>
@ -129,7 +129,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Layout
{
get => s_layout ?? (s_layout = new CategoryAttribute(nameof(Layout)));
get => s_layout ??= new CategoryAttribute(nameof(Layout));
}
/// <summary>
@ -137,7 +137,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute Mouse
{
get => s_mouse ?? (s_mouse = new CategoryAttribute(nameof(Mouse)));
get => s_mouse ??= new CategoryAttribute(nameof(Mouse));
}
/// <summary>
@ -145,7 +145,7 @@ namespace System.ComponentModel
/// </summary>
public static CategoryAttribute WindowStyle
{
get => s_windowStyle ?? (s_windowStyle = new CategoryAttribute(nameof(WindowStyle)));
get => s_windowStyle ??= new CategoryAttribute(nameof(WindowStyle));
}
/// <summary>

View file

@ -52,7 +52,7 @@ namespace System.ComponentModel
/// <summary>
/// Gets the list of event handlers that are attached to this component.
/// </summary>
protected EventHandlerList Events => _events ?? (_events = new EventHandlerList(this));
protected EventHandlerList Events => _events ??= new EventHandlerList(this);
/// <summary>
/// Gets or sets the site of the <see cref='System.ComponentModel.Component'/>.

View file

@ -47,7 +47,7 @@ namespace System.ComponentModel
/// </summary>
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext? context)
{
return s_values ?? (s_values = new StandardValuesCollection(new object[] { true, false }));
return s_values ??= new StandardValuesCollection(new object[] { true, false });
}
/// <summary>

View file

@ -20,7 +20,7 @@ namespace System.ComponentModel.Design
/// </summary>
public DesignerOptionCollection Options
{
get => _options ?? (_options = new DesignerOptionCollection(this, null, string.Empty, null));
get => _options ??= new DesignerOptionCollection(this, null, string.Empty, null);
}
/// <summary>

View file

@ -89,7 +89,7 @@ namespace System.ComponentModel.Design
}
}
public virtual IDictionary Properties => _properties ?? (_properties = new HybridDictionary());
public virtual IDictionary Properties => _properties ??= new HybridDictionary();
/// <summary>
/// Gets or sets a value indicating whether this menu item is supported.

View file

@ -50,7 +50,7 @@ namespace System.ComponentModel.Design
/// Our collection of services. The service collection is demand
/// created here.
/// </summary>
private ServiceCollection<object?> Services => _services ?? (_services = new ServiceCollection<object?>());
private ServiceCollection<object?> Services => _services ??= new ServiceCollection<object?>();
/// <summary>
/// Adds the given service to the service container.

View file

@ -45,7 +45,7 @@ namespace System.ComponentModel
/// <summary>
/// Gets the list of event handlers that are attached to this component.
/// </summary>
protected EventHandlerList Events => _events ?? (_events = new EventHandlerList());
protected EventHandlerList Events => _events ??= new EventHandlerList();
/// <summary>
/// Gets or sets the site of the component.

View file

@ -165,13 +165,12 @@ namespace System.ComponentModel
/// Gets the name of the category that the member belongs to, as specified
/// in the <see cref='System.ComponentModel.CategoryAttribute'/>.
/// </summary>
public virtual string Category => _category ?? (_category = ((CategoryAttribute)Attributes[typeof(CategoryAttribute)]!).Category);
public virtual string Category => _category ??= ((CategoryAttribute)Attributes[typeof(CategoryAttribute)]!).Category;
/// <summary>
/// Gets the description of the member as specified in the <see cref='System.ComponentModel.DescriptionAttribute'/>.
/// </summary>
public virtual string Description => _description ??
(_description = ((DescriptionAttribute)Attributes[typeof(DescriptionAttribute)]!).Description);
public virtual string Description => _description ??= ((DescriptionAttribute)Attributes[typeof(DescriptionAttribute)]!).Description;
/// <summary>
/// Gets a value indicating whether the member is browsable as specified in the

View file

@ -78,7 +78,7 @@ namespace System.ComponentModel
/// The unique identifier for this attribute. All ToolboxItemFilterAttributes with the same filter string
/// are considered the same, so they return the same TypeId.
/// </summary>
public override object TypeId => _typeId ?? (_typeId = GetType().FullName + FilterString);
public override object TypeId => _typeId ??= GetType().FullName + FilterString;
public override bool Equals([NotNullWhen(true)] object? obj)
{

View file

@ -101,7 +101,7 @@ namespace System.ComponentModel
return _parent.GetExtendedTypeDescriptor(instance);
}
return _emptyDescriptor ?? (_emptyDescriptor = new EmptyCustomTypeDescriptor());
return _emptyDescriptor ??= new EmptyCustomTypeDescriptor();
}
protected internal virtual IExtenderProvider[] GetExtenderProviders(object instance)
@ -256,7 +256,7 @@ namespace System.ComponentModel
return _parent.GetTypeDescriptor(objectType, instance);
}
return _emptyDescriptor ?? (_emptyDescriptor = new EmptyCustomTypeDescriptor());
return _emptyDescriptor ??= new EmptyCustomTypeDescriptor();
}
/// <summary>

View file

@ -23,7 +23,7 @@ namespace System.Configuration
protected internal override ConfigurationPropertyCollection Properties => EnsureStaticPropertyBag();
internal NameValueCollection InternalSettings
=> _keyValueCollection ?? (_keyValueCollection = new KeyValueInternalCollection(this));
=> _keyValueCollection ??= new KeyValueInternalCollection(this);
[ConfigurationProperty("", IsDefaultCollection = true)]
public KeyValueConfigurationCollection Settings => (KeyValueConfigurationCollection)base[s_propAppSettings];

View file

@ -3181,12 +3181,12 @@ namespace System.Configuration
// per record by creating the table on demand.
protected Hashtable EnsureFactories()
{
return _factoryRecords ?? (_factoryRecords = new Hashtable());
return _factoryRecords ??= new Hashtable();
}
private ArrayList EnsureLocationSections()
{
return _locationSections ?? (_locationSections = new ArrayList());
return _locationSections ??= new ArrayList();
}
internal static string NormalizeConfigSource(string configSource, IConfigErrorInfo errorInfo)
@ -3714,7 +3714,7 @@ namespace System.Configuration
internal StreamChangeCallback CallbackDelegate { get; set; }
internal HybridDictionary StreamInfos => _streamInfos ?? (_streamInfos = new HybridDictionary(true));
internal HybridDictionary StreamInfos => _streamInfos ??= new HybridDictionary(true);
internal bool HasStreamInfos => _streamInfos != null;

View file

@ -37,7 +37,7 @@ namespace System.Configuration
Host = new InternalConfigHost();
}
internal ClientConfigPaths ConfigPaths => _configPaths ?? (_configPaths = ClientConfigPaths.GetPaths(_exePath, _initComplete));
internal ClientConfigPaths ConfigPaths => _configPaths ??= ClientConfigPaths.GetPaths(_exePath, _initComplete);
internal static string MachineConfigFilePath
{

View file

@ -84,10 +84,10 @@ namespace System.Configuration
public bool HasFile => _configRecord.HasStream;
public ConfigurationLocationCollection Locations
=> _locations ?? (_locations = _configRecord.GetLocationCollection(this));
=> _locations ??= _configRecord.GetLocationCollection(this);
public ContextInformation EvaluationContext
=> _evalContext ?? (_evalContext = new ContextInformation(_configRecord));
=> _evalContext ??= new ContextInformation(_configRecord);
public ConfigurationSectionGroup RootSectionGroup
{
@ -152,7 +152,7 @@ namespace System.Configuration
internal bool AssemblyStringTransformerIsSet { get; private set; }
internal Stack SectionsStack => _sectionsStack ?? (_sectionsStack = new Stack());
internal Stack SectionsStack => _sectionsStack ??= new Stack();
// Create a new instance of Configuration for the locationSubPath,
// with the initialization parameters that were used to create this configuration.

View file

@ -86,17 +86,13 @@ namespace System.Configuration
internal ConfigurationValueFlags ItemLocked => _itemLockedFlag;
public ConfigurationLockCollection LockAttributes => _lockedAttributesList
?? (_lockedAttributesList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedAttributes));
public ConfigurationLockCollection LockAttributes => _lockedAttributesList ??= new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedAttributes);
public ConfigurationLockCollection LockAllAttributesExcept => _lockedAllExceptAttributesList
?? (_lockedAllExceptAttributesList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedExceptionList, ElementTagName));
public ConfigurationLockCollection LockAllAttributesExcept => _lockedAllExceptAttributesList ??= new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedExceptionList, ElementTagName);
public ConfigurationLockCollection LockElements => _lockedElementsList
?? (_lockedElementsList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElements));
public ConfigurationLockCollection LockElements => _lockedElementsList ??= new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElements);
public ConfigurationLockCollection LockAllElementsExcept => _lockedAllExceptElementsList
?? (_lockedAllExceptElementsList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElementsExceptionList, ElementTagName));
public ConfigurationLockCollection LockAllElementsExcept => _lockedAllExceptElementsList ??= new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElementsExceptionList, ElementTagName);
public bool LockItem
{
@ -203,7 +199,7 @@ namespace System.Configuration
internal ConfigurationValues Values { get; }
public ElementInformation ElementInformation => _evaluationElement ?? (_evaluationElement = new ElementInformation(this));
public ElementInformation ElementInformation => _evaluationElement ??= new ElementInformation(this);
protected ContextInformation EvaluationContext
{

View file

@ -43,7 +43,7 @@ namespace System.Configuration
=> _containsInvalidValue ? new InvalidValuesCollection(this) : EmptyCollectionInstance;
private static IEnumerable EmptyCollectionInstance
=> s_emptyCollection ?? (s_emptyCollection = new EmptyCollection());
=> s_emptyCollection ??= new EmptyCollection();
internal void AssociateContext(BaseConfigurationRecord configRecord)
{

View file

@ -17,7 +17,7 @@ namespace System.Configuration
}
public PropertyInformationCollection Properties
=> _internalProperties ?? (_internalProperties = new PropertyInformationCollection(_thisElement));
=> _internalProperties ??= new PropertyInformationCollection(_thisElement);
public bool IsPresent => _thisElement.ElementPresent;
@ -52,7 +52,7 @@ namespace System.Configuration
public ConfigurationValidatorBase Validator => _thisElement.ElementProperty.Validator;
public ICollection Errors => _errors ?? (_errors = GetReadOnlyErrorsList());
public ICollection Errors => _errors ??= GetReadOnlyErrorsList();
// Internal method to fix SetRawXML defect...
internal PropertySourceInfo PropertyInfoInternal()

View file

@ -12,7 +12,7 @@ namespace System.Configuration
internal static IDisposable GetStaticInstance()
{
return s_emptyImpersonationContext ?? (s_emptyImpersonationContext = new EmptyImpersonationContext());
return s_emptyImpersonationContext ??= new EmptyImpersonationContext();
}
}
}

View file

@ -42,16 +42,16 @@ namespace System.Configuration
protected override SimpleBitVector32 ClassFlags => s_mgmtClassFlags;
private Hashtable SectionGroups => _sectionGroups ?? (_sectionGroups = new Hashtable());
private Hashtable SectionGroups => _sectionGroups ??= new Hashtable();
private Hashtable RemovedSections => _removedSections ?? (_removedSections = new Hashtable());
private Hashtable RemovedSections => _removedSections ??= new Hashtable();
private Hashtable RemovedSectionGroups => _removedSectionGroups ?? (_removedSectionGroups = new Hashtable());
private Hashtable RemovedSectionGroups => _removedSectionGroups ??= new Hashtable();
internal Hashtable SectionFactories => _sectionFactories ?? (_sectionFactories = GetAllFactories(false));
internal Hashtable SectionFactories => _sectionFactories ??= GetAllFactories(false);
internal Hashtable SectionGroupFactories
=> _sectionGroupFactories ?? (_sectionGroupFactories = GetAllFactories(true));
=> _sectionGroupFactories ??= GetAllFactories(true);
internal string ConfigurationFilePath => UpdateConfigHost.GetNewStreamname(ConfigStreamInfo.StreamName) ?? string.Empty;

View file

@ -18,7 +18,7 @@ namespace System.Configuration
_thisElement = thisElement;
}
private ConfigurationProperty Prop => _prop ?? (_prop = _thisElement.Properties[Name]);
private ConfigurationProperty Prop => _prop ??= _thisElement.Properties[Name];
public string Name { get; }

View file

@ -903,12 +903,12 @@ namespace System
if (char.IsAsciiLetterUpper(c))
{
index = c - 'A';
return staticVars ?? (staticVars = new FormatParam[26]); // one slot for each letter of alphabet
return staticVars ??= new FormatParam[26]; // one slot for each letter of alphabet
}
else if (char.IsAsciiLetterLower(c))
{
index = c - 'a';
return dynamicVars ?? (dynamicVars = new FormatParam[26]); // one slot for each letter of alphabet
return dynamicVars ??= new FormatParam[26]; // one slot for each letter of alphabet
}
else throw new InvalidOperationException(SR.IO_TermInfoInvalid);
}

View file

@ -145,7 +145,7 @@ namespace System.Data.Common
// implemented as a method, not as a property because the VS7 debugger
// object browser calls properties to display their value, and we want this delayed
private List<DataTableMapping> ArrayList() => _items ?? (_items = new List<DataTableMapping>());
private List<DataTableMapping> ArrayList() => _items ??= new List<DataTableMapping>();
public void Clear()
{

View file

@ -91,7 +91,7 @@ namespace System.Data
/// Gets the collection of customized user information.
/// </summary>
[Browsable(false)]
public PropertyCollection ExtendedProperties => _extendedProperties ?? (_extendedProperties = new PropertyCollection());
public PropertyCollection ExtendedProperties => _extendedProperties ??= new PropertyCollection();
internal abstract bool ContainsColumn(DataColumn column);
internal abstract bool CanEnableConstraint();

View file

@ -267,9 +267,9 @@ namespace System.Data
}
internal AutoIncrementValue AutoInc =>
(_autoInc ?? (_autoInc = ((DataType == typeof(BigInteger)) ?
(_autoInc ??= ((DataType == typeof(BigInteger)) ?
(AutoIncrementValue)new AutoIncrementBigInteger() :
new AutoIncrementInt64())));
new AutoIncrementInt64()));
/// <summary>
@ -859,7 +859,7 @@ namespace System.Data
/// Gets the collection of custom user information.
/// </summary>
[Browsable(false)]
public PropertyCollection ExtendedProperties => _extendedProperties ?? (_extendedProperties = new PropertyCollection());
public PropertyCollection ExtendedProperties => _extendedProperties ??= new PropertyCollection();
/// <summary>
/// Indicates whether this column is now storing data.

View file

@ -619,7 +619,7 @@ namespace System.Data
/// Gets the collection of custom user information.
/// </summary>
[Browsable(false)]
public PropertyCollection ExtendedProperties => _extendedProperties ?? (_extendedProperties = new PropertyCollection());
public PropertyCollection ExtendedProperties => _extendedProperties ??= new PropertyCollection();
internal bool CheckMultipleNested
{

View file

@ -823,7 +823,7 @@ namespace System.Data
/// Gets the collection of custom user information.
/// </summary>
[Browsable(false)]
public PropertyCollection ExtendedProperties => _extendedProperties ?? (_extendedProperties = new PropertyCollection());
public PropertyCollection ExtendedProperties => _extendedProperties ??= new PropertyCollection();
/// <summary>
/// Gets a value indicating whether there are errors in any

View file

@ -1171,7 +1171,7 @@ namespace System.Data
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DataRelationCollection ChildRelations =>
_childRelationsCollection ?? (_childRelationsCollection = new DataRelationCollection.DataTableRelationCollection(this, false));
_childRelationsCollection ??= new DataRelationCollection.DataTableRelationCollection(this, false);
/// <summary>
/// Gets the collection of columns that belong to this table.
@ -1186,7 +1186,7 @@ namespace System.Data
Columns.Clear();
}
private CompareInfo CompareInfo => _compareInfo ?? (_compareInfo = Locale.CompareInfo);
private CompareInfo CompareInfo => _compareInfo ??= Locale.CompareInfo;
/// <summary>
/// Gets the collection of constraints maintained by this table.
@ -1346,7 +1346,7 @@ namespace System.Data
/// Gets the collection of customized user information.
/// </summary>
[Browsable(false)]
public PropertyCollection ExtendedProperties => _extendedProperties ?? (_extendedProperties = new PropertyCollection());
public PropertyCollection ExtendedProperties => _extendedProperties ??= new PropertyCollection();
internal IFormatProvider FormatProvider
{
@ -1543,8 +1543,7 @@ namespace System.Data
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DataRelationCollection ParentRelations => _parentRelationsCollection ??
(_parentRelationsCollection = new DataRelationCollection.DataTableRelationCollection(this, true));
public DataRelationCollection ParentRelations => _parentRelationsCollection ??= new DataRelationCollection.DataTableRelationCollection(this, true);
internal bool MergingData
{

View file

@ -52,7 +52,7 @@ namespace System.Drawing
private static Icon GetIcon(ref Icon? icon, int iconId)
{
return icon ?? (icon = new Icon(Interop.User32.LoadIcon(NativeMethods.NullHandleRef, (IntPtr)iconId)));
return icon ??= new Icon(Interop.User32.LoadIcon(NativeMethods.NullHandleRef, (IntPtr)iconId));
}
}
}

View file

@ -8,7 +8,7 @@ namespace System.Globalization.Tests
[ThreadStatic]
private static RandomDataGenerator t_randomDataGenerator;
private static RandomDataGenerator Generator => t_randomDataGenerator ?? (t_randomDataGenerator = new RandomDataGenerator());
private static RandomDataGenerator Generator => t_randomDataGenerator ??= new RandomDataGenerator();
private static readonly Calendar s_calendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);

View file

@ -8,7 +8,7 @@ namespace System.Globalization.Tests
[ThreadStatic]
private static RandomDataGenerator t_randomDataGenerator;
private static RandomDataGenerator Generator => t_randomDataGenerator ?? (t_randomDataGenerator = new RandomDataGenerator());
private static RandomDataGenerator Generator => t_randomDataGenerator ??= new RandomDataGenerator();
private static readonly int[] s_daysPerMonthLeapYear = new int[]
{

View file

@ -6,6 +6,6 @@ namespace System.IO.Pipelines.Tests
public class BasePipeReaderReadAtLeastAsyncTests : ReadAtLeastAsyncTests
{
private PipeReader? _pipeReader;
protected override PipeReader PipeReader => _pipeReader ?? (_pipeReader = new BasePipeReader(Pipe.Reader));
protected override PipeReader PipeReader => _pipeReader ??= new BasePipeReader(Pipe.Reader);
}
}

View file

@ -6,6 +6,6 @@ namespace System.IO.Pipelines.Tests
public class StreamPipeReaderCopyToAsyncTests : CopyToAsyncTests
{
private PipeReader? _pipeReader;
protected override PipeReader PipeReader => _pipeReader ?? (_pipeReader = PipeReader.Create(Pipe.Reader.AsStream()));
protected override PipeReader PipeReader => _pipeReader ??= PipeReader.Create(Pipe.Reader.AsStream());
}
}

View file

@ -10,7 +10,7 @@ namespace System.IO.Pipelines.Tests
public class StreamPipeReaderReadAtLeastAsyncTests : ReadAtLeastAsyncTests
{
private PipeReader? _pipeReader;
protected override PipeReader PipeReader => _pipeReader ?? (_pipeReader = PipeReader.Create(Pipe.Reader.AsStream()));
protected override PipeReader PipeReader => _pipeReader ??= PipeReader.Create(Pipe.Reader.AsStream());
protected override void SetPipeReaderOptions(MemoryPool<byte>? pool = null, int bufferSize = -1)
{

View file

@ -11,127 +11,102 @@ namespace System.Linq.Expressions
{
private static MethodInfo? s_String_Format_String_ObjectArray;
public static MethodInfo String_Format_String_ObjectArray =>
s_String_Format_String_ObjectArray ??
(s_String_Format_String_ObjectArray = typeof(string).GetMethod(nameof(string.Format), new Type[] { typeof(string), typeof(object[]) })!);
s_String_Format_String_ObjectArray ??= typeof(string).GetMethod(nameof(string.Format), new Type[] { typeof(string), typeof(object[]) })!;
private static ConstructorInfo? s_InvalidCastException_Ctor_String;
public static ConstructorInfo InvalidCastException_Ctor_String =>
s_InvalidCastException_Ctor_String ??
(s_InvalidCastException_Ctor_String = typeof(InvalidCastException).GetConstructor(new Type[] { typeof(string) })!);
s_InvalidCastException_Ctor_String ??= typeof(InvalidCastException).GetConstructor(new Type[] { typeof(string) })!;
private static MethodInfo? s_CallSiteOps_SetNotMatched;
public static MethodInfo CallSiteOps_SetNotMatched =>
s_CallSiteOps_SetNotMatched ??
(s_CallSiteOps_SetNotMatched = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.SetNotMatched))!);
s_CallSiteOps_SetNotMatched ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.SetNotMatched))!;
private static MethodInfo? s_CallSiteOps_CreateMatchmaker;
public static MethodInfo CallSiteOps_CreateMatchmaker =>
s_CallSiteOps_CreateMatchmaker ??
(s_CallSiteOps_CreateMatchmaker = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.CreateMatchmaker))!);
s_CallSiteOps_CreateMatchmaker ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.CreateMatchmaker))!;
private static MethodInfo? s_CallSiteOps_GetMatch;
public static MethodInfo CallSiteOps_GetMatch =>
s_CallSiteOps_GetMatch ??
(s_CallSiteOps_GetMatch = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetMatch))!);
s_CallSiteOps_GetMatch ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetMatch))!;
private static MethodInfo? s_CallSiteOps_ClearMatch;
public static MethodInfo CallSiteOps_ClearMatch =>
s_CallSiteOps_ClearMatch ??
(s_CallSiteOps_ClearMatch = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.ClearMatch))!);
s_CallSiteOps_ClearMatch ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.ClearMatch))!;
private static MethodInfo? s_CallSiteOps_UpdateRules;
public static MethodInfo CallSiteOps_UpdateRules =>
s_CallSiteOps_UpdateRules ??
(s_CallSiteOps_UpdateRules = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.UpdateRules))!);
s_CallSiteOps_UpdateRules ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.UpdateRules))!;
private static MethodInfo? s_CallSiteOps_GetRules;
public static MethodInfo CallSiteOps_GetRules =>
s_CallSiteOps_GetRules ??
(s_CallSiteOps_GetRules = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetRules))!);
s_CallSiteOps_GetRules ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetRules))!;
private static MethodInfo? s_CallSiteOps_GetRuleCache;
public static MethodInfo CallSiteOps_GetRuleCache =>
s_CallSiteOps_GetRuleCache ??
(s_CallSiteOps_GetRuleCache = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetRuleCache))!);
s_CallSiteOps_GetRuleCache ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetRuleCache))!;
private static MethodInfo? s_CallSiteOps_GetCachedRules;
public static MethodInfo CallSiteOps_GetCachedRules =>
s_CallSiteOps_GetCachedRules ??
(s_CallSiteOps_GetCachedRules = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetCachedRules))!);
s_CallSiteOps_GetCachedRules ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.GetCachedRules))!;
private static MethodInfo? s_CallSiteOps_AddRule;
public static MethodInfo CallSiteOps_AddRule =>
s_CallSiteOps_AddRule ??
(s_CallSiteOps_AddRule = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.AddRule))!);
s_CallSiteOps_AddRule ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.AddRule))!;
private static MethodInfo? s_CallSiteOps_MoveRule;
public static MethodInfo CallSiteOps_MoveRule =>
s_CallSiteOps_MoveRule ??
(s_CallSiteOps_MoveRule = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.MoveRule))!);
s_CallSiteOps_MoveRule ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.MoveRule))!;
private static MethodInfo? s_CallSiteOps_Bind;
public static MethodInfo CallSiteOps_Bind =>
s_CallSiteOps_Bind ??
(s_CallSiteOps_Bind = typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.Bind))!);
s_CallSiteOps_Bind ??= typeof(CallSiteOps).GetMethod(nameof(CallSiteOps.Bind))!;
private static MethodInfo? s_DynamicObject_TryGetMember;
public static MethodInfo DynamicObject_TryGetMember =>
s_DynamicObject_TryGetMember ??
(s_DynamicObject_TryGetMember = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryGetMember))!);
s_DynamicObject_TryGetMember ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryGetMember))!;
private static MethodInfo? s_DynamicObject_TrySetMember;
public static MethodInfo DynamicObject_TrySetMember =>
s_DynamicObject_TrySetMember ??
(s_DynamicObject_TrySetMember = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TrySetMember))!);
s_DynamicObject_TrySetMember ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TrySetMember))!;
private static MethodInfo? s_DynamicObject_TryDeleteMember;
public static MethodInfo DynamicObject_TryDeleteMember =>
s_DynamicObject_TryDeleteMember ??
(s_DynamicObject_TryDeleteMember = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryDeleteMember))!);
s_DynamicObject_TryDeleteMember ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryDeleteMember))!;
private static MethodInfo? s_DynamicObject_TryGetIndex;
public static MethodInfo DynamicObject_TryGetIndex =>
s_DynamicObject_TryGetIndex ??
(s_DynamicObject_TryGetIndex = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryGetIndex))!);
s_DynamicObject_TryGetIndex ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryGetIndex))!;
private static MethodInfo? s_DynamicObject_TrySetIndex;
public static MethodInfo DynamicObject_TrySetIndex =>
s_DynamicObject_TrySetIndex ??
(s_DynamicObject_TrySetIndex = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TrySetIndex))!);
s_DynamicObject_TrySetIndex ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TrySetIndex))!;
private static MethodInfo? s_DynamicObject_TryDeleteIndex;
public static MethodInfo DynamicObject_TryDeleteIndex =>
s_DynamicObject_TryDeleteIndex ??
(s_DynamicObject_TryDeleteIndex = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryDeleteIndex))!);
s_DynamicObject_TryDeleteIndex ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryDeleteIndex))!;
private static MethodInfo? s_DynamicObject_TryConvert;
public static MethodInfo DynamicObject_TryConvert =>
s_DynamicObject_TryConvert ??
(s_DynamicObject_TryConvert = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryConvert))!);
s_DynamicObject_TryConvert ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryConvert))!;
private static MethodInfo? s_DynamicObject_TryInvoke;
public static MethodInfo DynamicObject_TryInvoke =>
s_DynamicObject_TryInvoke ??
(s_DynamicObject_TryInvoke = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryInvoke))!);
s_DynamicObject_TryInvoke ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryInvoke))!;
private static MethodInfo? s_DynamicObject_TryInvokeMember;
public static MethodInfo DynamicObject_TryInvokeMember =>
s_DynamicObject_TryInvokeMember ??
(s_DynamicObject_TryInvokeMember = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryInvokeMember))!);
s_DynamicObject_TryInvokeMember ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryInvokeMember))!;
private static MethodInfo? s_DynamicObject_TryBinaryOperation;
public static MethodInfo DynamicObject_TryBinaryOperation =>
s_DynamicObject_TryBinaryOperation ??
(s_DynamicObject_TryBinaryOperation = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryBinaryOperation))!);
s_DynamicObject_TryBinaryOperation ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryBinaryOperation))!;
private static MethodInfo? s_DynamicObject_TryUnaryOperation;
public static MethodInfo DynamicObject_TryUnaryOperation =>
s_DynamicObject_TryUnaryOperation ??
(s_DynamicObject_TryUnaryOperation = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryUnaryOperation))!);
s_DynamicObject_TryUnaryOperation ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryUnaryOperation))!;
private static MethodInfo? s_DynamicObject_TryCreateInstance;
public static MethodInfo DynamicObject_TryCreateInstance =>
s_DynamicObject_TryCreateInstance ??
(s_DynamicObject_TryCreateInstance = typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryCreateInstance))!);
s_DynamicObject_TryCreateInstance ??= typeof(DynamicObject).GetMethod(nameof(DynamicObject.TryCreateInstance))!;
}
}

View file

@ -12,186 +12,155 @@ namespace System.Linq.Expressions
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) })!);
=> 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) })!);
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) })!);
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) })!);
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) })!);
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) })!);
s_Decimal_Ctor_Int32_Int32_Int32_Bool_Byte ??= typeof(decimal).GetConstructor(new[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) })!;
private static FieldInfo? s_Decimal_One;
public static FieldInfo Decimal_One
=> s_Decimal_One ?? (s_Decimal_One = typeof(decimal).GetField(nameof(decimal.One))!);
public static FieldInfo Decimal_One =>
s_Decimal_One ??= typeof(decimal).GetField(nameof(decimal.One))!;
private static FieldInfo? s_Decimal_MinusOne;
public static FieldInfo Decimal_MinusOne
=> s_Decimal_MinusOne ?? (s_Decimal_MinusOne = typeof(decimal).GetField(nameof(decimal.MinusOne))!);
public static FieldInfo Decimal_MinusOne =>
s_Decimal_MinusOne ??= typeof(decimal).GetField(nameof(decimal.MinusOne))!;
private static FieldInfo? s_Decimal_MinValue;
public static FieldInfo Decimal_MinValue
=> s_Decimal_MinValue ?? (s_Decimal_MinValue = typeof(decimal).GetField(nameof(decimal.MinValue))!);
public static FieldInfo 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))!);
public static FieldInfo 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))!);
public static FieldInfo 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))!);
public static FieldInfo DateTime_MinValue =>
s_DateTime_MinValue ??= typeof(DateTime).GetField(nameof(DateTime.MinValue))!;
private static MethodInfo? s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle;
public static MethodInfo MethodBase_GetMethodFromHandle_RuntimeMethodHandle =>
s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle ??
(s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle = typeof(MethodBase).GetMethod(nameof(MethodBase.GetMethodFromHandle), new[] { typeof(RuntimeMethodHandle) })!);
s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle ??= typeof(MethodBase).GetMethod(nameof(MethodBase.GetMethodFromHandle), new[] { typeof(RuntimeMethodHandle) })!;
private static MethodInfo? s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle_RuntimeTypeHandle;
public static MethodInfo MethodBase_GetMethodFromHandle_RuntimeMethodHandle_RuntimeTypeHandle =>
s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle_RuntimeTypeHandle ??
(s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle_RuntimeTypeHandle = typeof(MethodBase).GetMethod(nameof(MethodBase.GetMethodFromHandle), new[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) })!);
s_MethodBase_GetMethodFromHandle_RuntimeMethodHandle_RuntimeTypeHandle ??= typeof(MethodBase).GetMethod(nameof(MethodBase.GetMethodFromHandle), new[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) })!;
private static MethodInfo? s_MethodInfo_CreateDelegate_Type_Object;
public static MethodInfo MethodInfo_CreateDelegate_Type_Object =>
s_MethodInfo_CreateDelegate_Type_Object ??
(s_MethodInfo_CreateDelegate_Type_Object = typeof(MethodInfo).GetMethod(nameof(MethodInfo.CreateDelegate), new[] { typeof(Type), typeof(object) })!);
s_MethodInfo_CreateDelegate_Type_Object ??= typeof(MethodInfo).GetMethod(nameof(MethodInfo.CreateDelegate), new[] { typeof(Type), typeof(object) })!;
private static MethodInfo? s_String_op_Equality_String_String;
public static MethodInfo String_op_Equality_String_String =>
s_String_op_Equality_String_String ??
(s_String_op_Equality_String_String = typeof(string).GetMethod("op_Equality", new[] { typeof(string), typeof(string) })!);
s_String_op_Equality_String_String ??= typeof(string).GetMethod("op_Equality", new[] { typeof(string), typeof(string) })!;
private static MethodInfo? s_String_Equals_String_String;
public static MethodInfo String_Equals_String_String =>
s_String_Equals_String_String ??
(s_String_Equals_String_String = typeof(string).GetMethod("Equals", new[] { typeof(string), typeof(string) })!);
s_String_Equals_String_String ??= typeof(string).GetMethod("Equals", new[] { typeof(string), typeof(string) })!;
private static MethodInfo? s_DictionaryOfStringInt32_Add_String_Int32;
public static MethodInfo DictionaryOfStringInt32_Add_String_Int32 =>
s_DictionaryOfStringInt32_Add_String_Int32 ??
(s_DictionaryOfStringInt32_Add_String_Int32 = typeof(Dictionary<string, int>).GetMethod(nameof(Dictionary<string, int>.Add), new[] { typeof(string), typeof(int) })!);
s_DictionaryOfStringInt32_Add_String_Int32 ??= typeof(Dictionary<string, int>).GetMethod(nameof(Dictionary<string, int>.Add), new[] { typeof(string), typeof(int) })!;
private static ConstructorInfo? s_DictionaryOfStringInt32_Ctor_Int32;
public static ConstructorInfo DictionaryOfStringInt32_Ctor_Int32 =>
s_DictionaryOfStringInt32_Ctor_Int32 ??
(s_DictionaryOfStringInt32_Ctor_Int32 = typeof(Dictionary<string, int>).GetConstructor(new[] { typeof(int) })!);
s_DictionaryOfStringInt32_Ctor_Int32 ??= typeof(Dictionary<string, int>).GetConstructor(new[] { typeof(int) })!;
private static MethodInfo? s_Type_GetTypeFromHandle;
public static MethodInfo Type_GetTypeFromHandle =>
s_Type_GetTypeFromHandle ??
(s_Type_GetTypeFromHandle = typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle))!);
s_Type_GetTypeFromHandle ??= typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle))!;
private static MethodInfo? s_Object_GetType;
public static MethodInfo Object_GetType =>
s_Object_GetType ??
(s_Object_GetType = typeof(object).GetMethod(nameof(object.GetType))!);
s_Object_GetType ??= typeof(object).GetMethod(nameof(object.GetType))!;
private static MethodInfo? s_Decimal_op_Implicit_Byte;
public static MethodInfo Decimal_op_Implicit_Byte =>
s_Decimal_op_Implicit_Byte ??
(s_Decimal_op_Implicit_Byte = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(byte) })!);
s_Decimal_op_Implicit_Byte ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(byte) })!;
private static MethodInfo? s_Decimal_op_Implicit_SByte;
public static MethodInfo Decimal_op_Implicit_SByte =>
s_Decimal_op_Implicit_SByte ??
(s_Decimal_op_Implicit_SByte = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(sbyte) })!);
s_Decimal_op_Implicit_SByte ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(sbyte) })!;
private static MethodInfo? s_Decimal_op_Implicit_Int16;
public static MethodInfo Decimal_op_Implicit_Int16 =>
s_Decimal_op_Implicit_Int16 ??
(s_Decimal_op_Implicit_Int16 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(short) })!);
s_Decimal_op_Implicit_Int16 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(short) })!;
private static MethodInfo? s_Decimal_op_Implicit_UInt16;
public static MethodInfo Decimal_op_Implicit_UInt16 =>
s_Decimal_op_Implicit_UInt16 ??
(s_Decimal_op_Implicit_UInt16 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(ushort) })!);
s_Decimal_op_Implicit_UInt16 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(ushort) })!;
private static MethodInfo? s_Decimal_op_Implicit_Int32;
public static MethodInfo Decimal_op_Implicit_Int32 =>
s_Decimal_op_Implicit_Int32 ??
(s_Decimal_op_Implicit_Int32 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(int) })!);
s_Decimal_op_Implicit_Int32 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(int) })!;
private static MethodInfo? s_Decimal_op_Implicit_UInt32;
public static MethodInfo Decimal_op_Implicit_UInt32 =>
s_Decimal_op_Implicit_UInt32 ??
(s_Decimal_op_Implicit_UInt32 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(uint) })!);
s_Decimal_op_Implicit_UInt32 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(uint) })!;
private static MethodInfo? s_Decimal_op_Implicit_Int64;
public static MethodInfo Decimal_op_Implicit_Int64 =>
s_Decimal_op_Implicit_Int64 ??
(s_Decimal_op_Implicit_Int64 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(long) })!);
s_Decimal_op_Implicit_Int64 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(long) })!;
private static MethodInfo? s_Decimal_op_Implicit_UInt64;
public static MethodInfo Decimal_op_Implicit_UInt64 =>
s_Decimal_op_Implicit_UInt64 ??
(s_Decimal_op_Implicit_UInt64 = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(ulong) })!);
s_Decimal_op_Implicit_UInt64 ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(ulong) })!;
private static MethodInfo? s_Decimal_op_Implicit_Char;
public static MethodInfo Decimal_op_Implicit_Char =>
s_Decimal_op_Implicit_Char ??
(s_Decimal_op_Implicit_Char = typeof(decimal).GetMethod("op_Implicit", new[] { typeof(char) })!);
s_Decimal_op_Implicit_Char ??= typeof(decimal).GetMethod("op_Implicit", new[] { typeof(char) })!;
private static MethodInfo? s_Math_Pow_Double_Double;
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) })!);
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.
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[]) })!);
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))!);
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))!);
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[]) })!);
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)!);
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))!);
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))!);
s_RuntimeOps_Quote ??= typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.Quote))!;
}
}

View file

@ -165,14 +165,14 @@ namespace System.Linq.Expressions.Interpreter
Debug.Assert(type.IsArithmetic());
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new AddInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new AddInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new AddInt64()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new AddUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new AddUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new AddUInt64()),
TypeCode.Single => s_Single ?? (s_Single = new AddSingle()),
TypeCode.Double => s_Double ?? (s_Double = new AddDouble()),
TypeCode.Int16 => s_Int16 ??= new AddInt16(),
TypeCode.Int32 => s_Int32 ??= new AddInt32(),
TypeCode.Int64 => s_Int64 ??= new AddInt64(),
TypeCode.UInt16 => s_UInt16 ??= new AddUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new AddUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new AddUInt64(),
TypeCode.Single => s_Single ??= new AddSingle(),
TypeCode.Double => s_Double ??= new AddDouble(),
_ => throw ContractUtils.Unreachable,
};
}
@ -301,12 +301,12 @@ namespace System.Linq.Expressions.Interpreter
Debug.Assert(type.IsArithmetic());
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new AddOvfInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new AddOvfInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new AddOvfInt64()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new AddOvfUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new AddOvfUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new AddOvfUInt64()),
TypeCode.Int16 => s_Int16 ??= new AddOvfInt16(),
TypeCode.Int32 => s_Int32 ??= new AddOvfInt32(),
TypeCode.Int64 => s_Int64 ??= new AddOvfInt64(),
TypeCode.UInt16 => s_UInt16 ??= new AddOvfUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new AddOvfUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new AddOvfUInt64(),
_ => AddInstruction.Create(type),
};
}

View file

@ -174,15 +174,15 @@ namespace System.Linq.Expressions.Interpreter
public static Instruction Create(Type type) =>
type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new AndSByte()),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new AndInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new AndInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new AndInt64()),
TypeCode.Byte => s_Byte ?? (s_Byte = new AndByte()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new AndUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new AndUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new AndUInt64()),
TypeCode.Boolean => s_Boolean ?? (s_Boolean = new AndBoolean()),
TypeCode.SByte => s_SByte ??= new AndSByte(),
TypeCode.Int16 => s_Int16 ??= new AndInt16(),
TypeCode.Int32 => s_Int32 ??= new AndInt32(),
TypeCode.Int64 => s_Int64 ??= new AndInt64(),
TypeCode.Byte => s_Byte ??= new AndByte(),
TypeCode.UInt16 => s_UInt16 ??= new AndUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new AndUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new AndUInt64(),
TypeCode.Boolean => s_Boolean ??= new AndBoolean(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -157,14 +157,14 @@ namespace System.Linq.Expressions.Interpreter
Debug.Assert(!type.IsEnum);
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new DecrementInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new DecrementInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new DecrementInt64()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new DecrementUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new DecrementUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new DecrementUInt64()),
TypeCode.Single => s_Single ?? (s_Single = new DecrementSingle()),
TypeCode.Double => s_Double ?? (s_Double = new DecrementDouble()),
TypeCode.Int16 => s_Int16 ??= new DecrementInt16(),
TypeCode.Int32 => s_Int32 ??= new DecrementInt32(),
TypeCode.Int64 => s_Int64 ??= new DecrementInt64(),
TypeCode.UInt16 => s_UInt16 ??= new DecrementUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new DecrementUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new DecrementUInt64(),
TypeCode.Single => s_Single ??= new DecrementSingle(),
TypeCode.Double => s_Double ??= new DecrementDouble(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -165,14 +165,14 @@ namespace System.Linq.Expressions.Interpreter
Debug.Assert(!type.IsEnum);
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new DivInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new DivInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new DivInt64()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new DivUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new DivUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new DivUInt64()),
TypeCode.Single => s_Single ?? (s_Single = new DivSingle()),
TypeCode.Double => s_Double ?? (s_Double = new DivDouble()),
TypeCode.Int16 => s_Int16 ??= new DivInt16(),
TypeCode.Int32 => s_Int32 ??= new DivInt32(),
TypeCode.Int64 => s_Int64 ??= new DivInt64(),
TypeCode.UInt16 => s_UInt16 ??= new DivUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new DivUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new DivUInt64(),
TypeCode.Single => s_Single ??= new DivSingle(),
TypeCode.Double => s_Double ??= new DivDouble(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -513,42 +513,42 @@ namespace System.Linq.Expressions.Interpreter
{
switch (type.GetNonNullableType().GetTypeCode())
{
case TypeCode.Boolean: return s_BooleanLiftedToNull ?? (s_BooleanLiftedToNull = new EqualBooleanLiftedToNull());
case TypeCode.SByte: return s_SByteLiftedToNull ?? (s_SByteLiftedToNull = new EqualSByteLiftedToNull());
case TypeCode.Int16: return s_Int16LiftedToNull ?? (s_Int16LiftedToNull = new EqualInt16LiftedToNull());
case TypeCode.Char: return s_CharLiftedToNull ?? (s_CharLiftedToNull = new EqualCharLiftedToNull());
case TypeCode.Int32: return s_Int32LiftedToNull ?? (s_Int32LiftedToNull = new EqualInt32LiftedToNull());
case TypeCode.Int64: return s_Int64LiftedToNull ?? (s_Int64LiftedToNull = new EqualInt64LiftedToNull());
case TypeCode.Byte: return s_ByteLiftedToNull ?? (s_ByteLiftedToNull = new EqualByteLiftedToNull());
case TypeCode.UInt16: return s_UInt16LiftedToNull ?? (s_UInt16LiftedToNull = new EqualUInt16LiftedToNull());
case TypeCode.UInt32: return s_UInt32LiftedToNull ?? (s_UInt32LiftedToNull = new EqualUInt32LiftedToNull());
case TypeCode.UInt64: return s_UInt64LiftedToNull ?? (s_UInt64LiftedToNull = new EqualUInt64LiftedToNull());
case TypeCode.Single: return s_SingleLiftedToNull ?? (s_SingleLiftedToNull = new EqualSingleLiftedToNull());
case TypeCode.Boolean: return s_BooleanLiftedToNull ??= new EqualBooleanLiftedToNull();
case TypeCode.SByte: return s_SByteLiftedToNull ??= new EqualSByteLiftedToNull();
case TypeCode.Int16: return s_Int16LiftedToNull ??= new EqualInt16LiftedToNull();
case TypeCode.Char: return s_CharLiftedToNull ??= new EqualCharLiftedToNull();
case TypeCode.Int32: return s_Int32LiftedToNull ??= new EqualInt32LiftedToNull();
case TypeCode.Int64: return s_Int64LiftedToNull ??= new EqualInt64LiftedToNull();
case TypeCode.Byte: return s_ByteLiftedToNull ??= new EqualByteLiftedToNull();
case TypeCode.UInt16: return s_UInt16LiftedToNull ??= new EqualUInt16LiftedToNull();
case TypeCode.UInt32: return s_UInt32LiftedToNull ??= new EqualUInt32LiftedToNull();
case TypeCode.UInt64: return s_UInt64LiftedToNull ??= new EqualUInt64LiftedToNull();
case TypeCode.Single: return s_SingleLiftedToNull ??= new EqualSingleLiftedToNull();
default:
Debug.Assert(type.GetNonNullableType().GetTypeCode() == TypeCode.Double);
return s_DoubleLiftedToNull ?? (s_DoubleLiftedToNull = new EqualDoubleLiftedToNull());
return s_DoubleLiftedToNull ??= new EqualDoubleLiftedToNull();
}
}
else
{
switch (type.GetNonNullableType().GetTypeCode())
{
case TypeCode.Boolean: return s_Boolean ?? (s_Boolean = new EqualBoolean());
case TypeCode.SByte: return s_SByte ?? (s_SByte = new EqualSByte());
case TypeCode.Int16: return s_Int16 ?? (s_Int16 = new EqualInt16());
case TypeCode.Char: return s_Char ?? (s_Char = new EqualChar());
case TypeCode.Int32: return s_Int32 ?? (s_Int32 = new EqualInt32());
case TypeCode.Int64: return s_Int64 ?? (s_Int64 = new EqualInt64());
case TypeCode.Byte: return s_Byte ?? (s_Byte = new EqualByte());
case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new EqualUInt16());
case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new EqualUInt32());
case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new EqualUInt64());
case TypeCode.Single: return s_Single ?? (s_Single = new EqualSingle());
case TypeCode.Double: return s_Double ?? (s_Double = new EqualDouble());
case TypeCode.Boolean: return s_Boolean ??= new EqualBoolean();
case TypeCode.SByte: return s_SByte ??= new EqualSByte();
case TypeCode.Int16: return s_Int16 ??= new EqualInt16();
case TypeCode.Char: return s_Char ??= new EqualChar();
case TypeCode.Int32: return s_Int32 ??= new EqualInt32();
case TypeCode.Int64: return s_Int64 ??= new EqualInt64();
case TypeCode.Byte: return s_Byte ??= new EqualByte();
case TypeCode.UInt16: return s_UInt16 ??= new EqualUInt16();
case TypeCode.UInt32: return s_UInt32 ??= new EqualUInt32();
case TypeCode.UInt64: return s_UInt64 ??= new EqualUInt64();
case TypeCode.Single: return s_Single ??= new EqualSingle();
case TypeCode.Double: return s_Double ??= new EqualDouble();
default:
// Nullable only valid if one operand is constant null, so this assert is slightly too broad.
Debug.Assert(type.IsNullableOrReferenceType());
return s_reference ?? (s_reference = new EqualReference());
return s_reference ??= new EqualReference();
}
}
}

View file

@ -162,15 +162,15 @@ namespace System.Linq.Expressions.Interpreter
public static Instruction Create(Type type) =>
type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new ExclusiveOrSByte()),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new ExclusiveOrInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new ExclusiveOrInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new ExclusiveOrInt64()),
TypeCode.Byte => s_Byte ?? (s_Byte = new ExclusiveOrByte()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new ExclusiveOrUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new ExclusiveOrUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new ExclusiveOrUInt64()),
TypeCode.Boolean => s_Boolean ?? (s_Boolean = new ExclusiveOrBoolean()),
TypeCode.SByte => s_SByte ??= new ExclusiveOrSByte(),
TypeCode.Int16 => s_Int16 ??= new ExclusiveOrInt16(),
TypeCode.Int32 => s_Int32 ??= new ExclusiveOrInt32(),
TypeCode.Int64 => s_Int64 ??= new ExclusiveOrInt64(),
TypeCode.Byte => s_Byte ??= new ExclusiveOrByte(),
TypeCode.UInt16 => s_UInt16 ??= new ExclusiveOrUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new ExclusiveOrUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new ExclusiveOrUInt64(),
TypeCode.Boolean => s_Boolean ??= new ExclusiveOrBoolean(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -281,17 +281,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_liftedToNullSByte ?? (s_liftedToNullSByte = new GreaterThanSByte(null)),
TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanInt16(null)),
TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanChar(null)),
TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanInt32(null)),
TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanInt64(null)),
TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanByte(null)),
TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanUInt16(null)),
TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanUInt32(null)),
TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanUInt64(null)),
TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanSingle(null)),
TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanDouble(null)),
TypeCode.SByte => s_liftedToNullSByte ??= new GreaterThanSByte(null),
TypeCode.Int16 => s_liftedToNullInt16 ??= new GreaterThanInt16(null),
TypeCode.Char => s_liftedToNullChar ??= new GreaterThanChar(null),
TypeCode.Int32 => s_liftedToNullInt32 ??= new GreaterThanInt32(null),
TypeCode.Int64 => s_liftedToNullInt64 ??= new GreaterThanInt64(null),
TypeCode.Byte => s_liftedToNullByte ??= new GreaterThanByte(null),
TypeCode.UInt16 => s_liftedToNullUInt16 ??= new GreaterThanUInt16(null),
TypeCode.UInt32 => s_liftedToNullUInt32 ??= new GreaterThanUInt32(null),
TypeCode.UInt64 => s_liftedToNullUInt64 ??= new GreaterThanUInt64(null),
TypeCode.Single => s_liftedToNullSingle ??= new GreaterThanSingle(null),
TypeCode.Double => s_liftedToNullDouble ??= new GreaterThanDouble(null),
_ => throw ContractUtils.Unreachable,
};
}
@ -299,17 +299,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new GreaterThanSByte(Utils.BoxedFalse)),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new GreaterThanInt16(Utils.BoxedFalse)),
TypeCode.Char => s_Char ?? (s_Char = new GreaterThanChar(Utils.BoxedFalse)),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new GreaterThanInt32(Utils.BoxedFalse)),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new GreaterThanInt64(Utils.BoxedFalse)),
TypeCode.Byte => s_Byte ?? (s_Byte = new GreaterThanByte(Utils.BoxedFalse)),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16(Utils.BoxedFalse)),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32(Utils.BoxedFalse)),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64(Utils.BoxedFalse)),
TypeCode.Single => s_Single ?? (s_Single = new GreaterThanSingle(Utils.BoxedFalse)),
TypeCode.Double => s_Double ?? (s_Double = new GreaterThanDouble(Utils.BoxedFalse)),
TypeCode.SByte => s_SByte ??= new GreaterThanSByte(Utils.BoxedFalse),
TypeCode.Int16 => s_Int16 ??= new GreaterThanInt16(Utils.BoxedFalse),
TypeCode.Char => s_Char ??= new GreaterThanChar(Utils.BoxedFalse),
TypeCode.Int32 => s_Int32 ??= new GreaterThanInt32(Utils.BoxedFalse),
TypeCode.Int64 => s_Int64 ??= new GreaterThanInt64(Utils.BoxedFalse),
TypeCode.Byte => s_Byte ??= new GreaterThanByte(Utils.BoxedFalse),
TypeCode.UInt16 => s_UInt16 ??= new GreaterThanUInt16(Utils.BoxedFalse),
TypeCode.UInt32 => s_UInt32 ??= new GreaterThanUInt32(Utils.BoxedFalse),
TypeCode.UInt64 => s_UInt64 ??= new GreaterThanUInt64(Utils.BoxedFalse),
TypeCode.Single => s_Single ??= new GreaterThanSingle(Utils.BoxedFalse),
TypeCode.Double => s_Double ??= new GreaterThanDouble(Utils.BoxedFalse),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -281,17 +281,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_liftedToNullSByte ?? (s_liftedToNullSByte = new GreaterThanOrEqualSByte(null)),
TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new GreaterThanOrEqualInt16(null)),
TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new GreaterThanOrEqualChar(null)),
TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new GreaterThanOrEqualInt32(null)),
TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new GreaterThanOrEqualInt64(null)),
TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new GreaterThanOrEqualByte(null)),
TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new GreaterThanOrEqualUInt16(null)),
TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new GreaterThanOrEqualUInt32(null)),
TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new GreaterThanOrEqualUInt64(null)),
TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new GreaterThanOrEqualSingle(null)),
TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new GreaterThanOrEqualDouble(null)),
TypeCode.SByte => s_liftedToNullSByte ??= new GreaterThanOrEqualSByte(null),
TypeCode.Int16 => s_liftedToNullInt16 ??= new GreaterThanOrEqualInt16(null),
TypeCode.Char => s_liftedToNullChar ??= new GreaterThanOrEqualChar(null),
TypeCode.Int32 => s_liftedToNullInt32 ??= new GreaterThanOrEqualInt32(null),
TypeCode.Int64 => s_liftedToNullInt64 ??= new GreaterThanOrEqualInt64(null),
TypeCode.Byte => s_liftedToNullByte ??= new GreaterThanOrEqualByte(null),
TypeCode.UInt16 => s_liftedToNullUInt16 ??= new GreaterThanOrEqualUInt16(null),
TypeCode.UInt32 => s_liftedToNullUInt32 ??= new GreaterThanOrEqualUInt32(null),
TypeCode.UInt64 => s_liftedToNullUInt64 ??= new GreaterThanOrEqualUInt64(null),
TypeCode.Single => s_liftedToNullSingle ??= new GreaterThanOrEqualSingle(null),
TypeCode.Double => s_liftedToNullDouble ??= new GreaterThanOrEqualDouble(null),
_ => throw ContractUtils.Unreachable,
};
}
@ -299,17 +299,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new GreaterThanOrEqualSByte(Utils.BoxedFalse)),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new GreaterThanOrEqualInt16(Utils.BoxedFalse)),
TypeCode.Char => s_Char ?? (s_Char = new GreaterThanOrEqualChar(Utils.BoxedFalse)),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new GreaterThanOrEqualInt32(Utils.BoxedFalse)),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new GreaterThanOrEqualInt64(Utils.BoxedFalse)),
TypeCode.Byte => s_Byte ?? (s_Byte = new GreaterThanOrEqualByte(Utils.BoxedFalse)),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new GreaterThanOrEqualUInt16(Utils.BoxedFalse)),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new GreaterThanOrEqualUInt32(Utils.BoxedFalse)),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new GreaterThanOrEqualUInt64(Utils.BoxedFalse)),
TypeCode.Single => s_Single ?? (s_Single = new GreaterThanOrEqualSingle(Utils.BoxedFalse)),
TypeCode.Double => s_Double ?? (s_Double = new GreaterThanOrEqualDouble(Utils.BoxedFalse)),
TypeCode.SByte => s_SByte ??= new GreaterThanOrEqualSByte(Utils.BoxedFalse),
TypeCode.Int16 => s_Int16 ??= new GreaterThanOrEqualInt16(Utils.BoxedFalse),
TypeCode.Char => s_Char ??= new GreaterThanOrEqualChar(Utils.BoxedFalse),
TypeCode.Int32 => s_Int32 ??= new GreaterThanOrEqualInt32(Utils.BoxedFalse),
TypeCode.Int64 => s_Int64 ??= new GreaterThanOrEqualInt64(Utils.BoxedFalse),
TypeCode.Byte => s_Byte ??= new GreaterThanOrEqualByte(Utils.BoxedFalse),
TypeCode.UInt16 => s_UInt16 ??= new GreaterThanOrEqualUInt16(Utils.BoxedFalse),
TypeCode.UInt32 => s_UInt32 ??= new GreaterThanOrEqualUInt32(Utils.BoxedFalse),
TypeCode.UInt64 => s_UInt64 ??= new GreaterThanOrEqualUInt64(Utils.BoxedFalse),
TypeCode.Single => s_Single ??= new GreaterThanOrEqualSingle(Utils.BoxedFalse),
TypeCode.Double => s_Double ??= new GreaterThanOrEqualDouble(Utils.BoxedFalse),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -157,14 +157,14 @@ namespace System.Linq.Expressions.Interpreter
Debug.Assert(!type.IsEnum);
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new IncrementInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new IncrementInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new IncrementInt64()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new IncrementUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new IncrementUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new IncrementUInt64()),
TypeCode.Single => s_Single ?? (s_Single = new IncrementSingle()),
TypeCode.Double => s_Double ?? (s_Double = new IncrementDouble()),
TypeCode.Int16 => s_Int16 ??= new IncrementInt16(),
TypeCode.Int32 => s_Int32 ??= new IncrementInt32(),
TypeCode.Int64 => s_Int64 ??= new IncrementInt64(),
TypeCode.UInt16 => s_UInt16 ??= new IncrementUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new IncrementUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new IncrementUInt64(),
TypeCode.Single => s_Single ??= new IncrementSingle(),
TypeCode.Double => s_Double ??= new IncrementDouble(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -333,11 +333,11 @@ namespace System.Linq.Expressions.Interpreter
{
if (value)
{
Emit(s_true ?? (s_true = new LoadObjectInstruction(Utils.BoxedTrue)));
Emit(s_true ??= new LoadObjectInstruction(Utils.BoxedTrue));
}
else
{
Emit(s_false ?? (s_false = new LoadObjectInstruction(Utils.BoxedFalse)));
Emit(s_false ??= new LoadObjectInstruction(Utils.BoxedFalse));
}
}
@ -345,7 +345,7 @@ namespace System.Linq.Expressions.Interpreter
{
if (value == null)
{
Emit(s_null ?? (s_null = new LoadObjectInstruction(null)));
Emit(s_null ??= new LoadObjectInstruction(null));
return;
}

View file

@ -162,14 +162,14 @@ namespace System.Linq.Expressions.Interpreter
public static Instruction Create(Type type) =>
type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new LeftShiftSByte()),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new LeftShiftInt16()),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new LeftShiftInt32()),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new LeftShiftInt64()),
TypeCode.Byte => s_Byte ?? (s_Byte = new LeftShiftByte()),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new LeftShiftUInt16()),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new LeftShiftUInt32()),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new LeftShiftUInt64()),
TypeCode.SByte => s_SByte ??= new LeftShiftSByte(),
TypeCode.Int16 => s_Int16 ??= new LeftShiftInt16(),
TypeCode.Int32 => s_Int32 ??= new LeftShiftInt32(),
TypeCode.Int64 => s_Int64 ??= new LeftShiftInt64(),
TypeCode.Byte => s_Byte ??= new LeftShiftByte(),
TypeCode.UInt16 => s_UInt16 ??= new LeftShiftUInt16(),
TypeCode.UInt32 => s_UInt32 ??= new LeftShiftUInt32(),
TypeCode.UInt64 => s_UInt64 ??= new LeftShiftUInt64(),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -280,17 +280,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_liftedToNullSByte ?? (s_liftedToNullSByte = new LessThanSByte(null)),
TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new LessThanInt16(null)),
TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new LessThanChar(null)),
TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new LessThanInt32(null)),
TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new LessThanInt64(null)),
TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new LessThanByte(null)),
TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new LessThanUInt16(null)),
TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new LessThanUInt32(null)),
TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new LessThanUInt64(null)),
TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new LessThanSingle(null)),
TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new LessThanDouble(null)),
TypeCode.SByte => s_liftedToNullSByte ??= new LessThanSByte(null),
TypeCode.Int16 => s_liftedToNullInt16 ??= new LessThanInt16(null),
TypeCode.Char => s_liftedToNullChar ??= new LessThanChar(null),
TypeCode.Int32 => s_liftedToNullInt32 ??= new LessThanInt32(null),
TypeCode.Int64 => s_liftedToNullInt64 ??= new LessThanInt64(null),
TypeCode.Byte => s_liftedToNullByte ??= new LessThanByte(null),
TypeCode.UInt16 => s_liftedToNullUInt16 ??= new LessThanUInt16(null),
TypeCode.UInt32 => s_liftedToNullUInt32 ??= new LessThanUInt32(null),
TypeCode.UInt64 => s_liftedToNullUInt64 ??= new LessThanUInt64(null),
TypeCode.Single => s_liftedToNullSingle ??= new LessThanSingle(null),
TypeCode.Double => s_liftedToNullDouble ??= new LessThanDouble(null),
_ => throw ContractUtils.Unreachable,
};
}
@ -298,17 +298,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new LessThanSByte(Utils.BoxedFalse)),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new LessThanInt16(Utils.BoxedFalse)),
TypeCode.Char => s_Char ?? (s_Char = new LessThanChar(Utils.BoxedFalse)),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new LessThanInt32(Utils.BoxedFalse)),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new LessThanInt64(Utils.BoxedFalse)),
TypeCode.Byte => s_Byte ?? (s_Byte = new LessThanByte(Utils.BoxedFalse)),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new LessThanUInt16(Utils.BoxedFalse)),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new LessThanUInt32(Utils.BoxedFalse)),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new LessThanUInt64(Utils.BoxedFalse)),
TypeCode.Single => s_Single ?? (s_Single = new LessThanSingle(Utils.BoxedFalse)),
TypeCode.Double => s_Double ?? (s_Double = new LessThanDouble(Utils.BoxedFalse)),
TypeCode.SByte => s_SByte ??= new LessThanSByte(Utils.BoxedFalse),
TypeCode.Int16 => s_Int16 ??= new LessThanInt16(Utils.BoxedFalse),
TypeCode.Char => s_Char ??= new LessThanChar(Utils.BoxedFalse),
TypeCode.Int32 => s_Int32 ??= new LessThanInt32(Utils.BoxedFalse),
TypeCode.Int64 => s_Int64 ??= new LessThanInt64(Utils.BoxedFalse),
TypeCode.Byte => s_Byte ??= new LessThanByte(Utils.BoxedFalse),
TypeCode.UInt16 => s_UInt16 ??= new LessThanUInt16(Utils.BoxedFalse),
TypeCode.UInt32 => s_UInt32 ??= new LessThanUInt32(Utils.BoxedFalse),
TypeCode.UInt64 => s_UInt64 ??= new LessThanUInt64(Utils.BoxedFalse),
TypeCode.Single => s_Single ??= new LessThanSingle(Utils.BoxedFalse),
TypeCode.Double => s_Double ??= new LessThanDouble(Utils.BoxedFalse),
_ => throw ContractUtils.Unreachable,
};
}

View file

@ -281,17 +281,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_liftedToNullSByte ?? (s_liftedToNullSByte = new LessThanOrEqualSByte(null)),
TypeCode.Int16 => s_liftedToNullInt16 ?? (s_liftedToNullInt16 = new LessThanOrEqualInt16(null)),
TypeCode.Char => s_liftedToNullChar ?? (s_liftedToNullChar = new LessThanOrEqualChar(null)),
TypeCode.Int32 => s_liftedToNullInt32 ?? (s_liftedToNullInt32 = new LessThanOrEqualInt32(null)),
TypeCode.Int64 => s_liftedToNullInt64 ?? (s_liftedToNullInt64 = new LessThanOrEqualInt64(null)),
TypeCode.Byte => s_liftedToNullByte ?? (s_liftedToNullByte = new LessThanOrEqualByte(null)),
TypeCode.UInt16 => s_liftedToNullUInt16 ?? (s_liftedToNullUInt16 = new LessThanOrEqualUInt16(null)),
TypeCode.UInt32 => s_liftedToNullUInt32 ?? (s_liftedToNullUInt32 = new LessThanOrEqualUInt32(null)),
TypeCode.UInt64 => s_liftedToNullUInt64 ?? (s_liftedToNullUInt64 = new LessThanOrEqualUInt64(null)),
TypeCode.Single => s_liftedToNullSingle ?? (s_liftedToNullSingle = new LessThanOrEqualSingle(null)),
TypeCode.Double => s_liftedToNullDouble ?? (s_liftedToNullDouble = new LessThanOrEqualDouble(null)),
TypeCode.SByte => s_liftedToNullSByte ??= new LessThanOrEqualSByte(null),
TypeCode.Int16 => s_liftedToNullInt16 ??= new LessThanOrEqualInt16(null),
TypeCode.Char => s_liftedToNullChar ??= new LessThanOrEqualChar(null),
TypeCode.Int32 => s_liftedToNullInt32 ??= new LessThanOrEqualInt32(null),
TypeCode.Int64 => s_liftedToNullInt64 ??= new LessThanOrEqualInt64(null),
TypeCode.Byte => s_liftedToNullByte ??= new LessThanOrEqualByte(null),
TypeCode.UInt16 => s_liftedToNullUInt16 ??= new LessThanOrEqualUInt16(null),
TypeCode.UInt32 => s_liftedToNullUInt32 ??= new LessThanOrEqualUInt32(null),
TypeCode.UInt64 => s_liftedToNullUInt64 ??= new LessThanOrEqualUInt64(null),
TypeCode.Single => s_liftedToNullSingle ??= new LessThanOrEqualSingle(null),
TypeCode.Double => s_liftedToNullDouble ??= new LessThanOrEqualDouble(null),
_ => throw ContractUtils.Unreachable,
};
}
@ -299,17 +299,17 @@ namespace System.Linq.Expressions.Interpreter
{
return type.GetNonNullableType().GetTypeCode() switch
{
TypeCode.SByte => s_SByte ?? (s_SByte = new LessThanOrEqualSByte(Utils.BoxedFalse)),
TypeCode.Int16 => s_Int16 ?? (s_Int16 = new LessThanOrEqualInt16(Utils.BoxedFalse)),
TypeCode.Char => s_Char ?? (s_Char = new LessThanOrEqualChar(Utils.BoxedFalse)),
TypeCode.Int32 => s_Int32 ?? (s_Int32 = new LessThanOrEqualInt32(Utils.BoxedFalse)),
TypeCode.Int64 => s_Int64 ?? (s_Int64 = new LessThanOrEqualInt64(Utils.BoxedFalse)),
TypeCode.Byte => s_Byte ?? (s_Byte = new LessThanOrEqualByte(Utils.BoxedFalse)),
TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new LessThanOrEqualUInt16(Utils.BoxedFalse)),
TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new LessThanOrEqualUInt32(Utils.BoxedFalse)),
TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new LessThanOrEqualUInt64(Utils.BoxedFalse)),
TypeCode.Single => s_Single ?? (s_Single = new LessThanOrEqualSingle(Utils.BoxedFalse)),
TypeCode.Double => s_Double ?? (s_Double = new LessThanOrEqualDouble(Utils.BoxedFalse)),
TypeCode.SByte => s_SByte ??= new LessThanOrEqualSByte(Utils.BoxedFalse),
TypeCode.Int16 => s_Int16 ??= new LessThanOrEqualInt16(Utils.BoxedFalse),
TypeCode.Char => s_Char ??= new LessThanOrEqualChar(Utils.BoxedFalse),
TypeCode.Int32 => s_Int32 ??= new LessThanOrEqualInt32(Utils.BoxedFalse),
TypeCode.Int64 => s_Int64 ??= new LessThanOrEqualInt64(Utils.BoxedFalse),
TypeCode.Byte => s_Byte ??= new LessThanOrEqualByte(Utils.BoxedFalse),
TypeCode.UInt16 => s_UInt16 ??= new LessThanOrEqualUInt16(Utils.BoxedFalse),
TypeCode.UInt32 => s_UInt32 ??= new LessThanOrEqualUInt32(Utils.BoxedFalse),
TypeCode.UInt64 => s_UInt64 ??= new LessThanOrEqualUInt64(Utils.BoxedFalse),
TypeCode.Single => s_Single ??= new LessThanOrEqualSingle(Utils.BoxedFalse),
TypeCode.Double => s_Double ??= new LessThanOrEqualDouble(Utils.BoxedFalse),
_ => throw ContractUtils.Unreachable,
};
}

Some files were not shown because too many files have changed in this diff Show more