Update built-in directives to use DirectiveUsage.
- Updated integration code gen and IR bits to reflect new directive usage. - Updated existing unit tests that happened to test directives in code blocks to now test what happens when they exist at the document level. Being inside of a code block is now invalid and we have separate tests for that scenario. #1376
This commit is contained in:
parent
2453689804
commit
7a04e35da5
|
|
@ -14,7 +14,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
||||||
"model",
|
"model",
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder => builder.AddTypeToken());
|
builder =>
|
||||||
|
{
|
||||||
|
builder.AddTypeToken();
|
||||||
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
|
});
|
||||||
|
|
||||||
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
|
public static IRazorEngineBuilder Register(IRazorEngineBuilder builder)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
||||||
"namespace",
|
"namespace",
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder => builder.AddNamespaceToken());
|
builder =>
|
||||||
|
{
|
||||||
|
builder.AddNamespaceToken();
|
||||||
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
|
});
|
||||||
|
|
||||||
public static void Register(IRazorEngineBuilder builder)
|
public static void Register(IRazorEngineBuilder builder)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
||||||
"page",
|
"page",
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder => builder.AddOptionalStringToken());
|
builder =>
|
||||||
|
{
|
||||||
|
builder.AddOptionalStringToken();
|
||||||
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
|
});
|
||||||
|
|
||||||
private PageDirective(string routeTemplate)
|
private PageDirective(string routeTemplate)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
|
||||||
SyntaxConstants.CSharp.InheritsKeyword,
|
SyntaxConstants.CSharp.InheritsKeyword,
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder => builder.AddTypeToken());
|
builder =>
|
||||||
|
{
|
||||||
|
builder.AddTypeToken();
|
||||||
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
|
});
|
||||||
|
|
||||||
public static void Register(IRazorEngineBuilder builder)
|
public static void Register(IRazorEngineBuilder builder)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
public class ModelDirectiveTest
|
public class ModelDirectiveTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ModelDirective_GetModelType_GetsTypeFromLastWellFormedDirective()
|
public void ModelDirective_GetModelType_GetsTypeFromFirstWellFormedDirective()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var codeDocument = CreateDocument(@"
|
var codeDocument = CreateDocument(@"
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
var result = ModelDirective.GetModelType(irDocument);
|
var result = ModelDirective.GetModelType(irDocument);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal("Type2", result);
|
Assert.Equal("Type1", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
// Assert
|
// Assert
|
||||||
var @class = FindClassNode(irDocument);
|
var @class = FindClassNode(irDocument);
|
||||||
Assert.NotNull(@class);
|
Assert.NotNull(@class);
|
||||||
Assert.Equal("BaseType<Type2>", @class.BaseType);
|
Assert.Equal("BaseType<Type1>", @class.BaseType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ9999: The 'page' directive may only occur once per document.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,1): Error RZ9999: The 'page' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ9999: The 'page' directive expects a string surrounded by double quotes.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ9999: The 'page' directive expects a string surrounded by double quotes.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,1): Error RZ9999: The 'model' directive must exist prior to markup or code.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ9999: The 'model' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ9999: The 'model' directive expects a type name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,1): Error RZ9999: The 'model' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ9999: The 'model' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ9999: The 'model' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ9999: The 'inject' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ9999: The 'inject' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ9999: The 'inject' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ9999: The 'inject' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ9999: The 'inject' directive expects an identifier.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ9999: The 'inject' directive expects an identifier.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,1): Error RZ9999: The 'namespace' directive must exist prior to markup or code.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ9999: The 'namespace' directive expects a namespace name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ9999: The 'namespace' directive expects a namespace name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,1): Error RZ9999: The 'namespace' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ9999: The 'namespace' directive expects a namespace name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ9999: The 'namespace' directive expects a namespace name.
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ Document -
|
||||||
MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
|
||||||
HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml)
|
HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml)
|
||||||
IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
|
IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
|
||||||
|
MalformedDirective - (94:3,0 [8] IncompleteDirectives.cshtml)
|
||||||
MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml)
|
MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml)
|
||||||
HtmlContent - (108:4,6 [5] IncompleteDirectives.cshtml)
|
HtmlContent - (108:4,6 [5] IncompleteDirectives.cshtml)
|
||||||
IntermediateToken - (108:4,6 [5] IncompleteDirectives.cshtml) - Html - "\n\n
|
IntermediateToken - (108:4,6 [5] IncompleteDirectives.cshtml) - Html - "\n\n
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ9999: The 'page' directive may only occur once per document.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,1): Error RZ9999: The 'page' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ9999: The 'page' directive expects a string surrounded by double quotes.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ9999: The 'page' directive expects a string surrounded by double quotes.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,1): Error RZ9999: The 'model' directive must exist prior to markup or code.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ9999: The 'model' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ9999: The 'model' directive expects a type name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,1): Error RZ9999: The 'model' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ9999: The 'model' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ9999: The 'model' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ9999: The 'inject' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ9999: The 'inject' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ9999: The 'inject' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ9999: The 'inject' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ9999: The 'inject' directive expects an identifier.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ9999: The 'inject' directive expects an identifier.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,1): Error RZ9999: The 'namespace' directive must exist prior to markup or code.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ9999: The 'namespace' directive expects a namespace name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ9999: The 'namespace' directive expects a namespace name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,1): Error RZ9999: The 'namespace' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ9999: The 'namespace' directive expects a namespace name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ9999: The 'namespace' directive expects a namespace name.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ Document -
|
||||||
IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
|
IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
CSharpCode -
|
||||||
IntermediateToken - - CSharp - EndContext();
|
IntermediateToken - - CSharp - EndContext();
|
||||||
|
MalformedDirective - (94:3,0 [8] IncompleteDirectives.cshtml)
|
||||||
MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml)
|
MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml)
|
||||||
CSharpCode -
|
CSharpCode -
|
||||||
IntermediateToken - - CSharp - BeginContext(108, 5, true);
|
IntermediateToken - - CSharp - BeginContext(108, 5, true);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace AspNetCore
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
|
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<ThisShouldBeGenerated>
|
||||||
{
|
{
|
||||||
#pragma warning disable 219
|
#pragma warning disable 219
|
||||||
private void __RazorDirectiveTokenHelpers__() {
|
private void __RazorDirectiveTokenHelpers__() {
|
||||||
|
|
@ -39,6 +39,6 @@ System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumer
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
|
||||||
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
|
||||||
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.IEnumerable> Html { get; private set; }
|
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<ThisShouldBeGenerated> Html { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml(2,1): Error RZ9999: The 'model' directive may only occur once per document.
|
||||||
|
|
@ -10,7 +10,7 @@ Document -
|
||||||
UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
|
UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
|
||||||
UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
|
UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
|
||||||
UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
|
UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable> -
|
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<ThisShouldBeGenerated> -
|
||||||
DesignTimeDirective -
|
DesignTimeDirective -
|
||||||
DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>
|
DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>
|
||||||
DirectiveToken - (294:7,71 [4] ) - Html
|
DirectiveToken - (294:7,71 [4] ) - Html
|
||||||
|
|
@ -30,6 +30,8 @@ Document -
|
||||||
CSharpCode -
|
CSharpCode -
|
||||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||||
MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
|
||||||
|
MalformedDirective - (30:1,0 [39] MultipleModels.cshtml)
|
||||||
|
DirectiveToken - (37:1,7 [30] MultipleModels.cshtml) - System.Collections.IEnumerable
|
||||||
Inject -
|
Inject -
|
||||||
Inject -
|
Inject -
|
||||||
Inject -
|
Inject -
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
|
Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
|
||||||
|ThisShouldBeGenerated|
|
|ThisShouldBeGenerated|
|
||||||
Generated Location: (839:17,0 [21] )
|
Generated Location: (830:17,0 [21] )
|
||||||
|ThisShouldBeGenerated|
|
|ThisShouldBeGenerated|
|
||||||
|
|
||||||
Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
|
Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
|
||||||
|System.Collections.IEnumerable|
|
|System.Collections.IEnumerable|
|
||||||
Generated Location: (969:21,0 [30] )
|
Generated Location: (960:21,0 [30] )
|
||||||
|System.Collections.IEnumerable|
|
|System.Collections.IEnumerable|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
public class CSharpDirectivesTest : CsHtmlCodeParserTestBase
|
public class CSharpDirectivesTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_ErrorsIfNestedInCode()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfNestedInCode()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var descriptor = DirectiveDescriptor.CreateDirective(
|
var descriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
||||||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_ErrorsIfNestedInHtml()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfNestedInHtml()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var descriptor = DirectiveDescriptor.CreateDirective(
|
var descriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
||||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_ErrorsIfDuplicate()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var descriptor = DirectiveDescriptor.CreateDirective(
|
var descriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
var chunkGenerator = new DirectiveChunkGenerator(descriptor);
|
||||||
|
|
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_CanBeBeneathOtherDirectives()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_CanBeBeneathOtherDirectives()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddMemberToken();
|
builder.AddMemberToken();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -173,7 +173,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -181,7 +181,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -189,7 +189,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddMemberToken();
|
builder.AddMemberToken();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -231,7 +231,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DirectiveDescriptor_SinglePreContent_MixedContentErrors()
|
public void DirectiveDescriptor_FileScopedSinglyOccurring_MixedContentErrors()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
var customDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -239,7 +239,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddTypeToken();
|
builder.AddTypeToken();
|
||||||
});
|
});
|
||||||
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
var somethingDescriptor = DirectiveDescriptor.CreateDirective(
|
||||||
|
|
@ -247,7 +247,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
DirectiveKind.SingleLine,
|
DirectiveKind.SingleLine,
|
||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.Usage = DirectiveUsage.SinglePreContent;
|
builder.Usage = DirectiveUsage.FileScopedSinglyOccurring;
|
||||||
builder.AddMemberToken();
|
builder.AddMemberToken();
|
||||||
});
|
});
|
||||||
var chunkGenerator = new DirectiveChunkGenerator(somethingDescriptor);
|
var chunkGenerator = new DirectiveChunkGenerator(somethingDescriptor);
|
||||||
|
|
@ -1350,58 +1350,54 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
.Accepts(AcceptedCharactersInternal.AnyExceptNewline)));
|
.Accepts(AcceptedCharactersInternal.AnyExceptNewline)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ParseBlock_InheritsDirective()
|
|
||||||
{
|
|
||||||
ParseCodeBlockTest(
|
|
||||||
"@inherits System.Web.WebPages.WebPage",
|
|
||||||
new[] { InheritsDirective.Directive, },
|
|
||||||
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
|
||||||
Factory.CodeTransition(),
|
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
|
||||||
Factory.Span(SpanKindInternal.Code, "System.Web.WebPages.WebPage", markup: false).AsDirectiveToken(InheritsDirective.Directive.Tokens.First())));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void InheritsDirectiveSupportsArrays()
|
public void InheritsDirectiveSupportsArrays()
|
||||||
{
|
{
|
||||||
ParseCodeBlockTest(
|
ParseDocumentTest(
|
||||||
"@inherits string[[]][]",
|
"@inherits string[[]][]",
|
||||||
new[] { InheritsDirective.Directive, },
|
new[] { InheritsDirective.Directive, },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
||||||
Factory.CodeTransition(),
|
Factory.CodeTransition(),
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
||||||
Factory.Span(SpanKindInternal.Code, "string[[]][]", markup: false).AsDirectiveToken(InheritsDirective.Directive.Tokens.First())));
|
Factory.Span(SpanKindInternal.Code, "string[[]][]", markup: false).AsDirectiveToken(InheritsDirective.Directive.Tokens.First())),
|
||||||
|
Factory.EmptyHtml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void InheritsDirectiveSupportsNestedGenerics()
|
public void InheritsDirectiveSupportsNestedGenerics()
|
||||||
{
|
{
|
||||||
ParseCodeBlockTest(
|
ParseDocumentTest(
|
||||||
"@inherits System.Web.Mvc.WebViewPage<IEnumerable<MvcApplication2.Models.RegisterModel>>",
|
"@inherits System.Web.Mvc.WebViewPage<IEnumerable<MvcApplication2.Models.RegisterModel>>",
|
||||||
new[] { InheritsDirective.Directive, },
|
new[] { InheritsDirective.Directive, },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
||||||
Factory.CodeTransition(),
|
Factory.CodeTransition(),
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
||||||
Factory.Span(SpanKindInternal.Code, "System.Web.Mvc.WebViewPage<IEnumerable<MvcApplication2.Models.RegisterModel>>", markup: false)
|
Factory.Span(SpanKindInternal.Code, "System.Web.Mvc.WebViewPage<IEnumerable<MvcApplication2.Models.RegisterModel>>", markup: false)
|
||||||
.AsDirectiveToken(InheritsDirective.Directive.Tokens.First())));
|
.AsDirectiveToken(InheritsDirective.Directive.Tokens.First())),
|
||||||
|
Factory.EmptyHtml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void InheritsDirectiveSupportsTypeKeywords()
|
public void InheritsDirectiveSupportsTypeKeywords()
|
||||||
{
|
{
|
||||||
ParseCodeBlockTest(
|
ParseDocumentTest(
|
||||||
"@inherits string",
|
"@inherits string",
|
||||||
new[] { InheritsDirective.Directive, },
|
new[] { InheritsDirective.Directive, },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
||||||
Factory.CodeTransition(),
|
Factory.CodeTransition(),
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
||||||
Factory.Span(SpanKindInternal.Code, "string", markup: false)
|
Factory.Span(SpanKindInternal.Code, "string", markup: false)
|
||||||
.AsDirectiveToken(InheritsDirective.Directive.Tokens.First())));
|
.AsDirectiveToken(InheritsDirective.Directive.Tokens.First())),
|
||||||
|
Factory.EmptyHtml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -19,26 +19,34 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
RazorDiagnostic.Create(
|
RazorDiagnostic.Create(
|
||||||
new RazorError(
|
new RazorError(
|
||||||
LegacyResources.FormatUnexpectedEOFAfterDirective(InheritsDirective.Directive.Directive, "type"),
|
LegacyResources.FormatUnexpectedEOFAfterDirective(InheritsDirective.Directive.Directive, "type"),
|
||||||
new SourceLocation(8, 0, 8), 1)));
|
new SourceLocation(9, 0, 9), 1)));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
ParseBlockTest(
|
ParseDocumentTest(
|
||||||
"inherits",
|
"@inherits",
|
||||||
new[] { InheritsDirective.Directive },
|
new[] { InheritsDirective.Directive },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(chunkGenerator,
|
new DirectiveBlock(chunkGenerator,
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None)));
|
Factory.CodeTransition(),
|
||||||
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None)),
|
||||||
|
Factory.EmptyHtml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void InheritsBlockAcceptsMultipleGenericArguments()
|
public void InheritsBlockAcceptsMultipleGenericArguments()
|
||||||
{
|
{
|
||||||
ParseBlockTest(
|
ParseDocumentTest(
|
||||||
"inherits Foo.Bar<Biz<Qux>, string, int>.Baz",
|
"@inherits Foo.Bar<Biz<Qux>, string, int>.Baz",
|
||||||
new[] { InheritsDirective.Directive },
|
new[] { InheritsDirective.Directive },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
new DirectiveBlock(new DirectiveChunkGenerator(InheritsDirective.Directive),
|
||||||
|
Factory.CodeTransition(),
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
|
||||||
Factory.Span(SpanKindInternal.Code, "Foo.Bar<Biz<Qux>, string, int>.Baz", markup: false).AsDirectiveToken(InheritsDirective.Directive.Tokens[0])));
|
Factory.Span(SpanKindInternal.Code, "Foo.Bar<Biz<Qux>, string, int>.Baz", markup: false).AsDirectiveToken(InheritsDirective.Directive.Tokens[0])),
|
||||||
|
Factory.EmptyHtml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -50,15 +58,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
RazorDiagnostic.Create(
|
RazorDiagnostic.Create(
|
||||||
new RazorError(
|
new RazorError(
|
||||||
LegacyResources.FormatDirectiveExpectsTypeName(InheritsDirective.Directive.Directive),
|
LegacyResources.FormatDirectiveExpectsTypeName(InheritsDirective.Directive.Directive),
|
||||||
24, 0, 24, Environment.NewLine.Length)));
|
25, 0, 25, Environment.NewLine.Length)));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
ParseBlockTest(
|
ParseDocumentTest(
|
||||||
"inherits " + Environment.NewLine + "foo",
|
"@inherits " + Environment.NewLine + "foo",
|
||||||
new[] { InheritsDirective.Directive },
|
new[] { InheritsDirective.Directive },
|
||||||
|
new MarkupBlock(
|
||||||
|
Factory.EmptyHtml(),
|
||||||
new DirectiveBlock(chunkGenerator,
|
new DirectiveBlock(chunkGenerator,
|
||||||
|
Factory.CodeTransition(),
|
||||||
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
|
||||||
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace)));
|
Factory.Span(SpanKindInternal.Code, " ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace)),
|
||||||
|
Factory.Markup(Environment.NewLine + "foo")));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
{
|
{
|
||||||
#line hidden
|
#line hidden
|
||||||
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
Document -
|
Document -
|
||||||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
UsingDirective - (31:1,1 [26] BasicImports_Imports0.cshtml) - System.Globalization
|
UsingDirective - (1:0,1 [26] BasicImports_Imports0.cshtml) - System.Globalization
|
||||||
UsingDirective - (80:3,1 [27] BasicImports_Imports0.cshtml) - System.ComponentModel
|
UsingDirective - (30:1,1 [27] BasicImports_Imports0.cshtml) - System.ComponentModel
|
||||||
UsingDirective - (23:1,1 [18] BasicImports_Imports1.cshtml) - System.Text
|
UsingDirective - (23:1,1 [18] BasicImports_Imports1.cshtml) - System.Text
|
||||||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_DesignTime - Hello -
|
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_DesignTime - Hello -
|
||||||
DesignTimeDirective -
|
DesignTimeDirective -
|
||||||
DirectiveToken - (119:4,10 [5] BasicImports_Imports0.cshtml) - Hello
|
DirectiveToken - (69:2,10 [5] BasicImports_Imports0.cshtml) - Hello
|
||||||
CSharpCode -
|
CSharpCode -
|
||||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<p>This will get ignored</p>
|
@using System.Globalization
|
||||||
@using System.Globalization
|
|
||||||
@("And also this")
|
|
||||||
@using System.ComponentModel
|
@using System.ComponentModel
|
||||||
@inherits Hello
|
@inherits Hello
|
||||||
|
@("And also this")
|
||||||
|
<p>This will get ignored</p>
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
{
|
{
|
||||||
#line hidden
|
#line hidden
|
||||||
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicImports_Imports0.cshtml"
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Document -
|
Document -
|
||||||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
UsingDirective - (31:1,1 [28] BasicImports_Imports0.cshtml) - System.Globalization
|
UsingDirective - (1:0,1 [28] BasicImports_Imports0.cshtml) - System.Globalization
|
||||||
UsingDirective - (80:3,1 [29] BasicImports_Imports0.cshtml) - System.ComponentModel
|
UsingDirective - (30:1,1 [29] BasicImports_Imports0.cshtml) - System.ComponentModel
|
||||||
UsingDirective - (23:1,1 [20] BasicImports_Imports1.cshtml) - System.Text
|
UsingDirective - (23:1,1 [20] BasicImports_Imports1.cshtml) - System.Text
|
||||||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_Runtime - Hello -
|
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicImports_Runtime - Hello -
|
||||||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cs
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,2): Error RZ9999: Directive 'tagHelperPrefix' must have a value.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,2): Error RZ9999: Directive 'tagHelperPrefix' must have a value.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(13,18): Error RZ9999: Unterminated string literal. Strings that start with a quotation mark (") must be terminated before the end of the line. However, strings that start with @ and a quotation mark (@") can span multiple lines.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(13,18): Error RZ9999: Unterminated string literal. Strings that start with a quotation mark (") must be terminated before the end of the line. However, strings that start with @ and a quotation mark (@") can span multiple lines.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,10): Error RZ9999: The 'inherits' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,10): Error RZ9999: The 'inherits' directive expects a type name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,1): Error RZ9999: The 'inherits' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,11): Error RZ9999: The 'inherits' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,11): Error RZ9999: The 'inherits' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(19,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(19,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(21,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(21,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cs
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,2): Error RZ9999: Directive 'tagHelperPrefix' must have a value.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,2): Error RZ9999: Directive 'tagHelperPrefix' must have a value.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(13,18): Error RZ9999: Unterminated string literal. Strings that start with a quotation mark (") must be terminated before the end of the line. However, strings that start with @ and a quotation mark (@") can span multiple lines.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(13,18): Error RZ9999: Unterminated string literal. Strings that start with a quotation mark (") must be terminated before the end of the line. However, strings that start with @ and a quotation mark (@") can span multiple lines.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,10): Error RZ9999: The 'inherits' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,10): Error RZ9999: The 'inherits' directive expects a type name.
|
||||||
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,1): Error RZ9999: The 'inherits' directive may only occur once per document.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,11): Error RZ9999: The 'inherits' directive expects a type name.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(16,11): Error RZ9999: The 'inherits' directive expects a type name.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(19,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(19,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
||||||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(21,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(21,1): Error RZ9999: Unexpected literal following the 'functions' directive. Expected '{'.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
@foo()
|
@inherits foo.bar<baz<biz>>.boz
|
||||||
|
|
||||||
@inherits foo.bar<baz<biz>>.boz
|
@foo()
|
||||||
|
|
@ -15,7 +15,7 @@ foo.bar<baz<biz>>.boz __typeHelper = default(foo.bar<baz<biz>>.boz);
|
||||||
#pragma warning disable 1998
|
#pragma warning disable 1998
|
||||||
public async System.Threading.Tasks.Task ExecuteAsync()
|
public async System.Threading.Tasks.Task ExecuteAsync()
|
||||||
{
|
{
|
||||||
#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml"
|
#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml"
|
||||||
__o = foo();
|
__o = foo();
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ Document -
|
||||||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits_DesignTime - foo.bar<baz<biz>>.boz -
|
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits_DesignTime - foo.bar<baz<biz>>.boz -
|
||||||
DesignTimeDirective -
|
DesignTimeDirective -
|
||||||
DirectiveToken - (20:2,10 [21] Inherits.cshtml) - foo.bar<baz<biz>>.boz
|
DirectiveToken - (10:0,10 [21] Inherits.cshtml) - foo.bar<baz<biz>>.boz
|
||||||
CSharpCode -
|
CSharpCode -
|
||||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
||||||
CSharpExpression - (1:0,1 [5] Inherits.cshtml)
|
HtmlContent - (33:1,0 [2] Inherits.cshtml)
|
||||||
IntermediateToken - (1:0,1 [5] Inherits.cshtml) - CSharp - foo()
|
IntermediateToken - (33:1,0 [2] Inherits.cshtml) - Html - \n
|
||||||
HtmlContent - (6:0,6 [4] Inherits.cshtml)
|
CSharpExpression - (36:2,1 [5] Inherits.cshtml)
|
||||||
IntermediateToken - (6:0,6 [4] Inherits.cshtml) - Html - \n\n
|
IntermediateToken - (36:2,1 [5] Inherits.cshtml) - CSharp - foo()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
Source Location: (20:2,10 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml)
|
Source Location: (10:0,10 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml)
|
||||||
|foo.bar<baz<biz>>.boz|
|
|foo.bar<baz<biz>>.boz|
|
||||||
Generated Location: (349:8,0 [21] )
|
Generated Location: (349:8,0 [21] )
|
||||||
|foo.bar<baz<biz>>.boz|
|
|foo.bar<baz<biz>>.boz|
|
||||||
|
|
||||||
Source Location: (1:0,1 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml)
|
Source Location: (36:2,1 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml)
|
||||||
|foo()|
|
|foo()|
|
||||||
Generated Location: (747:18,6 [5] )
|
Generated Location: (747:18,6 [5] )
|
||||||
|foo()|
|
|foo()|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "081d0c0715ffeacf3f97a2f3a8443e1e47346419"
|
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d5c565b0bb468550fca15010c0addc84e79c5297"
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
{
|
{
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
@ -7,12 +7,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
#pragma warning disable 1998
|
#pragma warning disable 1998
|
||||||
public async System.Threading.Tasks.Task ExecuteAsync()
|
public async System.Threading.Tasks.Task ExecuteAsync()
|
||||||
{
|
{
|
||||||
#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml"
|
WriteLiteral("\r\n");
|
||||||
|
#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml"
|
||||||
Write(foo());
|
Write(foo());
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n\r\n");
|
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ Document -
|
||||||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits_Runtime - foo.bar<baz<biz>>.boz -
|
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits_Runtime - foo.bar<baz<biz>>.boz -
|
||||||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
|
||||||
CSharpExpression - (1:0,1 [5] Inherits.cshtml)
|
HtmlContent - (33:1,0 [2] Inherits.cshtml)
|
||||||
IntermediateToken - (1:0,1 [5] Inherits.cshtml) - CSharp - foo()
|
IntermediateToken - (33:1,0 [2] Inherits.cshtml) - Html - \n
|
||||||
HtmlContent - (6:0,6 [4] Inherits.cshtml)
|
CSharpExpression - (36:2,1 [5] Inherits.cshtml)
|
||||||
IntermediateToken - (6:0,6 [4] Inherits.cshtml) - Html - \n\n
|
IntermediateToken - (36:2,1 [5] Inherits.cshtml) - CSharp - foo()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue