- Razor PR aspnet/Razor#350
This commit is contained in:
Doug Bunting 2015-04-07 17:14:57 -07:00
parent 73e8fc10e4
commit cef32d4098
19 changed files with 29 additions and 30 deletions

View File

@ -2,10 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Mvc.Razor.Host; using Microsoft.AspNet.Mvc.Razor.Host;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Mvc.Razor namespace Microsoft.AspNet.Mvc.Razor

View File

@ -1,15 +1,14 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // 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.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers; using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Razor namespace Microsoft.AspNet.Mvc.Razor
@ -45,7 +44,7 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <inheritdoc /> /// <inheritdoc />
protected override IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors( protected override IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors(
[NotNull] Block documentRoot, [NotNull] Block documentRoot,
[NotNull] ParserErrorSink errorSink) [NotNull] ErrorSink errorSink)
{ {
var visitor = new GlobalImportTagHelperDirectiveSpanVisitor( var visitor = new GlobalImportTagHelperDirectiveSpanVisitor(
TagHelperDescriptorResolver, TagHelperDescriptorResolver,
@ -120,7 +119,7 @@ namespace Microsoft.AspNet.Mvc.Razor
public GlobalImportTagHelperDirectiveSpanVisitor( public GlobalImportTagHelperDirectiveSpanVisitor(
ITagHelperDescriptorResolver descriptorResolver, ITagHelperDescriptorResolver descriptorResolver,
IEnumerable<TagHelperDirectiveDescriptor> globalImportDirectiveDescriptors, IEnumerable<TagHelperDirectiveDescriptor> globalImportDirectiveDescriptors,
ParserErrorSink errorSink) ErrorSink errorSink)
: base(descriptorResolver, errorSink) : base(descriptorResolver, errorSink)
{ {
_globalImportDirectiveDescriptors = globalImportDirectiveDescriptors; _globalImportDirectiveDescriptors = globalImportDirectiveDescriptors;
@ -128,7 +127,7 @@ namespace Microsoft.AspNet.Mvc.Razor
protected override TagHelperDescriptorResolutionContext GetTagHelperDescriptorResolutionContext( protected override TagHelperDescriptorResolutionContext GetTagHelperDescriptorResolutionContext(
IEnumerable<TagHelperDirectiveDescriptor> descriptors, IEnumerable<TagHelperDirectiveDescriptor> descriptors,
ParserErrorSink errorSink) ErrorSink errorSink)
{ {
var directivesToImport = MergeDirectiveDescriptors(descriptors, _globalImportDirectiveDescriptors); var directivesToImport = MergeDirectiveDescriptors(descriptors, _globalImportDirectiveDescriptors);

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
using Microsoft.Framework.Runtime; using Microsoft.Framework.Runtime;

View File

@ -2,8 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Text;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Mvc.Rendering;

View File

@ -3,10 +3,10 @@
using System; using System;
using Microsoft.AspNet.Mvc.Razor.Directives; using Microsoft.AspNet.Mvc.Razor.Directives;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Xunit; using Xunit;
@ -153,7 +153,7 @@ MyType1
"MyNamespace", "MyNamespace",
string.Empty, string.Empty,
shouldGenerateLinePragmas: true), shouldGenerateLinePragmas: true),
new ParserErrorSink()); new ErrorSink());
} }
} }
} }

View File

@ -3,10 +3,10 @@
using System; using System;
using Microsoft.AspNet.Mvc.Razor.Directives; using Microsoft.AspNet.Mvc.Razor.Directives;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Xunit; using Xunit;
@ -109,7 +109,7 @@ Environment.NewLine +
"MyNamespace", "MyNamespace",
string.Empty, string.Empty,
shouldGenerateLinePragmas: true), shouldGenerateLinePragmas: true),
new ParserErrorSink()); new ErrorSink());
} }
} }
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
@ -491,7 +492,7 @@ namespace Microsoft.AspNet.Mvc.Razor
codeParser, codeParser,
markupParser, markupParser,
markupParser, markupParser,
new ParserErrorSink()); new ErrorSink());
codeParser.Context = context; codeParser.Context = context;
markupParser.Context = context; markupParser.Context = context;
markupParser.ParseDocument(); markupParser.ParseDocument();

View File

@ -11,7 +11,6 @@ using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
using Xunit; using Xunit;
@ -69,7 +68,7 @@ namespace Microsoft.AspNet.Mvc.Razor
host.DefaultNamespace, host.DefaultNamespace,
rootedFilePath, rootedFilePath,
shouldGenerateLinePragmas: true), shouldGenerateLinePragmas: true),
new ParserErrorSink()); new ErrorSink());
var codeBuilder = new CSharpCodeBuilder(codeBuilderContext); var codeBuilder = new CSharpCodeBuilder(codeBuilderContext);
host.ChunkInheritanceUtility = chunkInheritanceUtility; host.ChunkInheritanceUtility = chunkInheritanceUtility;

View File

@ -4,11 +4,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Moq; using Moq;
using Xunit; using Xunit;
@ -160,7 +160,7 @@ namespace Microsoft.AspNet.Mvc.Razor
var parser = new TestableMvcRazorParser(baseParser, codeTrees, defaultInheritedChunks: new Chunk[0]); var parser = new TestableMvcRazorParser(baseParser, codeTrees, defaultInheritedChunks: new Chunk[0]);
// Act // Act
parser.GetTagHelperDescriptorsPublic(block, errorSink: new ParserErrorSink()).ToArray(); parser.GetTagHelperDescriptorsPublic(block, errorSink: new ErrorSink()).ToArray();
// Assert // Assert
Assert.NotNull(descriptors); Assert.NotNull(descriptors);
@ -203,7 +203,7 @@ namespace Microsoft.AspNet.Mvc.Razor
public IEnumerable<TagHelperDescriptor> GetTagHelperDescriptorsPublic( public IEnumerable<TagHelperDescriptor> GetTagHelperDescriptorsPublic(
Block documentRoot, Block documentRoot,
ParserErrorSink errorSink) ErrorSink errorSink)
{ {
return GetTagHelperDescriptors(documentRoot, errorSink); return GetTagHelperDescriptors(documentRoot, errorSink);
} }

View File

@ -1,9 +1,9 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Xunit; using Xunit;
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Mvc.Razor
rootNamespace: string.Empty, rootNamespace: string.Empty,
sourceFile: string.Empty, sourceFile: string.Empty,
shouldGenerateLinePragmas: true); shouldGenerateLinePragmas: true);
var errorSink = new ParserErrorSink(); var errorSink = new ErrorSink();
var context = new CodeBuilderContext(generatorContext, errorSink); var context = new CodeBuilderContext(generatorContext, errorSink);
// Act // Act

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -3,10 +3,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Mvc.Razor namespace Microsoft.AspNet.Mvc.Razor

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer;

View File

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;

View File

@ -6,7 +6,6 @@ using System.Linq;
using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Razor; using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Moq; using Moq;
@ -50,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
public void Compile_ReturnsFailedResultIfParseFails() public void Compile_ReturnsFailedResultIfParseFails()
{ {
// Arrange // Arrange
var errorSink = new ParserErrorSink(); var errorSink = new ErrorSink();
errorSink.OnError(new RazorError("some message", 1, 1, 1, 1)); errorSink.OnError(new RazorError("some message", 1, 1, 1, 1));
var generatorResult = new GeneratorResults( var generatorResult = new GeneratorResults(
new Block(new BlockBuilder { Type = BlockType.Comment }), new Block(new BlockBuilder { Type = BlockType.Comment }),
@ -89,7 +88,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
var generatorResult = new GeneratorResults( var generatorResult = new GeneratorResults(
new Block(new BlockBuilder { Type = BlockType.Comment }), new Block(new BlockBuilder { Type = BlockType.Comment }),
Enumerable.Empty<TagHelperDescriptor>(), Enumerable.Empty<TagHelperDescriptor>(),
new ParserErrorSink(), new ErrorSink(),
new CodeBuilderResult(code, new LineMapping[0]), new CodeBuilderResult(code, new LineMapping[0]),
new CodeTree()); new CodeTree());
var host = new Mock<IMvcRazorHost>(); var host = new Mock<IMvcRazorHost>();
@ -121,7 +120,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
return new GeneratorResults( return new GeneratorResults(
new Block(new BlockBuilder { Type = BlockType.Comment }), new Block(new BlockBuilder { Type = BlockType.Comment }),
Enumerable.Empty<TagHelperDescriptor>(), Enumerable.Empty<TagHelperDescriptor>(),
new ParserErrorSink(), new ErrorSink(),
new CodeBuilderResult("", new LineMapping[0]), new CodeBuilderResult("", new LineMapping[0]),
new CodeTree()); new CodeTree());
} }

View File

@ -269,7 +269,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Host.Test
codeParser, codeParser,
markupParser, markupParser,
markupParser, markupParser,
new ParserErrorSink()); new ErrorSink());
codeParser.Context = context; codeParser.Context = context;
markupParser.Context = context; markupParser.Context = context;
markupParser.ParseDocument(); markupParser.ParseDocument();

View File

@ -1,8 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Text;
using Xunit; using Xunit;
namespace Microsoft.AspNet.Mvc.Razor.Precompilation namespace Microsoft.AspNet.Mvc.Razor.Precompilation

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;