Browse Source

applied fixer for drect assignment from null

pull/3287/head
apmoskevitz 9 months ago
parent
commit
ef8e709ecc
  1. 3
      .editorconfig
  2. 16
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  3. 54
      ICSharpCode.Decompiler/CSharp/CallBuilder.cs
  4. 26
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  5. 2
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpAmbience.cs
  6. 16
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  7. 10
      ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertMissingTokensDecorator.cs
  8. 10
      ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertParenthesesVisitor.cs
  9. 6
      ICSharpCode.Decompiler/CSharp/ProjectDecompiler/TargetServices.cs
  10. 6
      ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs
  11. 14
      ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs
  12. 4
      ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs
  13. 28
      ICSharpCode.Decompiler/CSharp/Resolver/CSharpConversions.cs
  14. 8
      ICSharpCode.Decompiler/CSharp/Resolver/CSharpInvocationResolveResult.cs
  15. 64
      ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
  16. 2
      ICSharpCode.Decompiler/CSharp/Resolver/DynamicInvocationResolveResult.cs
  17. 30
      ICSharpCode.Decompiler/CSharp/Resolver/MemberLookup.cs
  18. 6
      ICSharpCode.Decompiler/CSharp/Resolver/MethodGroupResolveResult.cs
  19. 34
      ICSharpCode.Decompiler/CSharp/Resolver/OverloadResolution.cs
  20. 48
      ICSharpCode.Decompiler/CSharp/Resolver/TypeInference.cs
  21. 16
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs
  22. 6
      ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs
  23. 6
      ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs
  24. 2
      ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs
  25. 2
      ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs
  26. 6
      ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs
  27. 2
      ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs
  28. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs
  29. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs
  30. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs
  31. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs
  32. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs
  33. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs
  34. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs
  35. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs
  36. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs
  37. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs
  38. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs
  39. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs
  40. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs
  41. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs
  42. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs
  43. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs
  44. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs
  45. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs
  46. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs
  47. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs
  48. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs
  49. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs
  50. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs
  51. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs
  52. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs
  53. 20
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs
  54. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs
  55. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs
  56. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs
  57. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs
  58. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs
  59. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs
  60. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs
  61. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs
  62. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs
  63. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs
  64. 2
      ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs
  65. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs
  66. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs
  67. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs
  68. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs
  69. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs
  70. 4
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs
  71. 8
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs
  72. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs
  73. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs
  74. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs
  75. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs
  76. 18
      ICSharpCode.Decompiler/CSharp/Syntax/IAnnotatable.cs
  77. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs
  78. 2
      ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs
  79. 2
      ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs
  80. 8
      ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs
  81. 2
      ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/AnyNode.cs
  82. 2
      ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/AnyNodeOrNull.cs
  83. 4
      ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs
  84. 4
      ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs
  85. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs
  86. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs
  87. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs
  88. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs
  89. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs
  90. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs
  91. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs
  92. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs
  93. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs
  94. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs
  95. 6
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs
  96. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs
  97. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs
  98. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs
  99. 2
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs
  100. 6
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs
  101. Some files were not shown because too many files have changed in this diff Show More

3
.editorconfig

@ -147,3 +147,6 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols @@ -147,3 +147,6 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols
# MEF006: No importing constructor
dotnet_diagnostic.MEF006.severity = silent
dotnet_diagnostic.IDE2003.severity = silent

16
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -406,7 +406,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -406,7 +406,7 @@ namespace ICSharpCode.Decompiler.CSharp
static readonly Regex automaticPropertyBackingFieldRegex = new Regex(@"^<(.*)>k__BackingField$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
static bool IsAutomaticPropertyBackingField(FieldDefinition field, MetadataReader metadata, out string propertyName)
static bool IsAutomaticPropertyBackingField(FieldDefinition field, MetadataReader metadata, out string? propertyName)
{
propertyName = null;
var name = metadata.GetString(field.Name);
@ -631,8 +631,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -631,8 +631,8 @@ namespace ICSharpCode.Decompiler.CSharp
void DoDecompileTypes(IEnumerable<TypeDefinitionHandle> types, DecompileRun decompileRun, ITypeResolveContext decompilationContext, SyntaxTree syntaxTree)
{
string currentNamespace = null;
AstNode groupNode = null;
string? currentNamespace = null;
AstNode? groupNode = null;
foreach (var typeDefHandle in types)
{
var typeDef = module.GetDefinition(typeDefHandle);
@ -1027,7 +1027,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1027,7 +1027,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
bool first = true;
ITypeDefinition parentTypeDef = null;
ITypeDefinition? parentTypeDef = null;
foreach (var entity in definitions)
{
@ -1315,7 +1315,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1315,7 +1315,7 @@ namespace ICSharpCode.Decompiler.CSharp
TypeKind.Struct => (settings.RecordStructs && typeDef.IsRecord) || settings.UsePrimaryConstructorSyntaxForNonRecordTypes,
_ => false,
};
RecordDecompiler recordDecompiler = isRecordLike ? new RecordDecompiler(typeSystem, typeDef, settings, CancellationToken) : null;
RecordDecompiler? recordDecompiler = isRecordLike ? new RecordDecompiler(typeSystem, typeDef, settings, CancellationToken) : null;
if (recordDecompiler != null)
decompileRun.RecordDecompilers.Add(typeDef, recordDecompiler);
@ -1779,7 +1779,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1779,7 +1779,7 @@ namespace ICSharpCode.Decompiler.CSharp
);
body = statementBuilder.ConvertAsBlock(function.Body);
Comment prev = null;
Comment? prev = null;
foreach (string warning in function.Warnings)
{
body.InsertChildAfter(prev, prev = new Comment(warning), Roles.Comment);
@ -1916,7 +1916,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1916,7 +1916,7 @@ namespace ICSharpCode.Decompiler.CSharp
return found;
}
bool FindAttribute(EntityDeclaration entityDecl, KnownAttribute attributeType, out Syntax.Attribute attribute)
bool FindAttribute(EntityDeclaration entityDecl, KnownAttribute attributeType, out Syntax.Attribute? attribute)
{
attribute = null;
foreach (var section in entityDecl.Attributes)
@ -2016,7 +2016,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2016,7 +2016,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
internal static bool IsFixedField(IField field, out IType type, out int elementCount)
internal static bool IsFixedField(IField field, out IType? type, out int elementCount)
{
type = null;
elementCount = 0;

54
ICSharpCode.Decompiler/CSharp/CallBuilder.cs

@ -20,6 +20,7 @@ using System; @@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
@ -47,7 +48,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -47,7 +48,7 @@ namespace ICSharpCode.Decompiler.CSharp
public TranslatedExpression[] Arguments;
public IParameter[] ExpectedParameters;
public string[] ParameterNames;
public string[] ArgumentNames;
public string[]? ArgumentNames;
public int FirstOptionalArgumentIndex;
public BitSet IsPrimitiveValue;
public IReadOnlyList<int> ArgumentToParameterMap;
@ -146,7 +147,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -146,7 +147,7 @@ namespace ICSharpCode.Decompiler.CSharp
{
for (int i = 0; i < Arguments.Length; i++)
{
string inferredName;
string? inferredName;
switch (Arguments[i].Expression)
{
case IdentifierExpression identifier:
@ -188,13 +189,13 @@ namespace ICSharpCode.Decompiler.CSharp @@ -188,13 +189,13 @@ namespace ICSharpCode.Decompiler.CSharp
this.typeSystem = typeSystem;
}
public TranslatedExpression Build(CallInstruction inst, IType typeHint = null)
public TranslatedExpression Build(CallInstruction inst, IType? typeHint = null)
{
if (inst is NewObj newobj && IL.Transforms.DelegateConstruction.MatchDelegateConstruction(newobj, out _, out _, out _))
{
return HandleDelegateConstruction(newobj);
}
if (settings.TupleTypes && TupleTransform.MatchTupleConstruction(inst as NewObj, out var tupleElements) && tupleElements.Length >= 2)
if (settings.TupleTypes && TupleTransform.MatchTupleConstruction(inst as NewObj, out var tupleElements) && tupleElements?.Length >= 2)
{
var elementTypes = TupleType.GetTupleElementTypes(inst.Method.DeclaringType);
var elementNames = typeHint is TupleType tt ? tt.ElementNames : default;
@ -247,7 +248,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -247,7 +248,8 @@ namespace ICSharpCode.Decompiler.CSharp
return result;
}
static bool IsSpanBasedStringConcat(CallInstruction call, out List<(ILInstruction, KnownTypeCode)> operands)
static bool IsSpanBasedStringConcat(CallInstruction call, [NotNullWhen(true)] out List<(ILInstruction, KnownTypeCode)>? operands)
{
operands = null;
@ -313,8 +315,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -313,8 +315,8 @@ namespace ICSharpCode.Decompiler.CSharp
public ExpressionWithResolveResult Build(OpCode callOpCode, IMethod method,
IReadOnlyList<ILInstruction> callArguments,
IReadOnlyList<int> argumentToParameterMap = null,
IType constrainedTo = null)
IReadOnlyList<int>? argumentToParameterMap = null,
IType? constrainedTo = null)
{
if (method.IsExplicitInterfaceImplementation && callOpCode == OpCode.Call)
{
@ -332,7 +334,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -332,7 +334,7 @@ namespace ICSharpCode.Decompiler.CSharp
var expectedTargetDetails = new ExpectedTargetDetails {
CallOpCode = callOpCode
};
ILFunction localFunction = null;
ILFunction? localFunction = null;
if (method.IsLocalFunction)
{
localFunction = expressionBuilder.ResolveLocalFunction(method);
@ -523,7 +525,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -523,7 +525,7 @@ namespace ICSharpCode.Decompiler.CSharp
private ExpressionWithResolveResult HandleStringInterpolation(IMethod method, ArgumentList argumentList)
{
if (!TryGetStringInterpolationTokens(argumentList, out string format, out var tokens))
if (!TryGetStringInterpolationTokens(argumentList, out string? format, out var tokens))
return default;
var arguments = argumentList.Arguments;
@ -543,7 +545,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -543,7 +545,7 @@ namespace ICSharpCode.Decompiler.CSharp
argument = new TranslatedExpression(element, arrayCreationRR.InitializerElements.First());
}
if (tokens.Count == 0)
if (tokens == null || tokens.Count == 0)
{
return default;
}
@ -655,7 +657,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -655,7 +657,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
public ExpressionWithResolveResult BuildDictionaryInitializerExpression(OpCode callOpCode, IMethod method,
InitializedObjectResolveResult target, IReadOnlyList<ILInstruction> indices, ILInstruction value = null)
InitializedObjectResolveResult target, IReadOnlyList<ILInstruction> indices, ILInstruction? value = null)
{
if (method is null)
throw new ArgumentNullException(nameof(method));
@ -696,7 +698,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -696,7 +698,7 @@ namespace ICSharpCode.Decompiler.CSharp
);
}
private bool TryGetStringInterpolationTokens(ArgumentList argumentList, out string format, out List<(TokenKind Kind, int Index, int Alignment, string Format)> tokens)
private bool TryGetStringInterpolationTokens(ArgumentList argumentList, out string? format, out List<(TokenKind Kind, int Index, int Alignment, string? Format)>? tokens)
{
tokens = null;
format = null;
@ -707,7 +709,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -707,7 +709,7 @@ namespace ICSharpCode.Decompiler.CSharp
return false;
if (!arguments.Skip(1).All(a => !a.Expression.DescendantsAndSelf.OfType<PrimitiveExpression>().Any(p => p.Value is string)))
return false;
tokens = new List<(TokenKind Kind, int Index, int Alignment, string Format)>();
tokens = new List<(TokenKind Kind, int Index, int Alignment, string? Format)>();
int i = 0;
format = (string)crr.ConstantValue;
foreach (var (kind, data) in TokenizeFormatString(format))
@ -867,14 +869,14 @@ namespace ICSharpCode.Decompiler.CSharp @@ -867,14 +869,14 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
private ArgumentList BuildArgumentList(ExpectedTargetDetails expectedTargetDetails, ResolveResult target, IMethod method,
int firstParamIndex, IReadOnlyList<ILInstruction> callArguments, IReadOnlyList<int> argumentToParameterMap)
private ArgumentList BuildArgumentList(ExpectedTargetDetails expectedTargetDetails, ResolveResult? target, IMethod method,
int firstParamIndex, IReadOnlyList<ILInstruction> callArguments, IReadOnlyList<int>? argumentToParameterMap)
{
ArgumentList list = new ArgumentList();
// Translate arguments to the expected parameter types
var arguments = new List<TranslatedExpression>(method.Parameters.Count);
string[] argumentNames = null;
string[]? argumentNames = null;
Debug.Assert(callArguments.Count == firstParamIndex + method.Parameters.Count);
var expectedParameters = new List<IParameter>(method.Parameters.Count); // parameters, but in argument order
bool isExpandedForm = false;
@ -978,11 +980,11 @@ namespace ICSharpCode.Decompiler.CSharp @@ -978,11 +980,11 @@ namespace ICSharpCode.Decompiler.CSharp
return p.Type.IsKnownType(KnownTypeCode.Boolean);
}
private bool TransformParamsArgument(ExpectedTargetDetails expectedTargetDetails, ResolveResult targetResolveResult,
private bool TransformParamsArgument(ExpectedTargetDetails expectedTargetDetails, ResolveResult? targetResolveResult,
IMethod method, IParameter parameter, TranslatedExpression arg, ref List<IParameter> expectedParameters,
ref List<TranslatedExpression> arguments)
{
if (CheckArgument(out int length, out IType elementType))
if (CheckArgument(out int length, out IType? elementType))
{
var expandedParameters = new List<IParameter>(expectedParameters);
var expandedArguments = new List<TranslatedExpression>(arguments);
@ -1010,7 +1012,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1010,7 +1012,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
return false;
bool CheckArgument(out int len, out IType t)
bool CheckArgument(out int len, [NotNullWhen(true)] out IType? t)
{
len = 0;
t = null;
@ -1069,7 +1071,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1069,7 +1071,7 @@ namespace ICSharpCode.Decompiler.CSharp
// initialize requireTarget flag
bool requireTarget;
ResolveResult targetResolveResult;
ResolveResult? targetResolveResult;
if ((allowedTransforms & CallTransformation.RequireTarget) != 0)
{
if (settings.AlwaysQualifyMemberReferences || expressionBuilder.HidesVariableWithName(method.Name))
@ -1394,8 +1396,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1394,8 +1396,8 @@ namespace ICSharpCode.Decompiler.CSharp
OverloadResolutionErrors IsUnambiguousCall(ExpectedTargetDetails expectedTargetDetails, IMethod method,
ResolveResult target, IType[] typeArguments, ResolveResult[] arguments,
string[] argumentNames, int firstOptionalArgumentIndex,
out IParameterizedMember foundMember, out bool bestCandidateIsExpandedForm)
string[]? argumentNames, int firstOptionalArgumentIndex,
out IParameterizedMember? foundMember, out bool bestCandidateIsExpandedForm)
{
foundMember = null;
bestCandidateIsExpandedForm = false;
@ -1504,7 +1506,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1504,7 +1506,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
bool IsUnambiguousAccess(ExpectedTargetDetails expectedTargetDetails, ResolveResult target, IMethod method,
IList<TranslatedExpression> arguments, string[] argumentNames, out IMember foundMember)
IList<TranslatedExpression> arguments, string[] argumentNames, out IMember? foundMember)
{
Log.WriteLine("IsUnambiguousAccess: Performing overload resolution for " + method);
Log.WriteCollection(" Arguments: ", arguments.Select(a => a.ResolveResult));
@ -1551,7 +1553,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1551,7 +1553,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
ExpressionWithResolveResult HandleAccessorCall(ExpectedTargetDetails expectedTargetDetails, IMethod method,
TranslatedExpression target, List<TranslatedExpression> arguments, string[] argumentNames)
TranslatedExpression target, List<TranslatedExpression> arguments, string[]? argumentNames)
{
bool requireTarget;
if (settings.AlwaysQualifyMemberReferences || method.AccessorOwner.SymbolKind == SymbolKind.Indexer || expressionBuilder.HidesVariableWithName(method.AccessorOwner.Name))
@ -1715,7 +1717,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1715,7 +1717,7 @@ namespace ICSharpCode.Decompiler.CSharp
CastArguments(argumentList.Arguments, argumentList.ExpectedParameters);
break; // make sure that we don't not end up in an infinite loop
}
IType returnTypeOverride = null;
IType? returnTypeOverride = null;
if (typeSystem.MainModule.TypeSystemOptions.HasFlag(TypeSystemOptions.NativeIntegersWithoutAttribute))
{
// For DeclaringType, we don't use nint/nuint (so that DeclaringType.GetConstructors etc. works),
@ -1932,7 +1934,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1932,7 +1934,7 @@ namespace ICSharpCode.Decompiler.CSharp
bool targetCasted = false;
bool addTypeArguments = false;
// Initial inputs for IsUnambiguousMethodReference:
ResolveResult targetResolveResult = targetAdded ? target.ResolveResult : null;
ResolveResult? targetResolveResult = targetAdded ? target.ResolveResult : null;
IReadOnlyList<IType> typeArguments = EmptyList<IType>.Instance;
// Find somewhat minimal solution:
ResolveResult result;

26
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -153,7 +153,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -153,7 +153,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
public TranslatedExpression Translate(ILInstruction inst, IType typeHint = null)
public TranslatedExpression Translate(ILInstruction inst, IType? typeHint = null)
{
Debug.Assert(inst != null);
cancellationToken.ThrowIfCancellationRequested();
@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.CSharp
return !(target.Expression is ThisReferenceExpression || target.Expression is BaseReferenceExpression);
}
ExpressionWithResolveResult ConvertField(IField field, ILInstruction targetInstruction = null)
ExpressionWithResolveResult ConvertField(IField field, ILInstruction? targetInstruction = null)
{
var target = TranslateTarget(targetInstruction,
nonVirtualInvocation: true,
@ -328,7 +328,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -328,7 +328,7 @@ namespace ICSharpCode.Decompiler.CSharp
return result == null || result.IsError || !result.Member.Equals(field, NormalizeTypeVisitor.TypeErasure);
}
MemberResolveResult mrr;
MemberResolveResult? mrr;
while (IsAmbiguousAccess(out mrr))
{
if (!requireTarget)
@ -486,7 +486,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -486,7 +486,7 @@ namespace ICSharpCode.Decompiler.CSharp
StackAllocExpression TranslateLocAlloc(LocAlloc inst, IType typeHint, out IType elementType)
{
TranslatedExpression countExpression;
PointerType pointerType;
PointerType? pointerType;
if (inst.Argument.MatchBinaryNumericInstruction(BinaryNumericOperator.Mul, out var left, out var right)
&& right.UnwrapConv(ConversionKind.SignExtend).UnwrapConv(ConversionKind.ZeroExtend).MatchSizeOf(out elementType))
{
@ -638,7 +638,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -638,7 +638,7 @@ namespace ICSharpCode.Decompiler.CSharp
{
Expression expr;
IType constantType;
object constantValue;
object? constantValue;
if (type.IsReferenceType == true || type.IsKnownType(KnownTypeCode.NullableOfT))
{
expr = new NullReferenceExpression();
@ -960,7 +960,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -960,7 +960,7 @@ namespace ICSharpCode.Decompiler.CSharp
.WithILInstruction(inst);
}
OperatorResolveResult rr = resolver.ResolveBinaryOperator(inst.Kind.ToBinaryOperatorType(), left.ResolveResult, right.ResolveResult) as OperatorResolveResult;
OperatorResolveResult? rr = resolver.ResolveBinaryOperator(inst.Kind.ToBinaryOperatorType(), left.ResolveResult, right.ResolveResult) as OperatorResolveResult;
if (rr == null || rr.IsError || rr.UserDefinedOperatorMethod != null
|| NullableType.GetUnderlyingType(rr.Operands[0].Type).GetStackType() != inst.InputType
|| !rr.Type.IsKnownType(KnownTypeCode.Boolean))
@ -1387,7 +1387,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1387,7 +1387,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
internal TranslatedExpression CallUnsafeIntrinsic(string name, Expression[] arguments, IType returnType, ILInstruction inst = null, IEnumerable<IType> typeArguments = null)
internal TranslatedExpression CallUnsafeIntrinsic(string name, Expression[] arguments, IType returnType, ILInstruction? inst = null, IEnumerable<IType>? typeArguments = null)
{
var target = new MemberReferenceExpression {
Target = new TypeReferenceExpression(astBuilder.ConvertType(compilation.FindType(KnownTypeCode.Unsafe))),
@ -1458,7 +1458,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1458,7 +1458,7 @@ namespace ICSharpCode.Decompiler.CSharp
if (sub.CheckForOverflow)
return null;
// First, attempt to parse the 'sizeof' on the RHS
IType elementType;
IType? elementType;
if (inst.Right.MatchLdcI(out long elementSize))
{
elementType = null;
@ -2397,7 +2397,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2397,7 +2397,7 @@ namespace ICSharpCode.Decompiler.CSharp
);
var body = builder.ConvertAsBlock(function.Body);
Comment prev = null;
Comment? prev = null;
foreach (string warning in function.Warnings)
{
body.InsertChildAfter(prev, prev = new Comment(warning), Roles.Comment);
@ -2612,7 +2612,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2612,7 +2612,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
internal TranslatedExpression TranslateTarget(ILInstruction target, bool nonVirtualInvocation,
internal TranslatedExpression TranslateTarget(ILInstruction? target, bool nonVirtualInvocation,
bool memberStatic, IType memberDeclaringType)
{
// If references are missing member.IsStatic might not be set correctly.
@ -3393,7 +3393,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -3393,7 +3393,7 @@ namespace ICSharpCode.Decompiler.CSharp
var elementsStack = new Stack<List<TranslatedExpression>>();
var elements = new List<TranslatedExpression>(block.Instructions.Count);
elementsStack.Push(elements);
List<IL.Transforms.AccessPathElement> currentPath = null;
List<IL.Transforms.AccessPathElement>? currentPath = null;
var indexVariables = new Dictionary<ILVariable, ILInstruction>();
foreach (var inst in block.Instructions.Skip(1))
{
@ -3602,7 +3602,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -3602,7 +3602,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
ArraySpecifier[] additionalSpecifiers;
AstType typeExpression;
AstType? typeExpression;
if (settings.AnonymousTypes && type.ContainsAnonymousType())
{
typeExpression = null;
@ -4023,7 +4023,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -4023,7 +4023,7 @@ namespace ICSharpCode.Decompiler.CSharp
protected internal override TranslatedExpression VisitAwait(Await inst, TranslationContext context)
{
IType expectedType = null;
IType? expectedType = null;
if (inst.GetAwaiterMethod != null)
{
if (inst.GetAwaiterMethod.IsStatic)

2
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpAmbience.cs

@ -58,7 +58,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -58,7 +58,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
AstNode node = astBuilder.ConvertSymbol(symbol);
writer.StartNode(node);
EntityDeclaration entityDecl = node as EntityDeclaration;
EntityDeclaration? entityDecl = node as EntityDeclaration;
if (entityDecl != null)
PrintModifiers(entityDecl.Modifiers, writer);

16
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -200,7 +200,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -200,7 +200,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
WriteKeyword(tokenRole.Token, tokenRole);
}
protected virtual void WriteKeyword(string token, Role tokenRole = null)
protected virtual void WriteKeyword(string token, Role? tokenRole = null)
{
writer.WriteKeyword(tokenRole, token);
isAtStartOfLine = false;
@ -529,7 +529,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -529,7 +529,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
NewLine();
return;
}
BlockStatement block = embeddedStatement as BlockStatement;
BlockStatement? block = embeddedStatement as BlockStatement;
if (block != null)
{
WriteBlock(block, policy.StatementBraceStyle);
@ -672,7 +672,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -672,7 +672,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
// "int a; new List<int> { a = 1 };" is an object initalizers and invalid, but
// "int a; new List<int> { { a = 1 } };" is a valid collection initializer.
AssignmentExpression ae = expr as AssignmentExpression;
AssignmentExpression? ae = expr as AssignmentExpression;
return ae != null && ae.Operator == AssignmentOperatorType.Assign;
}
@ -703,7 +703,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -703,7 +703,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
OpenBrace(wrap ? policy.ArrayInitializerBraceStyle : BraceStyle.EndOfLine, newLine: wrap);
if (!wrap)
Space();
AstNode last = null;
AstNode? last = null;
foreach (var (idx, node) in elements.WithIndex())
{
if (idx > 0)
@ -1658,7 +1658,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -1658,7 +1658,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
if (typeDeclaration.ClassType == ClassType.Enum)
{
bool first = true;
AstNode last = null;
AstNode? last = null;
foreach (var member in typeDeclaration.Members)
{
if (first)
@ -2340,7 +2340,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -2340,7 +2340,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
StartNode(constructorDeclaration);
WriteAttributes(constructorDeclaration.Attributes);
WriteModifiers(constructorDeclaration.ModifierTokens);
TypeDeclaration type = constructorDeclaration.Parent as TypeDeclaration;
TypeDeclaration? type = constructorDeclaration.Parent as TypeDeclaration;
if (type != null && type.Name != constructorDeclaration.Name)
WriteIdentifier((Identifier)type.NameToken.Clone());
else
@ -2386,7 +2386,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -2386,7 +2386,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space();
}
WriteToken(DestructorDeclaration.TildeRole);
TypeDeclaration type = destructorDeclaration.Parent as TypeDeclaration;
TypeDeclaration? type = destructorDeclaration.Parent as TypeDeclaration;
if (type != null && type.Name != destructorDeclaration.Name)
WriteIdentifier((Identifier)type.NameToken.Clone());
else
@ -2949,7 +2949,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -2949,7 +2949,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public virtual void VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode)
{
CSharpModifierToken mod = cSharpTokenNode as CSharpModifierToken;
CSharpModifierToken? mod = cSharpTokenNode as CSharpModifierToken;
if (mod != null)
{
// ITokenWriter assumes that each node processed between a

10
ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertMissingTokensDecorator.cs

@ -105,20 +105,20 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -105,20 +105,20 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public override void WriteKeyword(Role role, string keyword)
{
TextLocation start = locationProvider.Location;
CSharpTokenNode t = null;
CSharpTokenNode? t = null;
if (role is TokenRole)
t = new CSharpTokenNode(start, (TokenRole)role);
else if (role == EntityDeclaration.ModifierRole)
t = new CSharpModifierToken(start, CSharpModifierToken.GetModifierValue(keyword));
else if (keyword == "this")
{
ThisReferenceExpression node = nodes.Peek().LastOrDefault() as ThisReferenceExpression;
ThisReferenceExpression? node = nodes.Peek().LastOrDefault() as ThisReferenceExpression;
if (node != null)
node.Location = start;
}
else if (keyword == "base")
{
BaseReferenceExpression node = nodes.Peek().LastOrDefault() as BaseReferenceExpression;
BaseReferenceExpression? node = nodes.Peek().LastOrDefault() as BaseReferenceExpression;
if (node != null)
node.Location = start;
}
@ -140,7 +140,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -140,7 +140,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public override void WritePrimitiveValue(object value, LiteralFormat format = LiteralFormat.None)
{
Expression node = nodes.Peek().LastOrDefault() as Expression;
Expression? node = nodes.Peek().LastOrDefault() as Expression;
var startLocation = locationProvider.Location;
base.WritePrimitiveValue(value, format);
if (node is PrimitiveExpression)
@ -155,7 +155,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -155,7 +155,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public override void WritePrimitiveType(string type)
{
PrimitiveType node = nodes.Peek().LastOrDefault() as PrimitiveType;
PrimitiveType? node = nodes.Peek().LastOrDefault() as PrimitiveType;
if (node != null)
node.SetStartLocation(locationProvider.Location);
base.WritePrimitiveType(type);

10
ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertParenthesesVisitor.cs

@ -218,7 +218,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -218,7 +218,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public override void VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression)
{
ParenthesizeIfRequired(unaryOperatorExpression.Expression, GetPrecedence(unaryOperatorExpression));
UnaryOperatorExpression child = unaryOperatorExpression.Expression as UnaryOperatorExpression;
UnaryOperatorExpression? child = unaryOperatorExpression.Expression as UnaryOperatorExpression;
if (child != null && InsertParenthesesForReadability)
Parenthesize(child);
base.VisitUnaryOperatorExpression(unaryOperatorExpression);
@ -233,7 +233,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -233,7 +233,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
}
// There's a nasty issue in the C# grammar: cast expressions including certain operators are ambiguous in some cases
// "(int)-1" is fine, but "(A)-b" is not a cast.
UnaryOperatorExpression uoe = castExpression.Expression as UnaryOperatorExpression;
UnaryOperatorExpression? uoe = castExpression.Expression as UnaryOperatorExpression;
if (uoe != null && !(uoe.Operator == UnaryOperatorType.BitNot || uoe.Operator == UnaryOperatorType.Not))
{
if (TypeCanBeMisinterpretedAsExpression(castExpression.Type))
@ -242,7 +242,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -242,7 +242,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
}
}
// The above issue can also happen with PrimitiveExpressions representing negative values:
PrimitiveExpression pe = castExpression.Expression as PrimitiveExpression;
PrimitiveExpression? pe = castExpression.Expression as PrimitiveExpression;
if (pe != null && pe.Value != null && TypeCanBeMisinterpretedAsExpression(castExpression.Type))
{
TypeCode typeCode = Type.GetTypeCode(pe.Value.GetType());
@ -286,7 +286,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -286,7 +286,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
// SimpleTypes can always be misinterpreted as IdentifierExpressions
// MemberTypes can be misinterpreted as MemberReferenceExpressions if they don't use double colon
// PrimitiveTypes or ComposedTypes can never be misinterpreted as expressions.
MemberType mt = type as MemberType;
MemberType? mt = type as MemberType;
if (mt != null)
return !mt.IsDoubleColon;
else
@ -354,7 +354,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -354,7 +354,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
BinaryOperatorType? GetBinaryOperatorType(Expression expr)
{
BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
BinaryOperatorExpression? boe = expr as BinaryOperatorExpression;
if (boe != null)
return boe.Operator;
else

6
ICSharpCode.Decompiler/CSharp/ProjectDecompiler/TargetServices.cs

@ -66,8 +66,8 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler @@ -66,8 +66,8 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
break;
}
string targetFrameworkIdentifier = null;
string targetFrameworkProfile = null;
string? targetFrameworkIdentifier = null;
string? targetFrameworkProfile = null;
string targetFramework = module.DetectTargetFrameworkId();
if (!string.IsNullOrEmpty(targetFramework))
@ -245,7 +245,7 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler @@ -245,7 +245,7 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
break;
}
MetadataFile resolvedReference;
MetadataFile? resolvedReference;
try
{
resolvedReference = assemblyResolver.Resolve(reference);

6
ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs

@ -636,7 +636,7 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler @@ -636,7 +636,7 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
if (pos > 0)
text = text.Substring(0, pos);
text = text.Trim();
string extension = null;
string? extension = null;
int currentSegmentLength = 0;
if (treatAsFileName)
{
@ -781,9 +781,9 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler @@ -781,9 +781,9 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
public record struct ProjectItemInfo(string ItemType, string FileName)
{
public List<PartialTypeInfo> PartialTypes { get; set; } = null;
public List<PartialTypeInfo>? PartialTypes { get; set; } = null;
public Dictionary<string, string> AdditionalProperties { get; set; } = null;
public Dictionary<string, string>? AdditionalProperties { get; set; } = null;
public ProjectItemInfo With(string name, string value)
{

14
ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
bool IsAutoProperty(IProperty p, out IField field)
bool IsAutoProperty(IProperty p, out IField? field)
{
field = null;
if (p.IsStatic)
@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.CSharp
return field.Name == $"<{p.Name}>k__BackingField";
}
bool IsAutoGetter(IMethod method, out IField field)
bool IsAutoGetter(IMethod method, out IField? field)
{
field = null;
var body = DecompileBody(method);
@ -129,7 +129,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -129,7 +129,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
bool IsAutoSetter(IMethod method, out IField field)
bool IsAutoSetter(IMethod method, out IField? field)
{
field = null;
Debug.Assert(!method.IsStatic);
@ -672,7 +672,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -672,7 +672,7 @@ namespace ICSharpCode.Decompiler.CSharp
return true;
}
bool MatchStringBuilderAppendConstant(out string text)
bool MatchStringBuilderAppendConstant(out string? text)
{
text = null;
while (MatchStringBuilderAppend(body.Instructions[pos], builder, out var val) && val.MatchLdStr(out string valText))
@ -684,7 +684,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -684,7 +684,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
private bool MatchStringBuilderAppend(ILInstruction inst, ILVariable sb, out ILInstruction val)
private bool MatchStringBuilderAppend(ILInstruction inst, ILVariable sb, out ILInstruction? val)
{
val = null;
if (!(inst is CallVirt { Method: { Name: "Append", DeclaringType: { Namespace: "System.Text", Name: "StringBuilder" } } } call))
@ -912,7 +912,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -912,7 +912,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
}
private bool MatchGetEqualityContract(ILInstruction inst, out ILInstruction target)
private bool MatchGetEqualityContract(ILInstruction inst, out ILInstruction? target)
{
target = null;
if (!(inst is CallInstruction { Method: { Name: "get_EqualityContract" } } call))
@ -1099,7 +1099,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1099,7 +1099,7 @@ namespace ICSharpCode.Decompiler.CSharp
return returnInst != null && returnInst.MatchReturn(out var retVal) && retVal.MatchNop();
}
bool MatchMemberAccess(ILInstruction inst, out ILInstruction target, out IMember member)
bool MatchMemberAccess(ILInstruction inst, out ILInstruction? target, out IMember? member)
{
target = null;
member = null;

4
ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp
collector.CollectNamespaces(entity, module);
}
void CollectNamespaces(IEntity entity, MetadataModule module, CodeMappingInfo mappingInfo = null)
void CollectNamespaces(IEntity entity, MetadataModule module, CodeMappingInfo? mappingInfo = null)
{
if (entity == null || entity.MetadataToken.IsNil || module.MetadataFile is not MetadataFile corFile)
return;
@ -334,7 +334,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -334,7 +334,7 @@ namespace ICSharpCode.Decompiler.CSharp
case HandleKind.MethodDefinition:
case HandleKind.MethodSpecification:
case HandleKind.MemberReference:
IMember member;
IMember? member;
try
{
member = module.ResolveEntity(handle, genericContext) as IMember;

28
ICSharpCode.Decompiler/CSharp/Resolver/CSharpConversions.cs

@ -523,10 +523,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -523,10 +523,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (!(fromType.IsReferenceType == true && toType.IsReferenceType != false))
return false;
ArrayType fromArray = fromType as ArrayType;
ArrayType? fromArray = fromType as ArrayType;
if (fromArray != null)
{
ArrayType toArray = toType as ArrayType;
ArrayType? toArray = toType as ArrayType;
if (toArray != null)
{
// array covariance (the broken kind)
@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// </summary>
IType UnpackGenericArrayInterface(IType interfaceType)
{
ParameterizedType pt = interfaceType as ParameterizedType;
ParameterizedType? pt = interfaceType as ParameterizedType;
if (pt != null)
{
switch (pt.GetDefinition()?.KnownTypeCode)
@ -605,8 +605,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -605,8 +605,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
{
if (!def.Equals(t.GetDefinition()))
return false;
ParameterizedType ps = s as ParameterizedType;
ParameterizedType pt = t as ParameterizedType;
ParameterizedType? ps = s as ParameterizedType;
ParameterizedType? pt = t as ParameterizedType;
if (ps != null && pt != null)
{
// C# 4.0 spec: §13.1.3.2 Variance Conversion
@ -700,8 +700,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -700,8 +700,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
ITypeDefinition def = fromType.GetDefinition();
if (def == null || !def.Equals(toType.GetDefinition()))
return false;
ParameterizedType ps = fromType as ParameterizedType;
ParameterizedType pt = toType as ParameterizedType;
ParameterizedType? ps = fromType as ParameterizedType;
ParameterizedType? pt = toType as ParameterizedType;
if (ps == null || pt == null)
{
// non-generic delegate - return true for the identity conversion
@ -940,7 +940,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -940,7 +940,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
IType FindMostEncompassedType(IEnumerable<IType> candidates)
{
IType best = null;
IType? best = null;
foreach (var current in candidates)
{
if (best == null || IsEncompassedBy(current, best))
@ -953,7 +953,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -953,7 +953,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
IType FindMostEncompassingType(IEnumerable<IType> candidates)
{
IType best = null;
IType? best = null;
foreach (var current in candidates)
{
if (best == null || IsEncompassedBy(best, current))
@ -1179,7 +1179,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1179,7 +1179,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
Conversion AnonymousFunctionConversion(ResolveResult resolveResult, IType toType)
{
// C# 5.0 spec §6.5 Anonymous function conversions
LambdaResolveResult f = resolveResult as LambdaResolveResult;
LambdaResolveResult? f = resolveResult as LambdaResolveResult;
if (f == null)
return Conversion.None;
if (!f.IsAnonymousMethod)
@ -1245,7 +1245,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1245,7 +1245,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
static IType UnpackExpressionTreeType(IType type)
{
ParameterizedType pt = type as ParameterizedType;
ParameterizedType? pt = type as ParameterizedType;
if (pt != null && pt.TypeParameterCount == 1 && pt.Name == "Expression" && pt.Namespace == "System.Linq.Expressions")
{
return pt.GetTypeArgument(0);
@ -1261,7 +1261,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1261,7 +1261,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
Conversion MethodGroupConversion(ResolveResult resolveResult, IType toType)
{
// C# 4.0 spec §6.6 Method group conversions
MethodGroupResolveResult rr = resolveResult as MethodGroupResolveResult;
MethodGroupResolveResult? rr = resolveResult as MethodGroupResolveResult;
if (rr == null)
return Conversion.None;
IMethod invoke = toType.GetDelegateInvokeMethod();
@ -1430,7 +1430,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1430,7 +1430,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// <returns>0 = neither is better; 1 = t1 is better; 2 = t2 is better</returns>
public int BetterConversion(ResolveResult resolveResult, IType t1, IType t2)
{
LambdaResolveResult lambda = resolveResult as LambdaResolveResult;
LambdaResolveResult? lambda = resolveResult as LambdaResolveResult;
if (lambda != null)
{
if (!lambda.IsAnonymousMethod)
@ -1484,7 +1484,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1484,7 +1484,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// </summary>
static IType UnpackTask(IType type)
{
ParameterizedType pt = type as ParameterizedType;
ParameterizedType? pt = type as ParameterizedType;
if (pt != null && pt.TypeParameterCount == 1 && pt.Name == "Task" && pt.Namespace == "System.Threading.Tasks")
{
return pt.GetTypeArgument(0);

8
ICSharpCode.Decompiler/CSharp/Resolver/CSharpInvocationResolveResult.cs

@ -57,9 +57,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -57,9 +57,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
bool isExtensionMethodInvocation = false,
bool isExpandedForm = false,
bool isDelegateInvocation = false,
IReadOnlyList<int> argumentToParameterMap = null,
IList<ResolveResult> initializerStatements = null,
IType returnTypeOverride = null
IReadOnlyList<int>? argumentToParameterMap = null,
IList<ResolveResult>? initializerStatements = null,
IType? returnTypeOverride = null
)
: base(targetResult, member, arguments, initializerStatements, returnTypeOverride)
{
@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public override IList<ResolveResult> GetArgumentsForCall()
{
ResolveResult[] results = new ResolveResult[Member.Parameters.Count];
List<ResolveResult> paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
List<ResolveResult>? paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
// map arguments to parameters:
for (int i = 0; i < Arguments.Count; i++)
{

64
ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs

@ -193,7 +193,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -193,7 +193,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (this.CurrentTypeDefinition == typeDefinition)
return this;
TypeDefinitionCache newTypeDefinitionCache;
TypeDefinitionCache? newTypeDefinitionCache;
if (typeDefinition != null)
newTypeDefinitionCache = new TypeDefinitionCache(typeDefinition);
else
@ -344,7 +344,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -344,7 +344,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
switch (op)
{
case UnaryOperatorType.Dereference:
PointerType p = expression.Type as PointerType;
PointerType? p = expression.Type as PointerType;
if (p != null)
return UnaryOperatorResolveResult(p.ElementType, op, expression);
else
@ -357,7 +357,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -357,7 +357,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
ResolveResult getAwaiterInvocation = ResolveInvocation(getAwaiterMethodGroup, Empty<ResolveResult>.Array, argumentNames: null, allowOptionalParameters: false);
var lookup = CreateMemberLookup();
IMethod getResultMethod;
IMethod? getResultMethod;
IType awaitResultType;
var getResultMethodGroup = lookup.Lookup(getAwaiterInvocation, "GetResult", EmptyList<IType>.Instance, true) as MethodGroupResolveResult;
if (getResultMethodGroup != null)
@ -1490,7 +1490,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1490,7 +1490,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
}
// Look in parameters of current method
IParameterizedMember parameterizedMember = this.CurrentMember as IParameterizedMember;
IParameterizedMember? parameterizedMember = this.CurrentMember as IParameterizedMember;
if (parameterizedMember != null)
{
foreach (IParameter p in parameterizedMember.Parameters)
@ -1504,7 +1504,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1504,7 +1504,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
// look in type parameters of current method
IMethod m = this.CurrentMember as IMethod;
IMethod? m = this.CurrentMember as IMethod;
if (m != null)
{
foreach (ITypeParameter tp in m.TypeParameters)
@ -1517,10 +1517,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1517,10 +1517,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
bool parameterizeResultType = !(typeArguments.Count != 0 && typeArguments.All(t => t.Kind == TypeKind.UnboundTypeArgument));
ResolveResult r = null;
ResolveResult? r = null;
if (currentTypeDefinitionCache != null)
{
Dictionary<string, ResolveResult> cache = null;
Dictionary<string, ResolveResult>? cache = null;
bool foundInCache = false;
if (k == 0)
{
@ -1597,7 +1597,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1597,7 +1597,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
}
public bool IsVariableReferenceWithSameType(ResolveResult rr, string identifier, out TypeResolveResult trr)
public bool IsVariableReferenceWithSameType(ResolveResult rr, string identifier, out TypeResolveResult? trr)
{
if (!(rr is MemberResolveResult || rr is LocalResolveResult))
{
@ -1680,7 +1680,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1680,7 +1680,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// finally, look in the imported namespaces:
if (!(isInUsingDeclaration && u == currentUsingScope))
{
IType firstResult = null;
IType? firstResult = null;
foreach (var importedNamespace in u.Usings)
{
ITypeDefinition def = importedNamespace.GetTypeDefinition(identifier, typeArguments.Count);
@ -1794,7 +1794,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1794,7 +1794,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// C# 4.0 spec: §7.6.4
bool parameterizeResultType = !(typeArguments.Count != 0 && typeArguments.All(t => t.Kind == TypeKind.UnboundTypeArgument));
NamespaceResolveResult nrr = target as NamespaceResolveResult;
NamespaceResolveResult? nrr = target as NamespaceResolveResult;
if (nrr != null)
{
return ResolveMemberAccessOnNamespace(nrr, identifier, typeArguments, parameterizeResultType);
@ -1838,7 +1838,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1838,7 +1838,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
else
{
MethodGroupResolveResult mgrr = result as MethodGroupResolveResult;
MethodGroupResolveResult? mgrr = result as MethodGroupResolveResult;
if (mgrr != null)
{
Debug.Assert(mgrr.extensionMethods == null);
@ -1914,7 +1914,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1914,7 +1914,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
IType collectionType, enumeratorType, elementType;
ResolveResult getEnumeratorInvocation;
ResolveResult currentRR = null;
ResolveResult? currentRR = null;
// C# 4.0 spec: §8.8.4 The foreach statement
if (expression.Type.Kind == TypeKind.Array || expression.Type.Kind == TypeKind.Dynamic)
{
@ -1958,7 +1958,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1958,7 +1958,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
CheckForEnumerableInterface(expression, out collectionType, out enumeratorType, out elementType, out getEnumeratorInvocation);
}
}
IMethod moveNextMethod = null;
IMethod? moveNextMethod = null;
var moveNextMethodGroup = memberLookup.Lookup(new ResolveResult(enumeratorType), "MoveNext", EmptyList<IType>.Instance, false) as MethodGroupResolveResult;
if (moveNextMethodGroup != null)
{
@ -1970,7 +1970,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1970,7 +1970,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (currentRR == null)
currentRR = memberLookup.Lookup(new ResolveResult(enumeratorType), "Current", EmptyList<IType>.Instance, false);
IProperty currentProperty = null;
IProperty? currentProperty = null;
if (currentRR is MemberResolveResult)
currentProperty = ((MemberResolveResult)currentRR).Member as IProperty;
@ -2030,7 +2030,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2030,7 +2030,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// new List { all extensions from SomeExtensions }
/// }
/// </remarks>
public List<List<IMethod>> GetExtensionMethods(string name = null, IReadOnlyList<IType> typeArguments = null)
public List<List<IMethod>> GetExtensionMethods(string? name = null, IReadOnlyList<IType>? typeArguments = null)
{
return GetExtensionMethods(null, name, typeArguments);
}
@ -2059,7 +2059,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2059,7 +2059,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// new List { all extensions from SomeExtensions }
/// }
/// </remarks>
public List<List<IMethod>> GetExtensionMethods(IType targetType, string name = null, IReadOnlyList<IType> typeArguments = null, bool substituteInferredTypes = false)
public List<List<IMethod>> GetExtensionMethods(IType targetType, string? name = null, IReadOnlyList<IType>? typeArguments = null, bool substituteInferredTypes = false)
{
var lookup = CreateMemberLookup();
List<List<IMethod>> extensionMethodGroups = new List<List<IMethod>>();
@ -2127,7 +2127,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2127,7 +2127,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return IsEligibleExtensionMethod(compilation, CSharpConversions.Get(compilation), targetType, method, useTypeInference, out outInferredTypes);
}
static bool IsEligibleExtensionMethod(ICompilation compilation, CSharpConversions conversions, IType targetType, IMethod method, bool useTypeInference, out IType[] outInferredTypes)
static bool IsEligibleExtensionMethod(ICompilation compilation, CSharpConversions conversions, IType targetType, IMethod method, bool useTypeInference, out IType[]? outInferredTypes)
{
outInferredTypes = null;
if (targetType == null)
@ -2248,7 +2248,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2248,7 +2248,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
bool isDynamic = arguments.Any(a => a.Type.Kind == TypeKind.Dynamic);
MethodGroupResolveResult mgrr = target as MethodGroupResolveResult;
MethodGroupResolveResult? mgrr = target as MethodGroupResolveResult;
if (mgrr != null)
{
if (isDynamic)
@ -2292,12 +2292,12 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2292,12 +2292,12 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
mgrr.TargetType, mgrr.MethodName, mgrr.TypeArguments, CreateParameters(arguments, argumentNames));
}
}
UnknownMemberResolveResult umrr = target as UnknownMemberResolveResult;
UnknownMemberResolveResult? umrr = target as UnknownMemberResolveResult;
if (umrr != null)
{
return new UnknownMethodResolveResult(umrr.TargetType, umrr.MemberName, umrr.TypeArguments, CreateParameters(arguments, argumentNames));
}
UnknownIdentifierResolveResult uirr = target as UnknownIdentifierResolveResult;
UnknownIdentifierResolveResult? uirr = target as UnknownIdentifierResolveResult;
if (uirr != null && CurrentTypeDefinition != null)
{
return new UnknownMethodResolveResult(CurrentTypeDefinition, uirr.Identifier, EmptyList<IType>.Instance, CreateParameters(arguments, argumentNames));
@ -2330,7 +2330,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2330,7 +2330,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// The argument names. Pass the null string for positional arguments.
/// </param>
/// <returns>InvocationResolveResult or UnknownMethodResolveResult</returns>
public ResolveResult ResolveInvocation(ResolveResult target, ResolveResult[] arguments, string[] argumentNames = null)
public ResolveResult ResolveInvocation(ResolveResult target, ResolveResult[] arguments, string[]? argumentNames = null)
{
return ResolveInvocation(target, arguments, argumentNames, allowOptionalParameters: true);
}
@ -2370,7 +2370,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2370,7 +2370,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
// create the parameter:
ByReferenceResolveResult brrr = arguments[i] as ByReferenceResolveResult;
ByReferenceResolveResult? brrr = arguments[i] as ByReferenceResolveResult;
if (brrr != null)
{
list.Add(new DefaultParameter(arguments[i].Type, argumentNames[i], referenceKind: brrr.ReferenceKind));
@ -2394,19 +2394,19 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2394,19 +2394,19 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
static string GuessParameterName(ResolveResult rr)
{
MemberResolveResult mrr = rr as MemberResolveResult;
MemberResolveResult? mrr = rr as MemberResolveResult;
if (mrr != null)
return mrr.Member.Name;
UnknownMemberResolveResult umrr = rr as UnknownMemberResolveResult;
UnknownMemberResolveResult? umrr = rr as UnknownMemberResolveResult;
if (umrr != null)
return umrr.MemberName;
MethodGroupResolveResult mgrr = rr as MethodGroupResolveResult;
MethodGroupResolveResult? mgrr = rr as MethodGroupResolveResult;
if (mgrr != null)
return mgrr.MethodName;
LocalResolveResult vrr = rr as LocalResolveResult;
LocalResolveResult? vrr = rr as LocalResolveResult;
if (vrr != null)
return MakeParameterName(vrr.Variable.Name);
@ -2429,7 +2429,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2429,7 +2429,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return char.ToLower(variableName[0]) + variableName.Substring(1);
}
OverloadResolution CreateOverloadResolution(ResolveResult[] arguments, string[] argumentNames = null, IType[] typeArguments = null)
OverloadResolution CreateOverloadResolution(ResolveResult[] arguments, string[]? argumentNames = null, IType[]? typeArguments = null)
{
var or = new OverloadResolution(compilation, arguments, argumentNames, typeArguments, conversions);
or.CheckForOverflow = checkForOverflow;
@ -2450,7 +2450,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2450,7 +2450,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// The argument names. Pass the null string for positional arguments.
/// </param>
/// <returns>ArrayAccessResolveResult, InvocationResolveResult, or ErrorResolveResult</returns>
public ResolveResult ResolveIndexer(ResolveResult target, ResolveResult[] arguments, string[] argumentNames = null)
public ResolveResult ResolveIndexer(ResolveResult target, ResolveResult[] arguments, string[]? argumentNames = null)
{
switch (target.Type.Kind)
{
@ -2533,7 +2533,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2533,7 +2533,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// <see cref="InvocationResolveResult.InitializerStatements"/>
/// </param>
/// <returns>InvocationResolveResult or ErrorResolveResult</returns>
public ResolveResult ResolveObjectCreation(IType type, ResolveResult[] arguments, string[] argumentNames = null, bool allowProtectedAccess = false, IList<ResolveResult> initializerStatements = null)
public ResolveResult ResolveObjectCreation(IType type, ResolveResult[] arguments, string[]? argumentNames = null, bool allowProtectedAccess = false, IList<ResolveResult>? initializerStatements = null)
{
if (type.Kind == TypeKind.Delegate && arguments.Length == 1)
{
@ -2875,7 +2875,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2875,7 +2875,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// The initializer elements. May be null if no array initializer was specified.
/// The resolver may mutate this array to wrap elements in <see cref="ConversionResolveResult"/>s!
/// </param>
public ArrayCreateResolveResult ResolveArrayCreation(IType elementType, int[] sizeArguments, ResolveResult[] initializerElements = null)
public ArrayCreateResolveResult ResolveArrayCreation(IType elementType, int[] sizeArguments, ResolveResult[]? initializerElements = null)
{
ResolveResult[] sizeArgResults = new ResolveResult[sizeArguments.Length];
for (int i = 0; i < sizeArguments.Length; i++)
@ -2904,7 +2904,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2904,7 +2904,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// The initializer elements. May be null if no array initializer was specified.
/// The resolver may mutate this array to wrap elements in <see cref="ConversionResolveResult"/>s!
/// </param>
public ArrayCreateResolveResult ResolveArrayCreation(IType elementType, ResolveResult[] sizeArguments, ResolveResult[] initializerElements = null)
public ArrayCreateResolveResult ResolveArrayCreation(IType elementType, ResolveResult[] sizeArguments, ResolveResult[]? initializerElements = null)
{
int dimensions = sizeArguments.Length;
if (dimensions == 0)
@ -2944,7 +2944,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2944,7 +2944,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return new OperatorResolveResult(lhs.Type, linqOp, lhs, this.Convert(rhs, lhs.Type));
}
ResolveResult bopResult = ResolveBinaryOperator(bop.Value, lhs, rhs);
OperatorResolveResult opResult = bopResult as OperatorResolveResult;
OperatorResolveResult? opResult = bopResult as OperatorResolveResult;
if (opResult == null || opResult.Operands.Count != 2)
return bopResult;
return new OperatorResolveResult(lhs.Type, linqOp, opResult.UserDefinedOperatorMethod, opResult.IsLiftedOperator,

2
ICSharpCode.Decompiler/CSharp/Resolver/DynamicInvocationResolveResult.cs

@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// </summary>
public readonly IList<ResolveResult> InitializerStatements;
public DynamicInvocationResolveResult(ResolveResult target, DynamicInvocationType invocationType, IList<ResolveResult> arguments, IList<ResolveResult> initializerStatements = null) : base(SpecialType.Dynamic)
public DynamicInvocationResolveResult(ResolveResult target, DynamicInvocationType invocationType, IList<ResolveResult> arguments, IList<ResolveResult>? initializerStatements = null) : base(SpecialType.Dynamic)
{
this.Target = target;
this.InvocationType = invocationType;

30
ICSharpCode.Decompiler/CSharp/Resolver/MemberLookup.cs

@ -199,11 +199,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -199,11 +199,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (!lookupGroupDict.TryGetValue(entityGroup.Key, out lookupGroups))
lookupGroupDict.Add(entityGroup.Key, lookupGroups = new List<LookupGroup>());
List<IType> newNestedTypes = null;
List<IParameterizedMember> newMethods = null;
IMember newNonMethod = null;
List<IType>? newNestedTypes = null;
List<IParameterizedMember>? newMethods = null;
IMember? newNonMethod = null;
IEnumerable<IType> typeBaseTypes = null;
IEnumerable<IType>? typeBaseTypes = null;
if (!targetIsTypeParameter)
{
@ -310,8 +310,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -310,8 +310,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
{
foreach (IType type in declaringType.GetNonInterfaceBaseTypes())
{
List<IType> newNestedTypes = null;
IEnumerable<IType> typeBaseTypes = null;
List<IType>? newNestedTypes = null;
IEnumerable<IType>? typeBaseTypes = null;
IEnumerable<IType> nestedTypes;
if (parameterizeResultType)
@ -389,11 +389,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -389,11 +389,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
foreach (IType type in targetResolveResult.Type.GetNonInterfaceBaseTypes())
{
List<IType> newNestedTypes = null;
List<IParameterizedMember> newMethods = null;
IMember newNonMethod = null;
List<IType>? newNestedTypes = null;
List<IParameterizedMember>? newMethods = null;
IMember? newNonMethod = null;
IEnumerable<IType> typeBaseTypes = null;
IEnumerable<IType>? typeBaseTypes = null;
if (!isInvocation && !targetIsTypeParameter)
{
@ -452,10 +452,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -452,10 +452,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
List<LookupGroup> lookupGroups = new List<LookupGroup>();
foreach (IType type in targetType.GetNonInterfaceBaseTypes())
{
List<IParameterizedMember> newMethods = null;
IMember newNonMethod = null;
List<IParameterizedMember>? newMethods = null;
IMember? newNonMethod = null;
IEnumerable<IType> typeBaseTypes = null;
IEnumerable<IType>? typeBaseTypes = null;
var members = type.GetProperties(filter, GetMemberOptions.IgnoreInheritedMembers);
AddMembers(type, members, allowProtectedAccess, lookupGroups, true, ref typeBaseTypes, ref newMethods, ref newNonMethod);
@ -551,7 +551,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -551,7 +551,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (!IsAccessible(member, allowProtectedAccess))
continue;
IParameterizedMember method;
IParameterizedMember? method;
if (treatAllParameterizedMembersAsMethods)
method = member as IParameterizedMember;
else
@ -753,7 +753,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -753,7 +753,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
{
if (isInEnumMemberInitializer)
{
IField field = resultGroup.NonMethod as IField;
IField? field = resultGroup.NonMethod as IField;
if (field != null && field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum)
{
return new MemberResolveResult(

6
ICSharpCode.Decompiler/CSharp/Resolver/MethodGroupResolveResult.cs

@ -229,12 +229,12 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -229,12 +229,12 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return string.Format("[{0} with {1} method(s)]", GetType().Name, this.Methods.Count());
}
public OverloadResolution PerformOverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[] argumentNames = null,
public OverloadResolution PerformOverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[]? argumentNames = null,
bool allowExtensionMethods = true,
bool allowExpandingParams = true,
bool allowOptionalParameters = true,
bool allowImplicitIn = true,
bool checkForOverflow = false, CSharpConversions conversions = null)
bool checkForOverflow = false, CSharpConversions? conversions = null)
{
Log.WriteLine("Performing overload resolution for " + this);
Log.WriteCollection(" Arguments: ", arguments);
@ -260,7 +260,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -260,7 +260,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
ResolveResult[] extArguments = new ResolveResult[arguments.Length + 1];
extArguments[0] = new ResolveResult(this.TargetType);
arguments.CopyTo(extArguments, 1);
string[] extArgumentNames = null;
string[]? extArgumentNames = null;
if (argumentNames != null)
{
extArgumentNames = new string[argumentNames.Length + 1];

34
ICSharpCode.Decompiler/CSharp/Resolver/OverloadResolution.cs

@ -78,7 +78,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -78,7 +78,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public bool IsGenericMethod {
get {
IMethod method = Member as IMethod;
IMethod? method = Member as IMethod;
return method != null && method.TypeParameters.Count > 0;
}
}
@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// (without any type parameter substitution, not even class type parameters)
// We'll re-substitute them as part of RunTypeInference().
this.Parameters = memberDefinition.Parameters;
IMethod methodDefinition = memberDefinition as IMethod;
IMethod? methodDefinition = memberDefinition as IMethod;
if (methodDefinition != null && methodDefinition.TypeParameters.Count > 0)
{
this.TypeParameters = methodDefinition.TypeParameters;
@ -136,7 +136,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -136,7 +136,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
OverloadResolutionErrors bestCandidateValidationResult;
#region Constructor
public OverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[] argumentNames = null, IType[] typeArguments = null, CSharpConversions conversions = null)
public OverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[]? argumentNames = null, IType[]? typeArguments = null, CSharpConversions? conversions = null)
{
if (compilation == null)
throw new ArgumentNullException(nameof(compilation));
@ -286,7 +286,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -286,7 +286,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
if (candidate.IsExpandedForm && i == candidate.Parameters.Count - 1)
{
ArrayType arrayType = type as ArrayType;
ArrayType? arrayType = type as ArrayType;
if (arrayType != null && arrayType.Dimensions == 1)
type = arrayType.ElementType;
else
@ -311,7 +311,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -311,7 +311,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (methodLists == null)
throw new ArgumentNullException(nameof(methodLists));
// Base types come first, so go through the list backwards (derived types first)
bool[] isHiddenByDerivedType;
bool[]? isHiddenByDerivedType;
if (methodLists.Count > 1)
isHiddenByDerivedType = new bool[methodLists.Count];
else
@ -436,8 +436,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -436,8 +436,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
ResolveParameterTypes(candidate, true);
return;
}
ParameterizedType parameterizedDeclaringType = candidate.Member.DeclaringType as ParameterizedType;
IReadOnlyList<IType> classTypeArguments;
ParameterizedType? parameterizedDeclaringType = candidate.Member.DeclaringType as ParameterizedType;
IReadOnlyList<IType>? classTypeArguments;
if (parameterizedDeclaringType != null)
{
classTypeArguments = parameterizedDeclaringType.TypeArguments;
@ -504,7 +504,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -504,7 +504,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if (newType != type && ConstraintsValid)
{
// something was changed, so we need to validate the constraints
ParameterizedType newParameterizedType = newType as ParameterizedType;
ParameterizedType? newParameterizedType = newType as ParameterizedType;
if (newParameterizedType != null)
{
// C# 4.0 spec: §4.4.4 Satisfying constraints
@ -552,7 +552,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -552,7 +552,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// The substitution is used to check constraints that depend on other type parameters (or recursively on the same type parameter).
/// May be null if no substitution should be used.</param>
/// <returns>True if the constraints are satisfied; false otherwise.</returns>
public static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor substitution = null)
public static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor? substitution = null)
{
if (typeParameter == null)
throw new ArgumentNullException(nameof(typeParameter));
@ -791,8 +791,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -791,8 +791,8 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return r;
// prefer non-lifted operators
ILiftedOperator lift1 = c1.Member as ILiftedOperator;
ILiftedOperator lift2 = c2.Member as ILiftedOperator;
ILiftedOperator? lift1 = c1.Member as ILiftedOperator;
ILiftedOperator? lift2 = c2.Member as ILiftedOperator;
if (lift1 == null && lift2 != null)
return 1;
if (lift1 != null && lift2 == null)
@ -843,16 +843,16 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -843,16 +843,16 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
if ((t2 is ITypeParameter) && !(t1 is ITypeParameter))
return 1;
ParameterizedType p1 = t1 as ParameterizedType;
ParameterizedType p2 = t2 as ParameterizedType;
ParameterizedType? p1 = t1 as ParameterizedType;
ParameterizedType? p2 = t2 as ParameterizedType;
if (p1 != null && p2 != null && p1.TypeParameterCount == p2.TypeParameterCount)
{
int r = MoreSpecificFormalParameters(p1.TypeArguments, p2.TypeArguments);
if (r > 0)
return r;
}
TypeWithElementType tew1 = t1 as TypeWithElementType;
TypeWithElementType tew2 = t2 as TypeWithElementType;
TypeWithElementType? tew1 = t1 as TypeWithElementType;
TypeWithElementType? tew2 = t2 as TypeWithElementType;
if (tew1 != null && tew2 != null)
{
return MoreSpecificFormalParameter(tew1.ElementType, tew2.ElementType);
@ -1041,7 +1041,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1041,7 +1041,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
{
if (bestCandidate == null)
return null;
IMethod method = bestCandidate.Member as IMethod;
IMethod? method = bestCandidate.Member as IMethod;
if (method != null && method.TypeParameters.Count > 0)
{
return ((IMethod)method.MemberDefinition).Specialize(GetSubstitution(bestCandidate));
@ -1072,7 +1072,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -1072,7 +1072,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// <param name="returnTypeOverride">
/// If not null, use this instead of the ReturnType of the member as the type of the created resolve result.
/// </param>
public CSharpInvocationResolveResult CreateResolveResult(ResolveResult targetResolveResult, IList<ResolveResult> initializerStatements = null, IType returnTypeOverride = null)
public CSharpInvocationResolveResult CreateResolveResult(ResolveResult targetResolveResult, IList<ResolveResult>? initializerStatements = null, IType? returnTypeOverride = null)
{
IParameterizedMember member = GetBestCandidateWithSubstitutedTypeArguments();
if (member == null)

48
ICSharpCode.Decompiler/CSharp/Resolver/TypeInference.cs

@ -113,7 +113,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -113,7 +113,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
/// when inferring a method group or lambda.
/// </param>
/// <returns>The inferred type arguments.</returns>
public IType[] InferTypeArguments(IReadOnlyList<ITypeParameter> typeParameters, IReadOnlyList<ResolveResult> arguments, IReadOnlyList<IType> parameterTypes, out bool success, IReadOnlyList<IType> classTypeArguments = null)
public IType[] InferTypeArguments(IReadOnlyList<ITypeParameter> typeParameters, IReadOnlyList<ResolveResult> arguments, IReadOnlyList<IType> parameterTypes, out bool success, IReadOnlyList<IType>? classTypeArguments = null)
{
if (typeParameters == null)
throw new ArgumentNullException(nameof(typeParameters));
@ -283,7 +283,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -283,7 +283,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
ResolveResult Ei = arguments[i];
IType Ti = parameterTypes[i];
LambdaResolveResult lrr = Ei as LambdaResolveResult;
LambdaResolveResult? lrr = Ei as LambdaResolveResult;
if (lrr != null)
{
MakeExplicitParameterTypeInference(lrr, Ti);
@ -397,7 +397,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -397,7 +397,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
IType[] InputTypes(ResolveResult e, IType t)
{
// C# 4.0 spec: §7.5.2.3 Input types
LambdaResolveResult lrr = e as LambdaResolveResult;
LambdaResolveResult? lrr = e as LambdaResolveResult;
if (lrr != null && lrr.IsImplicitlyTyped || e is MethodGroupResolveResult)
{
IMethod m = GetDelegateOrExpressionTreeSignature(t);
@ -417,7 +417,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -417,7 +417,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
IType[] OutputTypes(ResolveResult e, IType t)
{
// C# 4.0 spec: §7.5.2.4 Output types
LambdaResolveResult lrr = e as LambdaResolveResult;
LambdaResolveResult? lrr = e as LambdaResolveResult;
if (lrr != null || e is MethodGroupResolveResult)
{
IMethod m = GetDelegateOrExpressionTreeSignature(t);
@ -524,7 +524,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -524,7 +524,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
Log.WriteLine(" MakeOutputTypeInference from " + e + " to " + t);
// If E is an anonymous function with inferred return type U (§7.5.2.12) and T is a delegate type or expression
// tree type with return type Tb, then a lower-bound inference (§7.5.2.9) is made from U to Tb.
LambdaResolveResult lrr = e as LambdaResolveResult;
LambdaResolveResult? lrr = e as LambdaResolveResult;
if (lrr != null)
{
IMethod m = GetDelegateOrExpressionTreeSignature(t);
@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// with parameter types T1…Tk and return type Tb, and overload resolution
// of E with the types T1…Tk yields a single method with return type U, then a lower­-bound
// inference is made from U to Tb.
MethodGroupResolveResult mgrr = e as MethodGroupResolveResult;
MethodGroupResolveResult? mgrr = e as MethodGroupResolveResult;
if (mgrr != null)
{
IMethod m = GetDelegateOrExpressionTreeSignature(t);
@ -651,24 +651,24 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -651,24 +651,24 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return;
}
// Handle by reference types:
ByReferenceType brU = U as ByReferenceType;
ByReferenceType brV = V as ByReferenceType;
ByReferenceType? brU = U as ByReferenceType;
ByReferenceType? brV = V as ByReferenceType;
if (brU != null && brV != null)
{
MakeExactInference(brU.ElementType, brV.ElementType);
return;
}
// Handle array types:
ArrayType arrU = U as ArrayType;
ArrayType arrV = V as ArrayType;
ArrayType? arrU = U as ArrayType;
ArrayType? arrV = V as ArrayType;
if (arrU != null && arrV != null && arrU.Dimensions == arrV.Dimensions)
{
MakeExactInference(arrU.ElementType, arrV.ElementType);
return;
}
// Handle parameterized type:
ParameterizedType pU = U.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ParameterizedType pV = V.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ParameterizedType? pU = U.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ParameterizedType? pV = V.TupleUnderlyingTypeOrSelf() as ParameterizedType;
if (pU != null && pV != null
&& object.Equals(pU.GenericType, pV.GenericType)
&& pU.TypeParameterCount == pV.TypeParameterCount)
@ -743,17 +743,17 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -743,17 +743,17 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return;
}
// Handle by reference types:
ByReferenceType brU = U as ByReferenceType;
ByReferenceType brV = V as ByReferenceType;
ByReferenceType? brU = U as ByReferenceType;
ByReferenceType? brV = V as ByReferenceType;
if (brU != null && brV != null)
{
MakeExactInference(brU.ElementType, brV.ElementType);
return;
}
// Handle array types:
ArrayType arrU = U as ArrayType;
ArrayType arrV = V as ArrayType;
ParameterizedType pV = V.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ArrayType? arrU = U as ArrayType;
ArrayType? arrV = V as ArrayType;
ParameterizedType? pV = V.TupleUnderlyingTypeOrSelf() as ParameterizedType;
if (arrU != null && arrV != null && arrU.Dimensions == arrV.Dimensions)
{
MakeLowerBoundInference(arrU.ElementType, arrV.ElementType);
@ -767,10 +767,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -767,10 +767,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// Handle parameterized types:
if (pV != null)
{
ParameterizedType uniqueBaseType = null;
ParameterizedType? uniqueBaseType = null;
foreach (IType baseU in U.GetAllBaseTypes())
{
ParameterizedType pU = baseU.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ParameterizedType? pU = baseU.TupleUnderlyingTypeOrSelf() as ParameterizedType;
if (pU != null && object.Equals(pU.GenericType, pV.GenericType) && pU.TypeParameterCount == pV.TypeParameterCount)
{
if (uniqueBaseType == null)
@ -872,9 +872,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -872,9 +872,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
}
// Handle array types:
ArrayType arrU = U as ArrayType;
ArrayType arrV = V as ArrayType;
ParameterizedType pU = U.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ArrayType? arrU = U as ArrayType;
ArrayType? arrV = V as ArrayType;
ParameterizedType? pU = U.TupleUnderlyingTypeOrSelf() as ParameterizedType;
if (arrV != null && arrU != null && arrU.Dimensions == arrV.Dimensions)
{
MakeUpperBoundInference(arrU.ElementType, arrV.ElementType);
@ -888,10 +888,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -888,10 +888,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// Handle parameterized types:
if (pU != null)
{
ParameterizedType uniqueBaseType = null;
ParameterizedType? uniqueBaseType = null;
foreach (IType baseV in V.GetAllBaseTypes())
{
ParameterizedType pV = baseV.TupleUnderlyingTypeOrSelf() as ParameterizedType;
ParameterizedType? pV = baseV.TupleUnderlyingTypeOrSelf() as ParameterizedType;
if (pV != null && object.Equals(pU.GenericType, pV.GenericType) && pU.TypeParameterCount == pV.TypeParameterCount)
{
if (uniqueBaseType == null)

16
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -151,7 +151,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -151,7 +151,7 @@ namespace ICSharpCode.Decompiler.CSharp
return new IfElseStatement(condition, trueStatement, falseStatement).WithILInstruction(inst);
}
internal IEnumerable<ConstantResolveResult> CreateTypedCaseLabel(long i, IType type, List<(string Key, int Value)> map = null)
internal IEnumerable<ConstantResolveResult> CreateTypedCaseLabel(long i, IType type, List<(string Key, int Value)>? map = null)
{
object value;
// unpack nullable type, if necessary:
@ -243,7 +243,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -243,7 +243,7 @@ namespace ICSharpCode.Decompiler.CSharp
foreach (var section in inst.Sections)
{
// This is used in the block-label mapping.
ConstantResolveResult firstValueResolveResult;
ConstantResolveResult? firstValueResolveResult;
var astSection = new Syntax.SwitchSection();
// Create case labels:
if (section == defaultSection)
@ -346,7 +346,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -346,7 +346,7 @@ namespace ICSharpCode.Decompiler.CSharp
if (!bodyInst.HasFlag(InstructionFlags.EndPointUnreachable))
{
// we need to insert 'break;'
BlockStatement block = body as BlockStatement;
BlockStatement? block = body as BlockStatement;
if (block != null)
{
block.Add(new BreakStatement());
@ -731,7 +731,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -731,7 +731,7 @@ namespace ICSharpCode.Decompiler.CSharp
break;
}
VariableDesignation designation = null;
VariableDesignation? designation = null;
// Handle the required foreach-variable transformation:
switch (transformation)
@ -875,7 +875,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -875,7 +875,7 @@ namespace ICSharpCode.Decompiler.CSharp
return NormalizeTypeVisitor.TypeErasure.EquivalentTypes(a, b);
}
private bool IsDynamicCastToIEnumerable(Expression expr, out Expression dynamicExpr)
private bool IsDynamicCastToIEnumerable(Expression expr, out Expression? dynamicExpr)
{
if (!(expr is CastExpression cast))
{
@ -898,7 +898,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -898,7 +898,7 @@ namespace ICSharpCode.Decompiler.CSharp
/// Otherwise returns the unmodified container.
/// </summary>
/// <param name="optionalLeaveInst">If the leave is a return/break and has no side-effects, we can move the return out of the using-block and put it after the loop, otherwise returns null.</param>
BlockContainer UnwrapNestedContainerIfPossible(BlockContainer container, out Leave optionalLeaveInst)
BlockContainer UnwrapNestedContainerIfPossible(BlockContainer container, out Leave? optionalLeaveInst)
{
optionalLeaveInst = null;
// Check block structure:
@ -978,7 +978,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -978,7 +978,7 @@ namespace ICSharpCode.Decompiler.CSharp
/// <param name="singleGetter">Returns the call instruction invoking Current's getter.</param>
/// <param name="foreachVariable">Returns the the foreach variable, if a suitable was found. This variable is only assigned once and its assignment is the first statement in <paramref name="loopBody"/>.</param>
/// <returns><see cref="RequiredGetCurrentTransformation"/> for details.</returns>
RequiredGetCurrentTransformation DetectGetCurrentTransformation(BlockContainer usingContainer, Block loopBody, BlockContainer loopContainer, ILVariable enumerator, ILInstruction moveNextUsage, out CallInstruction singleGetter, out ILVariable foreachVariable)
RequiredGetCurrentTransformation DetectGetCurrentTransformation(BlockContainer usingContainer, Block loopBody, BlockContainer loopContainer, ILVariable enumerator, ILInstruction moveNextUsage, out CallInstruction? singleGetter, out ILVariable? foreachVariable)
{
singleGetter = null;
foreachVariable = null;
@ -1425,7 +1425,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1425,7 +1425,7 @@ namespace ICSharpCode.Decompiler.CSharp
method.Body = nestedBuilder.ConvertAsBlock(function.Body);
Comment prev = null;
Comment? prev = null;
foreach (string warning in function.Warnings)
{
method.Body.InsertChildAfter(prev, prev = new Comment(warning), Roles.Comment);

6
ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -149,7 +149,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// Returns the first element for which the predicate returns true,
/// or the null node (AstNode with IsNull=true) if no such object is found.
/// </summary>
public T FirstOrNullObject(Func<T, bool> predicate = null)
public T FirstOrNullObject(Func<T, bool>? predicate = null)
{
foreach (T item in this)
if (predicate == null || predicate(item))
@ -161,7 +161,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -161,7 +161,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// Returns the last element for which the predicate returns true,
/// or the null node (AstNode with IsNull=true) if no such object is found.
/// </summary>
public T LastOrNullObject(Func<T, bool> predicate = null)
public T LastOrNullObject(Func<T, bool>? predicate = null)
{
T result = role.NullObject;
foreach (T item in this)
@ -202,7 +202,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -202,7 +202,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public override bool Equals(object obj)
{
AstNodeCollection<T> other = obj as AstNodeCollection<T>;
AstNodeCollection<T>? other = obj as AstNodeCollection<T>;
if (other == null)
return false;
return this.node == other.node && this.role == other.role;

6
ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs

@ -133,7 +133,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -133,7 +133,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// </summary>
public bool IsVar()
{
SimpleType st = this as SimpleType;
SimpleType? st = this as SimpleType;
return st != null && st.Identifier == "var" && st.TypeArguments.Count == 0;
}
@ -148,7 +148,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -148,7 +148,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// For resolving simple names, the current namespace and usings from the CurrentUsingScope
/// (on CSharpTypeResolveContext only) is used.
/// </remarks>
public ITypeReference ToTypeReference(InterningProvider interningProvider = null)
public ITypeReference ToTypeReference(InterningProvider? interningProvider = null)
{
return ToTypeReference(GetNameLookupMode(), interningProvider);
}
@ -163,7 +163,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -163,7 +163,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// For resolving simple names, the current namespace and usings from the CurrentUsingScope
/// (on CSharpTypeResolveContext only) is used.
/// </remarks>
public abstract ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null);
public abstract ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null);
/// <summary>
/// Gets the name lookup mode from the context (looking at the ancestors of this <see cref="AstType"/>).

2
ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs

@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CSharpModifierToken o = other as CSharpModifierToken;
CSharpModifierToken? o = other as CSharpModifierToken;
return o != null && this.modifier == o.modifier;
}

2
ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs

@ -134,7 +134,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -134,7 +134,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CSharpTokenNode o = other as CSharpTokenNode;
CSharpTokenNode? o = other as CSharpTokenNode;
return o != null && !o.IsNull && !(o is CSharpModifierToken);
}
}

6
ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs

@ -146,7 +146,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -146,7 +146,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ComposedType o = other as ComposedType;
ComposedType? o = other as ComposedType;
return o != null
&& this.HasNullableSpecifier == o.HasNullableSpecifier
&& this.PointerRank == o.PointerRank
@ -201,7 +201,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -201,7 +201,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return this;
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
if (interningProvider == null)
interningProvider = InterningProvider.Dummy;
@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ArraySpecifier o = other as ArraySpecifier;
ArraySpecifier? o = other as ArraySpecifier;
return o != null && this.Dimensions == o.Dimensions;
}

2
ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs

@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
DocumentationReference o = other as DocumentationReference;
DocumentationReference? o = other as DocumentationReference;
if (!(o != null && this.SymbolKind == o.SymbolKind && this.HasParameterList == o.HasParameterList))
return false;
if (this.SymbolKind == SymbolKind.Operator)

4
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public AnonymousMethodExpression(BlockStatement body, IEnumerable<ParameterDeclaration> parameters = null)
public AnonymousMethodExpression(BlockStatement body, IEnumerable<ParameterDeclaration>? parameters = null)
{
if (parameters != null)
{
@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AnonymousMethodExpression o = other as AnonymousMethodExpression;
AnonymousMethodExpression? o = other as AnonymousMethodExpression;
return o != null && this.IsAsync == o.IsAsync && this.HasParameterList == o.HasParameterList
&& this.Parameters.DoMatch(o.Parameters, match) && this.Body.DoMatch(o.Body, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ArrayCreateExpression o = other as ArrayCreateExpression;
ArrayCreateExpression? o = other as ArrayCreateExpression;
return o != null && this.Type.DoMatch(o.Type, match)
&& this.Arguments.DoMatch(o.Arguments, match)
&& this.AdditionalArraySpecifiers.DoMatch(o.AdditionalArraySpecifiers, match)

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs

@ -121,7 +121,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -121,7 +121,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ArrayInitializerExpression o = other as ArrayInitializerExpression;
ArrayInitializerExpression? o = other as ArrayInitializerExpression;
return o != null && this.Elements.DoMatch(o.Elements, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs

@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AsExpression o = other as AsExpression;
AsExpression? o = other as AsExpression;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs

@ -105,7 +105,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -105,7 +105,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AssignmentExpression o = other as AssignmentExpression;
AssignmentExpression? o = other as AssignmentExpression;
return o != null && (this.Operator == AssignmentOperatorType.Any || this.Operator == o.Operator)
&& this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BaseReferenceExpression o = other as BaseReferenceExpression;
BaseReferenceExpression? o = other as BaseReferenceExpression;
return o != null;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs

@ -107,7 +107,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -107,7 +107,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BinaryOperatorExpression o = other as BinaryOperatorExpression;
BinaryOperatorExpression? o = other as BinaryOperatorExpression;
return o != null && (this.Operator == BinaryOperatorType.Any || this.Operator == o.Operator)
&& this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CastExpression o = other as CastExpression;
CastExpression? o = other as CastExpression;
return o != null && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CheckedExpression o = other as CheckedExpression;
CheckedExpression? o = other as CheckedExpression;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ConditionalExpression o = other as ConditionalExpression;
ConditionalExpression? o = other as ConditionalExpression;
return o != null && this.Condition.DoMatch(o.Condition, match) && this.TrueExpression.DoMatch(o.TrueExpression, match) && this.FalseExpression.DoMatch(o.FalseExpression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
DefaultValueExpression o = other as DefaultValueExpression;
DefaultValueExpression? o = other as DefaultValueExpression;
return o != null && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs

@ -95,7 +95,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -95,7 +95,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
DirectionExpression o = other as DirectionExpression;
DirectionExpression? o = other as DirectionExpression;
return o != null && this.FieldDirection == o.FieldDirection && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs

@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
IdentifierExpression o = other as IdentifierExpression;
IdentifierExpression? o = other as IdentifierExpression;
return o != null && MatchString(this.Identifier, o.Identifier) && this.TypeArguments.DoMatch(o.TypeArguments, match);
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -54,7 +54,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public IndexerExpression(Expression target, IEnumerable<Expression> arguments)
public IndexerExpression(Expression target, IEnumerable<Expression>? arguments)
{
AddChild(target, Roles.TargetExpression);
if (arguments != null)
@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
}
}
public IndexerExpression(Expression target, params Expression[] arguments) : this(target, (IEnumerable<Expression>)arguments)
public IndexerExpression(Expression target, params Expression[]? arguments) : this(target, (IEnumerable<Expression>?)arguments)
{
}
@ -85,9 +85,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -85,9 +85,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return visitor.VisitIndexerExpression(this, data);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match)
{
IndexerExpression o = other as IndexerExpression;
IndexerExpression? o = other as IndexerExpression;
return o != null && this.Target.DoMatch(o.Target, match) && this.Arguments.DoMatch(o.Arguments, match);
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, Match match)
{
InterpolatedStringExpression o = other as InterpolatedStringExpression;
InterpolatedStringExpression? o = other as InterpolatedStringExpression;
return o != null && !o.IsNull && this.Content.DoMatch(o.Content, match);
}
}
@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
}
public Interpolation(Expression expression, int alignment = 0, string suffix = null)
public Interpolation(Expression expression, int alignment = 0, string? suffix = null)
{
Expression = expression;
Alignment = alignment;
@ -141,7 +141,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -141,7 +141,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, Match match)
{
Interpolation o = other as Interpolation;
Interpolation? o = other as Interpolation;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}
@ -177,7 +177,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -177,7 +177,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, Match match)
{
InterpolatedStringText o = other as InterpolatedStringText;
InterpolatedStringText? o = other as InterpolatedStringText;
return o != null && o.Text == this.Text;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -87,7 +87,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
InvocationExpression o = other as InvocationExpression;
InvocationExpression? o = other as InvocationExpression;
return o != null && this.Target.DoMatch(o.Target, match) && this.Arguments.DoMatch(o.Arguments, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs

@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
IsExpression o = other as IsExpression;
IsExpression? o = other as IsExpression;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs

@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
LambdaExpression o = other as LambdaExpression;
LambdaExpression? o = other as LambdaExpression;
return o != null && this.IsAsync == o.IsAsync && this.Parameters.DoMatch(o.Parameters, match) && this.Body.DoMatch(o.Body, match);
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs

@ -80,7 +80,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -80,7 +80,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public MemberReferenceExpression(Expression target, string memberName, IEnumerable<AstType> arguments = null)
public MemberReferenceExpression(Expression target, string memberName, IEnumerable<AstType>? arguments = null)
{
AddChild(target, Roles.TargetExpression);
MemberName = memberName;
@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
MemberReferenceExpression o = other as MemberReferenceExpression;
MemberReferenceExpression? o = other as MemberReferenceExpression;
return o != null && this.Target.DoMatch(o.Target, match) && MatchString(this.MemberName, o.MemberName) && this.TypeArguments.DoMatch(o.TypeArguments, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
NamedArgumentExpression o = other as NamedArgumentExpression;
NamedArgumentExpression? o = other as NamedArgumentExpression;
return o != null && MatchString(this.Name, o.Name) && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
NullReferenceExpression o = other as NullReferenceExpression;
NullReferenceExpression? o = other as NullReferenceExpression;
return o != null;
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs

@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public ObjectCreateExpression(AstType type, IEnumerable<Expression> arguments = null)
public ObjectCreateExpression(AstType type, IEnumerable<Expression>? arguments = null)
{
AddChild(type, Roles.Type);
if (arguments != null)
@ -99,7 +99,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -99,7 +99,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ObjectCreateExpression o = other as ObjectCreateExpression;
ObjectCreateExpression? o = other as ObjectCreateExpression;
return o != null && this.Type.DoMatch(o.Type, match) && this.Arguments.DoMatch(o.Arguments, match) && this.Initializer.DoMatch(o.Initializer, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ParenthesizedExpression o = other as ParenthesizedExpression;
ParenthesizedExpression? o = other as ParenthesizedExpression;
return o != null && this.Expression.DoMatch(o.Expression, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs

@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
PointerReferenceExpression o = other as PointerReferenceExpression;
PointerReferenceExpression? o = other as PointerReferenceExpression;
return o != null && MatchString(this.MemberName, o.MemberName) && this.TypeArguments.DoMatch(o.TypeArguments, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs

@ -145,7 +145,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -145,7 +145,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
PrimitiveExpression o = other as PrimitiveExpression;
PrimitiveExpression? o = other as PrimitiveExpression;
return o != null && (this.Value == AnyValue || object.Equals(this.Value, o.Value));
}
}

20
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs

@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryExpression o = other as QueryExpression;
QueryExpression? o = other as QueryExpression;
return o != null && !o.IsNull && this.Clauses.DoMatch(o.Clauses, match);
}
}
@ -150,7 +150,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -150,7 +150,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryContinuationClause o = other as QueryContinuationClause;
QueryContinuationClause? o = other as QueryContinuationClause;
return o != null && MatchString(this.Identifier, o.Identifier) && this.PrecedingQuery.DoMatch(o.PrecedingQuery, match);
}
}
@ -208,7 +208,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -208,7 +208,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryFromClause o = other as QueryFromClause;
QueryFromClause? o = other as QueryFromClause;
return o != null && this.Type.DoMatch(o.Type, match) && MatchString(this.Identifier, o.Identifier)
&& this.Expression.DoMatch(o.Expression, match);
}
@ -261,7 +261,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -261,7 +261,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryLetClause o = other as QueryLetClause;
QueryLetClause? o = other as QueryLetClause;
return o != null && MatchString(this.Identifier, o.Identifier) && this.Expression.DoMatch(o.Expression, match);
}
}
@ -297,7 +297,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -297,7 +297,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryWhereClause o = other as QueryWhereClause;
QueryWhereClause? o = other as QueryWhereClause;
return o != null && this.Condition.DoMatch(o.Condition, match);
}
}
@ -406,7 +406,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -406,7 +406,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryJoinClause o = other as QueryJoinClause;
QueryJoinClause? o = other as QueryJoinClause;
return o != null && this.IsGroupJoin == o.IsGroupJoin
&& this.Type.DoMatch(o.Type, match) && MatchString(this.JoinIdentifier, o.JoinIdentifier)
&& this.InExpression.DoMatch(o.InExpression, match) && this.OnExpression.DoMatch(o.OnExpression, match)
@ -445,7 +445,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -445,7 +445,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryOrderClause o = other as QueryOrderClause;
QueryOrderClause? o = other as QueryOrderClause;
return o != null && this.Orderings.DoMatch(o.Orderings, match);
}
}
@ -490,7 +490,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -490,7 +490,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryOrdering o = other as QueryOrdering;
QueryOrdering? o = other as QueryOrdering;
return o != null && this.Direction == o.Direction && this.Expression.DoMatch(o.Expression, match);
}
}
@ -532,7 +532,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -532,7 +532,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QuerySelectClause o = other as QuerySelectClause;
QuerySelectClause? o = other as QuerySelectClause;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}
@ -579,7 +579,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -579,7 +579,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
QueryGroupClause o = other as QueryGroupClause;
QueryGroupClause? o = other as QueryGroupClause;
return o != null && this.Projection.DoMatch(o.Projection, match) && this.Key.DoMatch(o.Key, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SizeOfExpression o = other as SizeOfExpression;
SizeOfExpression? o = other as SizeOfExpression;
return o != null && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
StackAllocExpression o = other as StackAllocExpression;
StackAllocExpression? o = other as StackAllocExpression;
return o != null && this.Type.DoMatch(o.Type, match)
&& this.CountExpression.DoMatch(o.CountExpression, match)
&& this.Initializer.DoMatch(o.Initializer, match);

4
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SwitchExpression o = other as SwitchExpression;
SwitchExpression? o = other as SwitchExpression;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.SwitchSections.DoMatch(o.SwitchSections, match);
}
}
@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SwitchExpressionSection o = other as SwitchExpressionSection;
SwitchExpressionSection? o = other as SwitchExpressionSection;
return o != null && this.Pattern.DoMatch(o.Pattern, match) && this.Body.DoMatch(o.Body, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -65,7 +65,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ThisReferenceExpression o = other as ThisReferenceExpression;
ThisReferenceExpression? o = other as ThisReferenceExpression;
return o != null;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ThrowExpression o = other as ThrowExpression;
ThrowExpression? o = other as ThrowExpression;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs

@ -78,7 +78,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -78,7 +78,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
TypeOfExpression o = other as TypeOfExpression;
TypeOfExpression? o = other as TypeOfExpression;
return o != null && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs

@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
TypeReferenceExpression o = other as TypeReferenceExpression;
TypeReferenceExpression? o = other as TypeReferenceExpression;
return o != null && this.Type.DoMatch(o.Type, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
UnaryOperatorExpression o = other as UnaryOperatorExpression;
UnaryOperatorExpression? o = other as UnaryOperatorExpression;
return o != null && (this.Operator == UnaryOperatorType.Any || this.Operator == o.Operator)
&& this.Expression.DoMatch(o.Expression, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
UncheckedExpression o = other as UncheckedExpression;
UncheckedExpression? o = other as UncheckedExpression;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs

@ -97,7 +97,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -97,7 +97,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
UndocumentedExpression o = other as UndocumentedExpression;
UndocumentedExpression? o = other as UndocumentedExpression;
return o != null && this.UndocumentedExpressionType == o.UndocumentedExpressionType && this.Arguments.DoMatch(o.Arguments, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs

@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
&& this.ReturnType.DoMatch(o.ReturnType, match);
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
throw new NotImplementedException();
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -79,7 +79,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
Attribute o = other as Attribute;
Attribute? o = other as Attribute;
return o != null && this.Type.DoMatch(o.Type, match) && this.Arguments.DoMatch(o.Arguments, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs

@ -131,7 +131,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -131,7 +131,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AttributeSection o = other as AttributeSection;
AttributeSection? o = other as AttributeSection;
return o != null && MatchString(this.AttributeTarget, o.AttributeTarget) && this.Attributes.DoMatch(o.Attributes, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs

@ -145,7 +145,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -145,7 +145,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
Comment o = other as Comment;
Comment? o = other as Comment;
return o != null && this.CommentType == o.CommentType && MatchString(this.Content, o.Content);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs

@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
Constraint o = other as Constraint;
Constraint? o = other as Constraint;
return o != null && this.TypeParameter.DoMatch(o.TypeParameter, match) && this.BaseTypes.DoMatch(o.BaseTypes, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs

@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
DelegateDeclaration o = other as DelegateDeclaration;
DelegateDeclaration? o = other as DelegateDeclaration;
return o != null && MatchString(this.Name, o.Name)
&& this.MatchAttributesAndModifiers(o, match) && this.ReturnType.DoMatch(o.ReturnType, match)
&& this.TypeParameters.DoMatch(o.TypeParameters, match) && this.Parameters.DoMatch(o.Parameters, match)

4
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// </summary>
public string FullName {
get {
NamespaceDeclaration parentNamespace = Parent as NamespaceDeclaration;
NamespaceDeclaration? parentNamespace = Parent as NamespaceDeclaration;
if (parentNamespace != null)
return BuildQualifiedName(parentNamespace.FullName, Name);
return Name;
@ -152,7 +152,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -152,7 +152,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
NamespaceDeclaration o = other as NamespaceDeclaration;
NamespaceDeclaration? o = other as NamespaceDeclaration;
return o != null && MatchString(this.Name, o.Name) && this.Members.DoMatch(o.Members, match);
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public LinePreprocessorDirective(string argument = null) : base(PreProcessorDirectiveType.Line, argument)
public LinePreprocessorDirective(string? argument = null) : base(PreProcessorDirectiveType.Line, argument)
{
}
}
@ -115,7 +115,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -115,7 +115,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public PragmaWarningPreprocessorDirective(string argument = null) : base(PreProcessorDirectiveType.Pragma, argument)
public PragmaWarningPreprocessorDirective(string? argument = null) : base(PreProcessorDirectiveType.Pragma, argument)
{
}
@ -172,7 +172,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -172,7 +172,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
this.endLocation = endLocation;
}
public PreProcessorDirective(PreProcessorDirectiveType type, string argument = null)
public PreProcessorDirective(PreProcessorDirectiveType type, string? argument = null)
{
this.Type = type;
this.Argument = argument;
@ -195,7 +195,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -195,7 +195,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
PreProcessorDirective o = other as PreProcessorDirective;
PreProcessorDirective? o = other as PreProcessorDirective;
return o != null && Type == o.Type && MatchString(Argument, o.Argument);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -149,7 +149,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
TypeDeclaration o = other as TypeDeclaration;
TypeDeclaration? o = other as TypeDeclaration;
return o != null && this.ClassType == o.ClassType && MatchString(this.Name, o.Name)
&& this.MatchAttributesAndModifiers(o, match) && this.TypeParameters.DoMatch(o.TypeParameters, match)
&& this.BaseTypes.DoMatch(o.BaseTypes, match) && this.Constraints.DoMatch(o.Constraints, match)

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs

@ -106,7 +106,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -106,7 +106,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
TypeParameterDeclaration o = other as TypeParameterDeclaration;
TypeParameterDeclaration? o = other as TypeParameterDeclaration;
return o != null && this.Variance == o.Variance && MatchString(this.Name, o.Name) && this.Attributes.DoMatch(o.Attributes, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs

@ -101,7 +101,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -101,7 +101,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
UsingAliasDeclaration o = other as UsingAliasDeclaration;
UsingAliasDeclaration? o = other as UsingAliasDeclaration;
return o != null && MatchString(this.Alias, o.Alias) && this.Import.DoMatch(o.Import, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs

@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -117,7 +117,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
UsingDeclaration o = other as UsingDeclaration;
UsingDeclaration? o = other as UsingDeclaration;
return o != null && this.Import.DoMatch(o.Import, match);
}
}

18
ICSharpCode.Decompiler/CSharp/Syntax/IAnnotatable.cs

@ -101,7 +101,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -101,7 +101,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// </summary>
protected void CloneAnnotations()
{
ICloneable cloneable = annotations as ICloneable;
ICloneable? cloneable = annotations as ICloneable;
if (cloneable != null)
annotations = cloneable.Clone();
}
@ -123,7 +123,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -123,7 +123,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
for (int i = 0; i < this.Count; i++)
{
object obj = this[i];
ICloneable c = obj as ICloneable;
ICloneable? c = obj as ICloneable;
copy.Add(c != null ? c.Clone() : obj);
}
return copy;
@ -141,7 +141,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -141,7 +141,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
return; // we successfully added a single annotation
}
AnnotationList list = oldAnnotation as AnnotationList;
AnnotationList? list = oldAnnotation as AnnotationList;
if (list == null)
{
// we need to transform the old annotation into a list
@ -168,7 +168,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -168,7 +168,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
retry: // Retry until successful
object oldAnnotations = this.annotations;
AnnotationList list = oldAnnotations as AnnotationList;
AnnotationList? list = oldAnnotations as AnnotationList;
if (list != null)
{
lock (list)
@ -190,7 +190,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -190,7 +190,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
throw new ArgumentNullException(nameof(type));
retry: // Retry until successful
object oldAnnotations = this.annotations;
AnnotationList list = oldAnnotations as AnnotationList;
AnnotationList? list = oldAnnotations as AnnotationList;
if (list != null)
{
lock (list)
@ -209,14 +209,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -209,14 +209,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public T Annotation<T>() where T : class
{
object annotations = this.annotations;
AnnotationList list = annotations as AnnotationList;
AnnotationList? list = annotations as AnnotationList;
if (list != null)
{
lock (list)
{
foreach (object obj in list)
{
T t = obj as T;
T? t = obj as T;
if (t != null)
return t;
}
@ -234,7 +234,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -234,7 +234,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
if (type == null)
throw new ArgumentNullException(nameof(type));
object annotations = this.annotations;
AnnotationList list = annotations as AnnotationList;
AnnotationList? list = annotations as AnnotationList;
if (list != null)
{
lock (list)
@ -260,7 +260,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -260,7 +260,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public IEnumerable<object> Annotations {
get {
object annotations = this.annotations;
AnnotationList list = annotations as AnnotationList;
AnnotationList? list = annotations as AnnotationList;
if (list != null)
{
lock (list)

2
ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs

@ -166,7 +166,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -166,7 +166,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
Identifier o = other as Identifier;
Identifier? o = other as Identifier;
return o != null && !o.IsNull && MatchString(this.Name, o.Name);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs

@ -41,7 +41,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -41,7 +41,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public override bool DoMatch(PatternMatching.INode other, PatternMatching.Match match)
{
IdentifierExpression ident = other as IdentifierExpression;
IdentifierExpression? ident = other as IdentifierExpression;
if (ident == null || ident.TypeArguments.Any())
return false;
AstNode referenced = (AstNode)match.Get(referencedGroupName).Last();

2
ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
&& this.Arguments.DoMatch(o.Arguments, match);
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
throw new NotImplementedException();
}

8
ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs

@ -114,21 +114,21 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -114,21 +114,21 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
MemberType o = other as MemberType;
MemberType? o = other as MemberType;
return o != null && this.IsDoubleColon == o.IsDoubleColon
&& MatchString(this.MemberName, o.MemberName) && this.Target.DoMatch(o.Target, match)
&& this.TypeArguments.DoMatch(o.TypeArguments, match);
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
if (interningProvider == null)
interningProvider = InterningProvider.Dummy;
TypeOrNamespaceReference t;
TypeOrNamespaceReference? t;
if (this.IsDoubleColon)
{
SimpleType st = this.Target as SimpleType;
SimpleType? st = this.Target as SimpleType;
if (st != null)
{
t = interningProvider.Intern(new AliasNamespaceReference(interningProvider.Intern(st.Identifier)));

2
ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/AnyNode.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching
get { return groupName; }
}
public AnyNode(string groupName = null)
public AnyNode(string? groupName = null)
{
this.groupName = groupName;
}

2
ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/AnyNodeOrNull.cs

@ -39,7 +39,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching @@ -39,7 +39,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching
get { return groupName; }
}
public AnyNodeOrNull(string groupName = null)
public AnyNodeOrNull(string? groupName = null)
{
this.groupName = groupName;
}

4
ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs

@ -102,7 +102,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -102,7 +102,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
PrimitiveType o = other as PrimitiveType;
PrimitiveType? o = other as PrimitiveType;
return o != null && MatchString(this.Keyword, o.Keyword);
}
@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return Keyword;
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
KnownTypeCode typeCode = GetTypeCodeForPrimitiveType(this.Keyword);
if (typeCode == KnownTypeCode.None)

4
ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs

@ -143,11 +143,11 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -143,11 +143,11 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SimpleType o = other as SimpleType;
SimpleType? o = other as SimpleType;
return o != null && MatchString(this.Identifier, o.Identifier) && this.TypeArguments.DoMatch(o.TypeArguments, match);
}
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null)
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider? interningProvider = null)
{
if (interningProvider == null)
interningProvider = InterningProvider.Dummy;

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs

@ -142,7 +142,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -142,7 +142,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BlockStatement o = other as BlockStatement;
BlockStatement? o = other as BlockStatement;
return o != null && !o.IsNull && this.Statements.DoMatch(o.Statements, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs

@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BreakStatement o = other as BreakStatement;
BreakStatement? o = other as BreakStatement;
return o != null;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CheckedStatement o = other as CheckedStatement;
CheckedStatement? o = other as CheckedStatement;
return o != null && this.Body.DoMatch(o.Body, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs

@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ContinueStatement o = other as ContinueStatement;
ContinueStatement? o = other as ContinueStatement;
return o != null;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs

@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
DoWhileStatement o = other as DoWhileStatement;
DoWhileStatement? o = other as DoWhileStatement;
return o != null && this.EmbeddedStatement.DoMatch(o.EmbeddedStatement, match) && this.Condition.DoMatch(o.Condition, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs

@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
EmptyStatement o = other as EmptyStatement;
EmptyStatement? o = other as EmptyStatement;
return o != null;
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs

@ -67,7 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -67,7 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ExpressionStatement o = other as ExpressionStatement;
ExpressionStatement? o = other as ExpressionStatement;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
FixedStatement o = other as FixedStatement;
FixedStatement? o = other as FixedStatement;
return o != null && this.Type.DoMatch(o.Type, match) && this.Variables.DoMatch(o.Variables, match) && this.EmbeddedStatement.DoMatch(o.EmbeddedStatement, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs

@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ForStatement o = other as ForStatement;
ForStatement? o = other as ForStatement;
return o != null && this.Initializers.DoMatch(o.Initializers, match) && this.Condition.DoMatch(o.Condition, match)
&& this.Iterators.DoMatch(o.Iterators, match) && this.EmbeddedStatement.DoMatch(o.EmbeddedStatement, match);
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs

@ -98,7 +98,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -98,7 +98,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ForeachStatement o = other as ForeachStatement;
ForeachStatement? o = other as ForeachStatement;
return o != null && this.VariableType.DoMatch(o.VariableType, match) && this.VariableDesignation.DoMatch(o.VariableDesignation, match)
&& this.InExpression.DoMatch(o.InExpression, match) && this.EmbeddedStatement.DoMatch(o.EmbeddedStatement, match);
}

6
ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs

@ -80,7 +80,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -80,7 +80,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
GotoStatement o = other as GotoStatement;
GotoStatement? o = other as GotoStatement;
return o != null && MatchString(this.Label, o.Label);
}
}
@ -130,7 +130,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -130,7 +130,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
GotoCaseStatement o = other as GotoCaseStatement;
GotoCaseStatement? o = other as GotoCaseStatement;
return o != null && this.LabelExpression.DoMatch(o.LabelExpression, match);
}
}
@ -172,7 +172,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -172,7 +172,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
GotoDefaultStatement o = other as GotoDefaultStatement;
GotoDefaultStatement? o = other as GotoDefaultStatement;
return o != null;
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs

@ -86,7 +86,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -86,7 +86,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
IfElseStatement o = other as IfElseStatement;
IfElseStatement? o = other as IfElseStatement;
return o != null && this.Condition.DoMatch(o.Condition, match) && this.TrueStatement.DoMatch(o.TrueStatement, match) && this.FalseStatement.DoMatch(o.FalseStatement, match);
}
@ -94,7 +94,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -94,7 +94,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
}
public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement = null)
public IfElseStatement(Expression condition, Statement trueStatement, Statement? falseStatement = null)
{
this.Condition = condition;
this.TrueStatement = trueStatement;

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs

@ -67,7 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -67,7 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
LabelStatement o = other as LabelStatement;
LabelStatement? o = other as LabelStatement;
return o != null && MatchString(this.Label, o.Label);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
LockStatement o = other as LockStatement;
LockStatement? o = other as LockStatement;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.EmbeddedStatement.DoMatch(o.EmbeddedStatement, match);
}
}

2
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ReturnStatement o = other as ReturnStatement;
ReturnStatement? o = other as ReturnStatement;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

6
ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs

@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SwitchStatement o = other as SwitchStatement;
SwitchStatement? o = other as SwitchStatement;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.SwitchSections.DoMatch(o.SwitchSections, match);
}
}
@ -167,7 +167,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -167,7 +167,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SwitchSection o = other as SwitchSection;
SwitchSection? o = other as SwitchSection;
return o != null && this.CaseLabels.DoMatch(o.CaseLabels, match) && this.Statements.DoMatch(o.Statements, match);
}
}
@ -221,7 +221,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -221,7 +221,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CaseLabel o = other as CaseLabel;
CaseLabel? o = other as CaseLabel;
return o != null && this.Expression.DoMatch(o.Expression, match);
}
}

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

Loading…
Cancel
Save