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

Use var

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