From 54831fed35a7a334662fdf019422de55c4c67be9 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Thu, 23 Mar 2017 19:04:24 -0700 Subject: [PATCH] Simplified if condition --- .../CodeGeneration/CSharpRenderingContext.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/CSharpRenderingContext.cs b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/CSharpRenderingContext.cs index 6b4472ff49..a19542e547 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/CSharpRenderingContext.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/CSharpRenderingContext.cs @@ -62,17 +62,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration return; } - var imports = CodeDocument.GetImportSyntaxTrees(); - if (imports != null) + if (SourceDocument.FileName != null && + !string.Equals(SourceDocument.FileName, node.Source.Value.FilePath, StringComparison.OrdinalIgnoreCase)) { - for (var i = 0; i < imports.Count; i++) - { - if (string.Equals(imports[i].Source.FileName, node.Source.Value.FilePath, StringComparison.OrdinalIgnoreCase)) - { - // We don't want to generate line mappings for imports. - return; - } - } + // We don't want to generate line mappings for imports. + return; } var source = node.Source.Value;