React to FileName => FilePath renames in Razor.

aspnet/Razor#1423
This commit is contained in:
N. Taylor Mullen 2017-06-13 11:39:38 -07:00
parent dfe04bc917
commit 080836e1c5
2 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{ {
// If a SourceLocation does not specify a file path, assume it is produced from parsing the current file. // If a SourceLocation does not specify a file path, assume it is produced from parsing the current file.
var messageGroups = diagnostics.GroupBy( var messageGroups = diagnostics.GroupBy(
razorError => razorError.Span.FilePath ?? codeDocument.Source.FileName, razorError => razorError.Span.FilePath ?? codeDocument.Source.FilePath,
StringComparer.Ordinal); StringComparer.Ordinal);
var failures = new List<CompilationFailure>(); var failures = new List<CompilationFailure>();
@ -98,13 +98,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
private static string ReadContent(RazorCodeDocument codeDocument, string filePath) private static string ReadContent(RazorCodeDocument codeDocument, string filePath)
{ {
RazorSourceDocument sourceDocument; RazorSourceDocument sourceDocument;
if (string.IsNullOrEmpty(filePath) || string.Equals(codeDocument.Source.FileName, filePath, StringComparison.Ordinal)) if (string.IsNullOrEmpty(filePath) || string.Equals(codeDocument.Source.FilePath, filePath, StringComparison.Ordinal))
{ {
sourceDocument = codeDocument.Source; sourceDocument = codeDocument.Source;
} }
else else
{ {
sourceDocument = codeDocument.Imports.FirstOrDefault(f => string.Equals(f.FileName, filePath, StringComparison.Ordinal)); sourceDocument = codeDocument.Imports.FirstOrDefault(f => string.Equals(f.FilePath, filePath, StringComparison.Ordinal));
} }
if (sourceDocument != null) if (sourceDocument != null)
@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{ {
if (diagnostic.Location == Location.None) if (diagnostic.Location == Location.None)
{ {
return codeDocument.Source.FileName; return codeDocument.Source.FilePath;
} }
return diagnostic.Location.GetMappedLineSpan().Path; return diagnostic.Location.GetMappedLineSpan().Path;

View File

@ -231,7 +231,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
internal Assembly CompileAndEmit(RazorCodeDocument codeDocument, string generatedCode) internal Assembly CompileAndEmit(RazorCodeDocument codeDocument, string generatedCode)
{ {
_logger.GeneratedCodeToAssemblyCompilationStart(codeDocument.Source.FileName); _logger.GeneratedCodeToAssemblyCompilationStart(codeDocument.Source.FilePath);
var startTimestamp = _logger.IsEnabled(LogLevel.Debug) ? Stopwatch.GetTimestamp() : 0; var startTimestamp = _logger.IsEnabled(LogLevel.Debug) ? Stopwatch.GetTimestamp() : 0;
@ -259,7 +259,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
pdbStream.Seek(0, SeekOrigin.Begin); pdbStream.Seek(0, SeekOrigin.Begin);
var assembly = Assembly.Load(assemblyStream.ToArray(), pdbStream.ToArray()); var assembly = Assembly.Load(assemblyStream.ToArray(), pdbStream.ToArray());
_logger.GeneratedCodeToAssemblyCompilationEnd(codeDocument.Source.FileName, startTimestamp); _logger.GeneratedCodeToAssemblyCompilationEnd(codeDocument.Source.FilePath, startTimestamp);
return assembly; return assembly;
} }