From a1a560ddda299abfc065501353021f99ab29292a Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 12 May 2017 17:21:34 -0700 Subject: [PATCH] Fix #1314 - remove namespaces from options --- .../DefaultRazorIRLoweringPhase.cs | 8 ++------ .../RazorParserOptions.cs | 5 ----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIRLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIRLoweringPhase.cs index 9c19004431..6710dfb110 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIRLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIRLoweringPhase.cs @@ -25,15 +25,11 @@ namespace Microsoft.AspNetCore.Razor.Language document.Options = syntaxTree.Options; - var namespaces = new Dictionary(StringComparer.Ordinal); - foreach (var defaultNamespace in syntaxTree.Options.NamespaceImports) - { - namespaces[defaultNamespace] = null; - } - var checksum = ChecksumIRNode.Create(codeDocument.Source); builder.Insert(0, checksum); + var namespaces = new Dictionary(StringComparer.Ordinal); + // The import documents should be inserted logically before the main document. var imports = codeDocument.GetImportSyntaxTrees(); if (imports != null) diff --git a/src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs b/src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs index ac3b568a0a..805775a0a6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; -using System.Threading.Tasks; namespace Microsoft.AspNetCore.Razor.Language { @@ -17,7 +15,6 @@ namespace Microsoft.AspNetCore.Razor.Language private RazorParserOptions() { Directives = new List(); - NamespaceImports = new HashSet(StringComparer.Ordinal); } public bool DesignTimeMode { get; set; } @@ -29,7 +26,5 @@ namespace Microsoft.AspNetCore.Razor.Language public bool StopParsingAfterFirstDirective { get; set; } public ICollection Directives { get; } - - public HashSet NamespaceImports { get; } } }