From 4173042f495029eb2b55b7ab761edb4f0f4d5963 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Oct 2019 14:50:10 -0700 Subject: [PATCH] use null --- .../Portable/UseSystemHashCode/Analyzer.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs b/src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs index 778acc21dd8..e451fb92f9b 100644 --- a/src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs +++ b/src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs @@ -105,18 +105,18 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)]ou // look for code of the form `return (a, b, c).GetHashCode()`. if (statements.Length != 1) { - return default; + return null; } if (!(statements[0] is IReturnOperation returnOperation)) { - return default; + return null; } using var analyzer = new OperationDeconstructor(this, method, hashCodeVariable: null); if (!analyzer.TryAddHashedSymbol(returnOperation.ReturnedValue, seenHash: false)) { - return default; + return null; } return analyzer.GetResult(); @@ -137,7 +137,7 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)]ou // return hashCode; if (statements.Length < 3) { - return default; + return null; } // First statement has to be the declaration of the accumulator. @@ -145,33 +145,33 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)]ou if (!(statements.First() is IVariableDeclarationGroupOperation varDeclStatement) || !(statements.Last() is IReturnOperation returnStatement)) { - return default; + return null; } var variables = varDeclStatement.GetDeclaredVariables(); if (variables.Length != 1 || varDeclStatement.Declarations.Length != 1) { - return default; + return null; } var declaration = varDeclStatement.Declarations[0]; if (declaration.Declarators.Length != 1) { - return default; + return null; } var declarator = declaration.Declarators[0]; var initializerValue = declaration.Initializer?.Value ?? declarator.Initializer?.Value; if (initializerValue == null) { - return default; + return null; } var hashCodeVariable = declarator.Symbol; if (!(IsLocalReference(returnStatement.ReturnedValue, hashCodeVariable))) { - return default; + return null; } using var valueAnalyzer = new OperationDeconstructor(this, method, hashCodeVariable); @@ -192,7 +192,7 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)]ou if (!IsLiteralNumber(initializerValue) && !valueAnalyzer.TryAddHashedSymbol(initializerValue, seenHash: true)) { - return default; + return null; } // Now check all the intermediary statements. They all have to be of the form: @@ -214,7 +214,7 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)]ou !IsLocalReference(simpleAssignment.Target, hashCodeVariable) || !valueAnalyzer.TryAddHashedSymbol(simpleAssignment.Value, seenHash: false)) { - return default; + return null; } } -- GitLab