- 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.
using Microsoft.AspNet.Mvc.Razor.Host;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Mvc.Razor

View File

@ -1,15 +1,14 @@
// 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.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Razor
@ -45,7 +44,7 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <inheritdoc />
protected override IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors(
[NotNull] Block documentRoot,
[NotNull] ParserErrorSink errorSink)
[NotNull] ErrorSink errorSink)
{
var visitor = new GlobalImportTagHelperDirectiveSpanVisitor(
TagHelperDescriptorResolver,
@ -120,7 +119,7 @@ namespace Microsoft.AspNet.Mvc.Razor
public GlobalImportTagHelperDirectiveSpanVisitor(
ITagHelperDescriptorResolver descriptorResolver,
IEnumerable<TagHelperDirectiveDescriptor> globalImportDirectiveDescriptors,
ParserErrorSink errorSink)
ErrorSink errorSink)
: base(descriptorResolver, errorSink)
{
_globalImportDirectiveDescriptors = globalImportDirectiveDescriptors;
@ -128,7 +127,7 @@ namespace Microsoft.AspNet.Mvc.Razor
protected override TagHelperDescriptorResolutionContext GetTagHelperDescriptorResolutionContext(
IEnumerable<TagHelperDirectiveDescriptor> descriptors,
ParserErrorSink errorSink)
ErrorSink errorSink)
{
var directivesToImport = MergeDirectiveDescriptors(descriptors, _globalImportDirectiveDescriptors);

View File

@ -1,7 +1,7 @@
// 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.
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor;
using Microsoft.Framework.Internal;
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.
using System;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Framework.Internal;

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser;
@ -491,7 +492,7 @@ namespace Microsoft.AspNet.Mvc.Razor
codeParser,
markupParser,
markupParser,
new ParserErrorSink());
new ErrorSink());
codeParser.Context = context;
markupParser.Context = context;
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.CSharp;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
using Xunit;
@ -69,7 +68,7 @@ namespace Microsoft.AspNet.Mvc.Razor
host.DefaultNamespace,
rootedFilePath,
shouldGenerateLinePragmas: true),
new ParserErrorSink());
new ErrorSink());
var codeBuilder = new CSharpCodeBuilder(codeBuilderContext);
host.ChunkInheritanceUtility = chunkInheritanceUtility;

View File

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

View File

@ -1,9 +1,9 @@
// 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.
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.TagHelpers;
using Xunit;
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Mvc.Razor
rootNamespace: string.Empty,
sourceFile: string.Empty,
shouldGenerateLinePragmas: true);
var errorSink = new ParserErrorSink();
var errorSink = new ErrorSink();
var context = new CodeBuilderContext(generatorContext, errorSink);
// Act

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
// 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.
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;

View File

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

View File

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

View File

@ -1,8 +1,7 @@
// 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.
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor;
using Xunit;
namespace Microsoft.AspNet.Mvc.Razor.Precompilation

View File

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