diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs index 871b5da959bdecf3d92f387d2b014145bf721c4b..34f890e87e190b5589351966af7aa578ecb50196 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs @@ -132,8 +132,7 @@ internal static partial class ICodeDefinitionFactoryExtensions { // For non-out parameters, create a field and assign the parameter to it. // TODO: I'm not sure that's what we really want for ref parameters. - string fieldName; - if (TryGetValue(parameterToNewFieldMap, parameterName, out fieldName)) + if (TryGetValue(parameterToNewFieldMap, parameterName, out var fieldName)) { yield return CodeGenerationSymbolFactory.CreateFieldSymbol( attributes: null, @@ -157,8 +156,7 @@ private static bool TryGetValue(IDictionary dictionary, string k private static bool TryGetValue(IDictionary dictionary, string key, out string value) { value = null; - ISymbol symbol; - if (dictionary != null && dictionary.TryGetValue(key, out symbol)) + if (dictionary != null && dictionary.TryGetValue(key, out var symbol)) { value = symbol.Name; return true; @@ -193,8 +191,7 @@ private static bool TryGetValue(IDictionary dictionary, string { // For non-out parameters, create a field and assign the parameter to it. // TODO: I'm not sure that's what we really want for ref parameters. - string fieldName; - if (TryGetValue(parameterToExistingFieldMap, parameterName, out fieldName) || + if (TryGetValue(parameterToExistingFieldMap, parameterName, out var fieldName) || TryGetValue(parameterToNewFieldMap, parameterName, out fieldName)) { var fieldAccess = factory.MemberAccessExpression(factory.ThisExpression(), factory.IdentifierName(fieldName)) diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.SubstituteTypesVisitor.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.SubstituteTypesVisitor.cs index 4df455bbc1814544215698c5b4424ff493267410..b22316a1f674f939a494bd69c9f874f8dd276d44 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.SubstituteTypesVisitor.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.SubstituteTypesVisitor.cs @@ -31,8 +31,7 @@ public override ITypeSymbol DefaultVisit(ISymbol node) private ITypeSymbol VisitType(ITypeSymbol symbol) { - TType2 converted; - if (symbol is TType1 && _map.TryGetValue((TType1)symbol, out converted)) + if (symbol is TType1 && _map.TryGetValue((TType1)symbol, out var converted)) { return converted; } diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs index 64c41bb3fa5ab863e4eb7f70fd393a2452cd56cb..8107f655eaf349d644e510a32358c89b3f79f487 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs @@ -434,17 +434,13 @@ public static bool OverlapsHiddenPosition(this SyntaxNode declaration, SyntaxNod // should ensure that parent nodes are not processed in the same batch as child nodes. if (previous == default(TextSpan) || !previous.IntersectsWith(span)) { - SyntaxNode currentNode; - SyntaxToken currentToken; - SyntaxTrivia currentTrivia; - - if (nodesToReplace.TryGetValue(span, out currentNode)) + if (nodesToReplace.TryGetValue(span, out var currentNode)) { var original = (SyntaxNode)retryAnnotations.GetAnnotations(currentNode).SingleOrDefault() ?? currentNode; var newNode = await computeReplacementNodeAsync(original, currentNode, cancellationToken).ConfigureAwait(false); nodeReplacements[currentNode] = newNode; } - else if (tokensToReplace.TryGetValue(span, out currentToken)) + else if (tokensToReplace.TryGetValue(span, out var currentToken)) { var original = (SyntaxToken)retryAnnotations.GetAnnotations(currentToken).SingleOrDefault(); if (original == default(SyntaxToken)) @@ -455,7 +451,7 @@ public static bool OverlapsHiddenPosition(this SyntaxNode declaration, SyntaxNod var newToken = await computeReplacementTokenAsync(original, currentToken, cancellationToken).ConfigureAwait(false); tokenReplacements[currentToken] = newToken; } - else if (triviaToReplace.TryGetValue(span, out currentTrivia)) + else if (triviaToReplace.TryGetValue(span, out var currentTrivia)) { var original = (SyntaxTrivia)retryAnnotations.GetAnnotations(currentTrivia).SingleOrDefault(); if (original == default(SyntaxTrivia)) @@ -481,8 +477,7 @@ public static bool OverlapsHiddenPosition(this SyntaxNode declaration, SyntaxNod nodes: nodesToReplace.Values, computeReplacementNode: (original, rewritten) => { - SyntaxNode replaced; - if (rewritten != original || !nodeReplacements.TryGetValue(original, out replaced)) + if (rewritten != original || !nodeReplacements.TryGetValue(original, out var replaced)) { // the subtree did change, or we didn't have a replacement for it in this batch // so we need to add an annotation so we can find this node again for the next batch. @@ -495,8 +490,7 @@ public static bool OverlapsHiddenPosition(this SyntaxNode declaration, SyntaxNod tokens: tokensToReplace.Values, computeReplacementToken: (original, rewritten) => { - SyntaxToken replaced; - if (rewritten != original || !tokenReplacements.TryGetValue(original, out replaced)) + if (rewritten != original || !tokenReplacements.TryGetValue(original, out var replaced)) { // the subtree did change, or we didn't have a replacement for it in this batch // so we need to add an annotation so we can find this node again for the next batch. @@ -509,8 +503,7 @@ public static bool OverlapsHiddenPosition(this SyntaxNode declaration, SyntaxNod trivia: triviaToReplace.Values, computeReplacementTrivia: (original, rewritten) => { - SyntaxTrivia replaced; - if (!triviaReplacements.TryGetValue(original, out replaced)) + if (!triviaReplacements.TryGetValue(original, out var replaced)) { // the subtree did change, or we didn't have a replacement for it in this batch // so we need to add an annotation so we can find this node again for the next batch.