提交 8df9f27a 编写于 作者: C Cyrus Najmabadi

Use var

上级 38a4af2a
...@@ -93,7 +93,7 @@ private static bool ContainsOnlyWhitespace(IBraceCompletionSession session) ...@@ -93,7 +93,7 @@ private static bool ContainsOnlyWhitespace(IBraceCompletionSession session)
return false; return false;
} }
for (int i = start; i <= end; i++) for (var i = start; i <= end; i++)
{ {
if (!char.IsWhiteSpace(snapshot[i])) if (!char.IsWhiteSpace(snapshot[i]))
{ {
......
...@@ -57,8 +57,8 @@ public PEFile ResolveModule(PEFile mainModule, string moduleName) ...@@ -57,8 +57,8 @@ public PEFile ResolveModule(PEFile mainModule, string moduleName)
{ {
// Primitive implementation to support multi-module assemblies // Primitive implementation to support multi-module assemblies
// where all modules are located next to the main module. // where all modules are located next to the main module.
string baseDirectory = Path.GetDirectoryName(mainModule.FileName); var baseDirectory = Path.GetDirectoryName(mainModule.FileName);
string moduleFileName = Path.Combine(baseDirectory, moduleName); var moduleFileName = Path.Combine(baseDirectory, moduleName);
if (!File.Exists(moduleFileName)) if (!File.Exists(moduleFileName))
{ {
return null; return null;
......
...@@ -108,9 +108,9 @@ private Document PerformDecompilation(Document document, string fullName, Compil ...@@ -108,9 +108,9 @@ private Document PerformDecompilation(Document document, string fullName, Compil
private async Task<Document> AddAssemblyInfoRegionAsync(Document document, ISymbol symbol, CancellationToken cancellationToken) private async Task<Document> AddAssemblyInfoRegionAsync(Document document, ISymbol symbol, CancellationToken cancellationToken)
{ {
string assemblyInfo = MetadataAsSourceHelpers.GetAssemblyInfo(symbol.ContainingAssembly); var assemblyInfo = MetadataAsSourceHelpers.GetAssemblyInfo(symbol.ContainingAssembly);
var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
string assemblyPath = MetadataAsSourceHelpers.GetAssemblyDisplay(compilation, symbol.ContainingAssembly); var assemblyPath = MetadataAsSourceHelpers.GetAssemblyDisplay(compilation, symbol.ContainingAssembly);
var regionTrivia = SyntaxFactory.RegionDirectiveTrivia(true) var regionTrivia = SyntaxFactory.RegionDirectiveTrivia(true)
.WithTrailingTrivia(new[] { SyntaxFactory.Space, SyntaxFactory.PreprocessingMessage(assemblyInfo) }); .WithTrailingTrivia(new[] { SyntaxFactory.Space, SyntaxFactory.PreprocessingMessage(assemblyInfo) });
......
...@@ -277,7 +277,7 @@ private static void ProcessUsings(SyntaxList<UsingDirectiveSyntax> usings, List< ...@@ -277,7 +277,7 @@ private static void ProcessUsings(SyntaxList<UsingDirectiveSyntax> usings, List<
// first child needs no separator // first child needs no separator
var seenSeparator = true; var seenSeparator = true;
for (int i = 0; i < children.Count - 1; i++) for (var i = 0; i < children.Count - 1; i++)
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
......
...@@ -251,8 +251,8 @@ private static void AddFieldSpan(ISymbol symbol, SyntaxTree tree, List<TextSpan> ...@@ -251,8 +251,8 @@ private static void AddFieldSpan(ISymbol symbol, SyntaxTree tree, List<TextSpan>
var declaringNode = reference.GetSyntax(); var declaringNode = reference.GetSyntax();
int spanStart = declaringNode.SpanStart; var spanStart = declaringNode.SpanStart;
int spanEnd = declaringNode.Span.End; var spanEnd = declaringNode.Span.End;
var fieldDeclaration = declaringNode.GetAncestor<FieldDeclarationSyntax>(); var fieldDeclaration = declaringNode.GetAncestor<FieldDeclarationSyntax>();
if (fieldDeclaration != null) if (fieldDeclaration != null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册