Adjusted verbosity of some property names and made

TagHelperIntermediateNode.TagHelpers and IList
This commit is contained in:
Ajay Bhargav Baaskaran 2017-07-06 17:40:22 -07:00
parent 02160a04d9
commit d6e892b30c
52 changed files with 197 additions and 197 deletions

View File

@ -22,13 +22,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
} }
var @class = documentNode.FindPrimaryClass(); var @class = documentNode.FindPrimaryClass();
if (@class == null || string.IsNullOrEmpty(@class.Name)) if (@class == null || string.IsNullOrEmpty(@class.ClassName))
{ {
// No class node or it's incomplete. Skip. // No class node or it's incomplete. Skip.
return; return;
} }
var generatedTypeName = $"{@namespace.Content}.{@class.Name}"; var generatedTypeName = $"{@namespace.Content}.{@class.ClassName}";
var path = codeDocument.GetRelativePath(); var path = codeDocument.GetRelativePath();
var escapedPath = EscapeAsVerbatimLiteral(path); var escapedPath = EscapeAsVerbatimLiteral(path);

View File

@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
if (node.Descriptor == Directive) if (node.Directive == Directive)
{ {
Directives.Add(node); Directives.Add(node);
} }

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
if (document.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind) if (document.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind)
{ {
return visitor.Class.Name; return visitor.Class.ClassName;
} }
else else
{ {
@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
if (node.Descriptor == Directive) if (node.Directive == Directive)
{ {
ModelDirectives.Add(node); ModelDirectives.Add(node);
} }

View File

@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override RazorCodeDocument CreateCodeDocument(RazorProjectItem projectItem) public override RazorCodeDocument CreateCodeDocument(RazorProjectItem projectItem)
{ {
var codeDocument = base.CreateCodeDocument(projectItem); var codeDocument = base.CreateCodeDocument(projectItem);
codeDocument.SetRelativePath(projectItem.Path); codeDocument.SetRelativePath(projectItem.FilePath);
return codeDocument; return codeDocument;
} }

View File

@ -26,12 +26,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
@namespace.Content = "AspNetCore"; @namespace.Content = "AspNetCore";
@class.Name = CSharpIdentifier.GetClassNameFromPath(filePath); @class.ClassName = CSharpIdentifier.GetClassNameFromPath(filePath);
@class.BaseType = "global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>"; @class.BaseType = "global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>";
@class.Modifiers.Clear(); @class.Modifiers.Clear();
@class.Modifiers.Add("public"); @class.Modifiers.Add("public");
method.Name = "ExecuteAsync"; method.MethodName = "ExecuteAsync";
method.Modifiers.Clear(); method.Modifiers.Clear();
method.Modifiers.Add("public"); method.Modifiers.Add("public");
method.Modifiers.Add("async"); method.Modifiers.Add("async");

View File

@ -70,11 +70,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var prefix = CSharpIdentifier.SanitizeClassName(Path.GetFileNameWithoutExtension(codeDocument.Source.FilePath)); var prefix = CSharpIdentifier.SanitizeClassName(Path.GetFileNameWithoutExtension(codeDocument.Source.FilePath));
if (@class != null && documentNode.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind) if (@class != null && documentNode.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind)
{ {
@class.Name = prefix + "_Page"; @class.ClassName = prefix + "_Page";
} }
else if (@class != null && documentNode.DocumentKind == MvcViewDocumentClassifierPass.MvcViewDocumentKind) else if (@class != null && documentNode.DocumentKind == MvcViewDocumentClassifierPass.MvcViewDocumentKind)
{ {
@class.Name = prefix + "_View"; @class.ClassName = prefix + "_View";
} }
} }
@ -194,7 +194,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
if (node.Descriptor == Directive) if (node.Directive == Directive)
{ {
LastNamespaceDirective = node; LastNamespaceDirective = node;
} }

View File

@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
if (node.Descriptor == Directive) if (node.Directive == Directive)
{ {
DirectiveNode = node; DirectiveNode = node;
DirectiveTokens = node.Tokens; DirectiveTokens = node.Tokens;
@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node)
{ {
if (DirectiveTokens == null && node.Descriptor == Directive) if (DirectiveTokens == null && node.Directive == Directive)
{ {
DirectiveNode = node; DirectiveNode = node;
DirectiveTokens = node.Tokens; DirectiveTokens = node.Tokens;

View File

@ -31,12 +31,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
@namespace.Content = "AspNetCore"; @namespace.Content = "AspNetCore";
@class.BaseType = "global::Microsoft.AspNetCore.Mvc.RazorPages.Page"; @class.BaseType = "global::Microsoft.AspNetCore.Mvc.RazorPages.Page";
@class.Name = CSharpIdentifier.GetClassNameFromPath(filePath); @class.ClassName = CSharpIdentifier.GetClassNameFromPath(filePath);
@class.Modifiers.Clear(); @class.Modifiers.Clear();
@class.Modifiers.Add("public"); @class.Modifiers.Add("public");
method.Name = "ExecuteAsync"; method.MethodName = "ExecuteAsync";
method.Modifiers.Clear(); method.Modifiers.Clear();
method.Modifiers.Add("public"); method.Modifiers.Add("public");
method.Modifiers.Add("async"); method.Modifiers.Add("async");

View File

@ -135,8 +135,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{ {
"private", "private",
}, },
Name = context.GetFieldName(tagHelper), FieldName = context.GetFieldName(tagHelper),
Type = "global::" + context.GetFullyQualifiedName(tagHelper), FieldType = "global::" + context.GetFullyQualifiedName(tagHelper),
}); });
} }
@ -310,7 +310,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
} }
var className = $"__Generated__{tagHelper.GetViewComponentName()}ViewComponentTagHelper"; var className = $"__Generated__{tagHelper.GetViewComponentName()}ViewComponentTagHelper";
var fullyQualifiedName = $"{Namespace.Content}.{Class.Name}.{className}"; var fullyQualifiedName = $"{Namespace.Content}.{Class.ClassName}.{className}";
var fieldName = GenerateFieldName(tagHelper); var fieldName = GenerateFieldName(tagHelper);
_tagHelpers.Add(tagHelper, (className, fullyQualifiedName, fieldName)); _tagHelpers.Add(tagHelper, (className, fullyQualifiedName, fieldName));

View File

@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
{ {
using (Context.CodeWriter.BuildClassDeclaration(node.Modifiers, node.Name, node.BaseType, node.Interfaces)) using (Context.CodeWriter.BuildClassDeclaration(node.Modifiers, node.ClassName, node.BaseType, node.Interfaces))
{ {
VisitDefault(node); VisitDefault(node);
} }
@ -137,7 +137,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
Context.CodeWriter Context.CodeWriter
.Write(node.ReturnType) .Write(node.ReturnType)
.Write(" ") .Write(" ")
.Write(node.Name) .Write(node.MethodName)
.WriteLine("()"); .WriteLine("()");
using (Context.CodeWriter.BuildScope()) using (Context.CodeWriter.BuildScope())
@ -150,12 +150,12 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node) public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node)
{ {
Context.CodeWriter.WriteField(node.Modifiers, node.Type, node.Name); Context.CodeWriter.WriteField(node.Modifiers, node.FieldType, node.FieldName);
} }
public override void VisitPropertyDeclaration(PropertyDeclarationIntermediateNode node) public override void VisitPropertyDeclaration(PropertyDeclarationIntermediateNode node)
{ {
Context.CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.Type, node.Name); Context.CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.PropertyType, node.PropertyName);
} }
public override void VisitExtension(ExtensionIntermediateNode node) public override void VisitExtension(ExtensionIntermediateNode node)

View File

@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
var reference = visitor.Directives[i]; var reference = visitor.Directives[i];
var directive = (DirectiveIntermediateNode)reference.Node; var directive = (DirectiveIntermediateNode)reference.Node;
var descriptor = directive.Descriptor; var descriptor = directive.Directive;
var seenDirective = !seenDirectives.Add(descriptor); var seenDirective = !seenDirectives.Add(descriptor);
if (!directive.IsImported()) if (!directive.IsImported())
@ -177,7 +177,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_builder.Add(new DirectiveTokenIntermediateNode() _builder.Add(new DirectiveTokenIntermediateNode()
{ {
Content = span.Content, Content = span.Content,
Descriptor = chunkGenerator.Descriptor, DirectiveToken = chunkGenerator.Descriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}); });
} }
@ -189,8 +189,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new MalformedDirectiveIntermediateNode() directiveNode = new MalformedDirectiveIntermediateNode()
{ {
Name = chunkGenerator.Descriptor.Directive, DirectiveName = chunkGenerator.Descriptor.Directive,
Descriptor = chunkGenerator.Descriptor, Directive = chunkGenerator.Descriptor,
Source = BuildSourceSpanFromNode(block), Source = BuildSourceSpanFromNode(block),
}; };
} }
@ -198,8 +198,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new DirectiveIntermediateNode() directiveNode = new DirectiveIntermediateNode()
{ {
Name = chunkGenerator.Descriptor.Directive, DirectiveName = chunkGenerator.Descriptor.Directive,
Descriptor = chunkGenerator.Descriptor, Directive = chunkGenerator.Descriptor,
Source = BuildSourceSpanFromNode(block), Source = BuildSourceSpanFromNode(block),
}; };
} }
@ -230,8 +230,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new MalformedDirectiveIntermediateNode() directiveNode = new MalformedDirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.AddTagHelperDirectiveDescriptor, Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -239,8 +239,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new DirectiveIntermediateNode() directiveNode = new DirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.AddTagHelperDirectiveDescriptor, Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -255,7 +255,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_builder.Add(new DirectiveTokenIntermediateNode() _builder.Add(new DirectiveTokenIntermediateNode()
{ {
Content = chunkGenerator.LookupText, Content = chunkGenerator.LookupText,
Descriptor = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Tokens.First(), DirectiveToken = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Tokens.First(),
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}); });
@ -269,8 +269,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new MalformedDirectiveIntermediateNode() directiveNode = new MalformedDirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -278,8 +278,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new DirectiveIntermediateNode() directiveNode = new DirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_builder.Add(new DirectiveTokenIntermediateNode() _builder.Add(new DirectiveTokenIntermediateNode()
{ {
Content = chunkGenerator.LookupText, Content = chunkGenerator.LookupText,
Descriptor = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Tokens.First(), DirectiveToken = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Tokens.First(),
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}); });
@ -308,8 +308,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new MalformedDirectiveIntermediateNode() directiveNode = new MalformedDirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -317,8 +317,8 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
directiveNode = new DirectiveIntermediateNode() directiveNode = new DirectiveIntermediateNode()
{ {
Name = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive,
Descriptor = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor,
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}; };
} }
@ -333,7 +333,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_builder.Add(new DirectiveTokenIntermediateNode() _builder.Add(new DirectiveTokenIntermediateNode()
{ {
Content = chunkGenerator.Prefix, Content = chunkGenerator.Prefix,
Descriptor = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Tokens.First(), DirectiveToken = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Tokens.First(),
Source = BuildSourceSpanFromNode(span), Source = BuildSourceSpanFromNode(span),
}); });

View File

@ -201,8 +201,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
{ {
"private", "private",
}, },
Name = context.GetFieldName(tagHelper), FieldName = context.GetFieldName(tagHelper),
Type = "global::" + tagHelper.GetTypeName(), FieldType = "global::" + tagHelper.GetTypeName(),
}); });
} }

View File

@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
private void WriteDesignTimeDirectiveToken(CodeRenderingContext context, DirectiveTokenIntermediateNode node) private void WriteDesignTimeDirectiveToken(CodeRenderingContext context, DirectiveTokenIntermediateNode node)
{ {
var tokenKind = node.Descriptor.Kind; var tokenKind = node.DirectiveToken.Kind;
if (!node.Source.HasValue || if (!node.Source.HasValue ||
!string.Equals( !string.Equals(
context.SourceDocument?.FilePath, context.SourceDocument?.FilePath,

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public FileSystemRazorProjectItem(string basePath, string path, FileInfo file) public FileSystemRazorProjectItem(string basePath, string path, FileInfo file)
{ {
BasePath = basePath; BasePath = basePath;
Path = path; FilePath = path;
File = file; File = file;
} }
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public override string BasePath { get; } public override string BasePath { get; }
public override string Path { get; } public override string FilePath { get; }
public override bool Exists => File.Exists; public override bool Exists => File.Exists;

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string ClassName { get; set; }
public string BaseType { get; set; } public string BaseType { get; set; }

View File

@ -10,11 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection();
public string Name { get; set; } public string DirectiveName { get; set; }
public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>(); public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>();
public DirectiveDescriptor Descriptor { get; set; } public DirectiveDescriptor Directive { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {

View File

@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public string Content { get; set; } public string Content { get; set; }
public DirectiveTokenDescriptor Descriptor { get; set; } public DirectiveTokenDescriptor DirectiveToken { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {

View File

@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
if (_directive == node.Descriptor) if (_directive == node.Directive)
{ {
Directives.Add(new IntermediateNodeReference(Parent, node)); Directives.Add(new IntermediateNodeReference(Parent, node));
} }

View File

@ -12,9 +12,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string FieldName { get; set; }
public string Type { get; set; } public string FieldType { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {

View File

@ -10,11 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection();
public string Name { get; set; } public string DirectiveName { get; set; }
public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>(); public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>();
public DirectiveDescriptor Descriptor { get; set; } public DirectiveDescriptor Directive { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string MethodName { get; set; }
public string ReturnType { get; set; } public string ReturnType { get; set; }

View File

@ -12,9 +12,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string PropertyName { get; set; }
public string Type { get; set; } public string PropertyType { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public string TagName { get; set; } public string TagName { get; set; }
public ICollection<TagHelperDescriptor> TagHelpers { get; } = new List<TagHelperDescriptor>(); public IList<TagHelperDescriptor> TagHelpers { get; } = new List<TagHelperDescriptor>();
public TagHelperBodyIntermediateNode Body => Children.OfType<TagHelperBodyIntermediateNode>().SingleOrDefault(); public TagHelperBodyIntermediateNode Body => Children.OfType<TagHelperBodyIntermediateNode>().SingleOrDefault();

View File

@ -19,14 +19,14 @@ namespace Microsoft.AspNetCore.Razor.Language
public NotFoundProjectItem(string basePath, string path) public NotFoundProjectItem(string basePath, string path)
{ {
BasePath = basePath; BasePath = basePath;
Path = path; FilePath = path;
} }
/// <inheritdoc /> /// <inheritdoc />
public override string BasePath { get; } public override string BasePath { get; }
/// <inheritdoc /> /// <inheritdoc />
public override string Path { get; } public override string FilePath { get; }
/// <inheritdoc /> /// <inheritdoc />
public override bool Exists => false; public override bool Exists => false;

View File

@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var configurationFeature = new DefaultDocumentClassifierPassFeature(); var configurationFeature = new DefaultDocumentClassifierPassFeature();
configurationFeature.ConfigureClass.Add((document, @class) => configurationFeature.ConfigureClass.Add((document, @class) =>
{ {
@class.Name = "Template"; @class.ClassName = "Template";
@class.Modifiers.Add("public"); @class.Modifiers.Add("public");
}); });
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Razor.Language
configurationFeature.ConfigureMethod.Add((document, method) => configurationFeature.ConfigureMethod.Add((document, method) =>
{ {
method.Name = "ExecuteAsync"; method.MethodName = "ExecuteAsync";
method.ReturnType = $"global::{typeof(Task).FullName}"; method.ReturnType = $"global::{typeof(Task).FullName}";
method.Modifiers.Add("public"); method.Modifiers.Add("public");

View File

@ -18,9 +18,9 @@ namespace Microsoft.AspNetCore.Razor.Language
public abstract string BasePath { get; } public abstract string BasePath { get; }
/// <summary> /// <summary>
/// Path relative to <see cref="BasePath"/>. /// File path relative to <see cref="BasePath"/>.
/// </summary> /// </summary>
public abstract string Path { get; } public abstract string FilePath { get; }
/// <summary> /// <summary>
/// The absolute path to the file, including the file name. /// The absolute path to the file, including the file name.
@ -47,11 +47,11 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
if (BasePath == "/") if (BasePath == "/")
{ {
return Path; return FilePath;
} }
else else
{ {
return BasePath + Path; return BasePath + FilePath;
} }
} }
} }
@ -82,26 +82,26 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
get get
{ {
var index = Path.LastIndexOf('/'); var index = FilePath.LastIndexOf('/');
return Path.Substring(index + 1); return FilePath.Substring(index + 1);
} }
} }
/// <summary> /// <summary>
/// Path relative to <see cref="BasePath"/> without the extension. /// File path relative to <see cref="BasePath"/> without the extension.
/// </summary> /// </summary>
public string PathWithoutExtension public string FilePathWithoutExtension
{ {
get get
{ {
var index = Path.LastIndexOf('.'); var index = FilePath.LastIndexOf('.');
if (index == -1) if (index == -1)
{ {
return Path; return FilePath;
} }
else else
{ {
return Path.Substring(0, index); return FilePath.Substring(0, index);
} }
} }
} }

View File

@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var path = projectItem.PhysicalPath; var path = projectItem.PhysicalPath;
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
path = projectItem.Path; path = projectItem.FilePath;
} }
using (var inputStream = projectItem.Read()) using (var inputStream = projectItem.Read())

View File

@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Razor.Language
if (!projectItem.Exists) if (!projectItem.Exists)
{ {
throw new InvalidOperationException(Resources.FormatRazorTemplateEngine_ItemCouldNotBeFound(projectItem.Path)); throw new InvalidOperationException(Resources.FormatRazorTemplateEngine_ItemCouldNotBeFound(projectItem.FilePath));
} }
var codeDocument = CreateCodeDocument(projectItem); var codeDocument = CreateCodeDocument(projectItem);
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Razor.Language
if (!projectItem.Exists) if (!projectItem.Exists)
{ {
throw new InvalidOperationException(Resources.FormatRazorTemplateEngine_ItemCouldNotBeFound(projectItem.Path)); throw new InvalidOperationException(Resources.FormatRazorTemplateEngine_ItemCouldNotBeFound(projectItem.FilePath));
} }
var source = RazorSourceDocument.ReadFrom(projectItem); var source = RazorSourceDocument.ReadFrom(projectItem);
@ -233,7 +233,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var importsFileName = Options.ImportsFileName; var importsFileName = Options.ImportsFileName;
if (!string.IsNullOrEmpty(importsFileName)) if (!string.IsNullOrEmpty(importsFileName))
{ {
return Project.FindHierarchicalItems(projectItem.Path, importsFileName); return Project.FindHierarchicalItems(projectItem.FilePath, importsFileName);
} }
return Enumerable.Empty<RazorProjectItem>(); return Enumerable.Empty<RazorProjectItem>();

View File

@ -46,7 +46,7 @@ namespace RazorPageGenerator
.SetBaseType("Microsoft.Extensions.RazorViews.BaseView") .SetBaseType("Microsoft.Extensions.RazorViews.BaseView")
.ConfigureClass((document, @class) => .ConfigureClass((document, @class) =>
{ {
@class.Name = Path.GetFileNameWithoutExtension(document.Source.FilePath); @class.ClassName = Path.GetFileNameWithoutExtension(document.Source.FilePath);
@class.Modifiers.Clear(); @class.Modifiers.Clear();
@class.Modifiers.Add("internal"); @class.Modifiers.Add("internal");
}); });
@ -134,7 +134,7 @@ namespace RazorPageGenerator
public override string BasePath => _source.BasePath; public override string BasePath => _source.BasePath;
public override string Path => _source.Path; public override string FilePath => _source.FilePath;
// Mask the full name since we don't want a developer's local file paths to be commited. // Mask the full name since we don't want a developer's local file paths to be commited.
public override string PhysicalPath => _source.FileName; public override string PhysicalPath => _source.FileName;

View File

@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode var @class = new ClassDeclarationIntermediateNode
{ {
Name = "SomeName", ClassName = "SomeName",
Annotations = Annotations =
{ {
[CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass, [CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass,
@ -163,7 +163,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode var @class = new ClassDeclarationIntermediateNode
{ {
Name = "SomeName", ClassName = "SomeName",
Annotations = Annotations =
{ {
[CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass, [CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass,
@ -214,7 +214,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode var @class = new ClassDeclarationIntermediateNode
{ {
Name = "SomeName", ClassName = "SomeName",
Annotations = Annotations =
{ {
[CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass, [CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass,
@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var builder = IntermediateNodeBuilder.Create(irDocument); var builder = IntermediateNodeBuilder.Create(irDocument);
var pageDirective = new DirectiveIntermediateNode var pageDirective = new DirectiveIntermediateNode
{ {
Descriptor = PageDirective.Directive, Directive = PageDirective.Directive,
}; };
builder.Add(pageDirective); builder.Add(pageDirective);
@ -271,7 +271,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode var @class = new ClassDeclarationIntermediateNode
{ {
Name = "SomeName", ClassName = "SomeName",
Annotations = Annotations =
{ {
[CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass, [CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass,
@ -323,7 +323,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode var @class = new ClassDeclarationIntermediateNode
{ {
Name = "SomeName", ClassName = "SomeName",
Annotations = Annotations =
{ {
[CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass, [CommonAnnotations.PrimaryClass] = CommonAnnotations.PrimaryClass,

View File

@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>", visitor.Class.BaseType); Assert.Equal("global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>", visitor.Class.BaseType);
Assert.Equal(new[] { "public" }, visitor.Class.Modifiers); Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
Assert.Equal("Test_cshtml", visitor.Class.Name); Assert.Equal("Test_cshtml", visitor.Class.ClassName);
} }
[Theory] [Theory]
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -182,7 +182,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal("ExecuteAsync", visitor.Method.Name); Assert.Equal("ExecuteAsync", visitor.Method.MethodName);
Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType); Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType);
Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers); Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
} }

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var imports = "c:\\foo\\baz\\bleh.cshtml"; var imports = "c:\\foo\\baz\\bleh.cshtml";
var node = new DirectiveIntermediateNode() var node = new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(imports, 0, 0, 0, 0), Source = new SourceSpan(imports, 0, 0, 0, 0),
}; };
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var imports = "c:\\foo\\baz\\bleh.cshtml"; var imports = "c:\\foo\\baz\\bleh.cshtml";
var node = new DirectiveIntermediateNode() var node = new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(imports, 0, 0, 0, 0), Source = new SourceSpan(imports, 0, 0, 0, 0),
}; };
node.Children.Add(new DirectiveTokenIntermediateNode() { Content = string.Empty }); node.Children.Add(new DirectiveTokenIntermediateNode() { Content = string.Empty });
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange // Arrange
var node = new DirectiveIntermediateNode() var node = new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(imports, 0, 0, 0, 0), Source = new SourceSpan(imports, 0, 0, 0, 0),
}; };
@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange // Arrange
var node = new DirectiveIntermediateNode() var node = new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(imports, 0, 0, 0, 0), Source = new SourceSpan(imports, 0, 0, 0, 0),
}; };
@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind; document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("WebApplication.Account.Manage", @namespace.Content); Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
Assert.Equal("AddUser_Page", @class.Name); Assert.Equal("AddUser_Page", @class.ClassName);
} }
// This is the case where the source file sets the namespace. // This is the case where the source file sets the namespace.
@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// This will be ignored. // This will be ignored.
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" });
@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// This will be used. // This will be used.
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" });
@ -175,7 +175,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind; document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
@ -190,7 +190,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("WebApplication.Account.Manage", @namespace.Content); Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
Assert.Equal("AddUser_Page", @class.Name); Assert.Equal("AddUser_Page", @class.ClassName);
} }
// Handles cases where invalid characters appears in FileNames. Note that we don't sanitize the part of // Handles cases where invalid characters appears in FileNames. Note that we don't sanitize the part of
@ -204,7 +204,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
@ -213,7 +213,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind; document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
@ -228,7 +228,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("WebApplication.Account.Manage_Info", @namespace.Content); Assert.Equal("WebApplication.Account.Manage_Info", @namespace.Content);
Assert.Equal("Add_User_Page", @class.Name); Assert.Equal("Add_User_Page", @class.ClassName);
} }
// This is the case where the source file sets the namespace. // This is the case where the source file sets the namespace.
@ -242,7 +242,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// This will be ignored. // This will be ignored.
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" });
@ -251,7 +251,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// This will be used. // This will be used.
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0), Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" });
@ -260,7 +260,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind; document.DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind;
@ -275,7 +275,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("WebApplication.Account.Manage", @namespace.Content); Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
Assert.Equal("AddUser_View", @class.Name); Assert.Equal("AddUser_View", @class.ClassName);
} }
// This handles an error case where we can't determine the relationship between the // This handles an error case where we can't determine the relationship between the
@ -289,7 +289,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(null, 0, 0, 0, 0), Source = new SourceSpan(null, 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind; document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
@ -313,7 +313,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("WebApplication.Account", @namespace.Content); Assert.Equal("WebApplication.Account", @namespace.Content);
Assert.Equal("default", @class.Name); Assert.Equal("default", @class.ClassName);
} }
[Fact] [Fact]
@ -325,7 +325,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
builder.Push(new DirectiveIntermediateNode() builder.Push(new DirectiveIntermediateNode()
{ {
Descriptor = NamespaceDirective.Directive, Directive = NamespaceDirective.Directive,
Source = new SourceSpan(null, 0, 0, 0, 0), Source = new SourceSpan(null, 0, 0, 0, 0),
}); });
builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" }); builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
@ -334,7 +334,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" }; var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
builder.Push(@namespace); builder.Push(@namespace);
var @class = new ClassDeclarationIntermediateNode() { Name = "default" }; var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
builder.Add(@class); builder.Add(@class);
document.DocumentKind = null; document.DocumentKind = null;
@ -349,7 +349,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("default", @namespace.Content); Assert.Equal("default", @namespace.Content);
Assert.Equal("default", @class.Name); Assert.Equal("default", @class.ClassName);
} }
} }
} }

View File

@ -137,7 +137,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Assert // Assert
Assert.Equal("global::Microsoft.AspNetCore.Mvc.RazorPages.Page", visitor.Class.BaseType); Assert.Equal("global::Microsoft.AspNetCore.Mvc.RazorPages.Page", visitor.Class.BaseType);
Assert.Equal(new[] { "public" }, visitor.Class.Modifiers); Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
Assert.Equal("Test_cshtml", visitor.Class.Name); Assert.Equal("Test_cshtml", visitor.Class.ClassName);
} }
[Theory] [Theory]
@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -207,7 +207,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal(expected, visitor.Class.Name); Assert.Equal(expected, visitor.Class.ClassName);
} }
[Fact] [Fact]
@ -228,7 +228,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
visitor.Visit(irDocument); visitor.Visit(irDocument);
// Assert // Assert
Assert.Equal("ExecuteAsync", visitor.Method.Name); Assert.Equal("ExecuteAsync", visitor.Method.MethodName);
Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType); Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType);
Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers); Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
} }

View File

@ -116,7 +116,7 @@ namespace TestNamespace
}, },
BaseType = "TestBase", BaseType = "TestBase",
Interfaces = new List<string> { "IFoo", "IBar", }, Interfaces = new List<string> { "IFoo", "IBar", },
Name = "TestClass", ClassName = "TestClass",
}); });
var codeDocument = TestRazorCodeDocument.CreateEmpty(); var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -157,7 +157,7 @@ internal class TestClass : TestBase, IFoo, IBar
"virtual", "virtual",
"async", "async",
}, },
Name = "TestMethod", MethodName = "TestMethod",
ReturnType = "string", ReturnType = "string",
}); });
@ -200,8 +200,8 @@ internal virtual async string TestMethod()
"internal", "internal",
"readonly", "readonly",
}, },
Name = "_foo", FieldName = "_foo",
Type = "string", FieldType = "string",
}); });
var codeDocument = TestRazorCodeDocument.CreateEmpty(); var codeDocument = TestRazorCodeDocument.CreateEmpty();
@ -239,8 +239,8 @@ internal readonly string _foo;
"internal", "internal",
"virtual", "virtual",
}, },
Name = "Foo", PropertyName = "Foo",
Type = "string", PropertyType = "string",
}); });
var codeDocument = TestRazorCodeDocument.CreateEmpty(); var codeDocument = TestRazorCodeDocument.CreateEmpty();

View File

@ -201,10 +201,10 @@ namespace Microsoft.AspNetCore.Razor.Language
Assert.Equal("TestNamespace", @namespace.Content); Assert.Equal("TestNamespace", @namespace.Content);
var @class = SingleChild<ClassDeclarationIntermediateNode>(@namespace); var @class = SingleChild<ClassDeclarationIntermediateNode>(@namespace);
Assert.Equal("TestClass", @class.Name); Assert.Equal("TestClass", @class.ClassName);
var method = SingleChild<MethodDeclarationIntermediateNode>(@class); var method = SingleChild<MethodDeclarationIntermediateNode>(@class);
Assert.Equal("TestMethod", method.Name); Assert.Equal("TestMethod", method.MethodName);
} }
[Fact] [Fact]
@ -270,8 +270,8 @@ namespace Microsoft.AspNetCore.Razor.Language
MethodDeclarationIntermediateNode method) MethodDeclarationIntermediateNode method)
{ {
@namespace.Content = Namespace; @namespace.Content = Namespace;
@class.Name = Class; @class.ClassName = Class;
@method.Name = Method; @method.MethodName = Method;
} }
protected override void ConfigureTarget(ICodeTargetBuilder builder) protected override void ConfigureTarget(ICodeTargetBuilder builder)

View File

@ -45,7 +45,7 @@ private void __RazorDirectiveTokenHelpers__() {
{ {
Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Content = "System.String", Content = "System.String",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Type), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Type),
}; };
node.Children.Add(token); node.Children.Add(token);
@ -80,7 +80,7 @@ System.String __typeHelper = default(System.String);
{ {
Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Content = "System.Collections.Generic", Content = "System.Collections.Generic",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Namespace), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Namespace),
}; };
node.Children.Add(token); node.Children.Add(token);
@ -115,7 +115,7 @@ global::System.Object __typeHelper = nameof(System.Collections.Generic);
{ {
Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Content = "Foo", Content = "Foo",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Member), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Member),
}; };
node.Children.Add(token); node.Children.Add(token);
@ -150,13 +150,13 @@ global::System.Object Foo = null;
{ {
Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Content = "Value", Content = "Value",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String),
}; };
var tokenWithQuotedContent = new DirectiveTokenIntermediateNode() var tokenWithQuotedContent = new DirectiveTokenIntermediateNode()
{ {
Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Content = "\"Value\"", Content = "\"Value\"",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String),
}; };
node.Children.Add(token); node.Children.Add(token);
node.Children.Add(tokenWithQuotedContent); node.Children.Add(tokenWithQuotedContent);
@ -195,7 +195,7 @@ global::System.Object __typeHelper = ""Value"";
var token = new DirectiveTokenIntermediateNode() var token = new DirectiveTokenIntermediateNode()
{ {
Content = "Value", Content = "Value",
Descriptor = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String), DirectiveToken = DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.String),
}; };
node.Children.Add(token); node.Children.Add(token);

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var codeDocument = RazorCodeDocument.Create(sourceDocument); var codeDocument = RazorCodeDocument.Create(sourceDocument);
var irDocument = new DocumentIntermediateNode(); var irDocument = new DocumentIntermediateNode();
irDocument.Children.Add(new DirectiveIntermediateNode() { Descriptor = FunctionsDirective.Directive, }); irDocument.Children.Add(new DirectiveIntermediateNode() { Directive = FunctionsDirective.Directive, });
// Act // Act
pass.Execute(codeDocument, irDocument); pass.Execute(codeDocument, irDocument);

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var codeDocument = RazorCodeDocument.Create(sourceDocument); var codeDocument = RazorCodeDocument.Create(sourceDocument);
var irDocument = new DocumentIntermediateNode(); var irDocument = new DocumentIntermediateNode();
irDocument.Children.Add(new DirectiveIntermediateNode() { Descriptor = FunctionsDirective.Directive, }); irDocument.Children.Add(new DirectiveIntermediateNode() { Directive = FunctionsDirective.Directive, });
// Act // Act
pass.Execute(codeDocument, irDocument); pass.Execute(codeDocument, irDocument);

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
var codeDocument = RazorCodeDocument.Create(sourceDocument); var codeDocument = RazorCodeDocument.Create(sourceDocument);
var irDocument = new DocumentIntermediateNode(); var irDocument = new DocumentIntermediateNode();
irDocument.Children.Add(new DirectiveIntermediateNode() { Descriptor = SectionDirective.Directive, }); irDocument.Children.Add(new DirectiveIntermediateNode() { Directive = SectionDirective.Directive, });
// Act // Act
pass.Execute(codeDocument, irDocument); pass.Execute(codeDocument, irDocument);

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var projectItem = new FileSystemRazorProjectItem("/Views", "/Home.cshtml", fileInfo); var projectItem = new FileSystemRazorProjectItem("/Views", "/Home.cshtml", fileInfo);
// Assert // Assert
Assert.Equal("/Home.cshtml", projectItem.Path); Assert.Equal("/Home.cshtml", projectItem.FilePath);
Assert.Equal("/Views", projectItem.BasePath); Assert.Equal("/Views", projectItem.BasePath);
Assert.True(projectItem.Exists); Assert.True(projectItem.Exists);
Assert.Equal("Home.cshtml", projectItem.FileName); Assert.Equal("Home.cshtml", projectItem.FileName);

View File

@ -76,20 +76,20 @@ namespace Microsoft.AspNetCore.Razor.Language
var files = fileSystemProject.EnumerateItems("/"); var files = fileSystemProject.EnumerateItems("/");
// Assert // Assert
Assert.Collection(files.OrderBy(f => f.Path), Assert.Collection(files.OrderBy(f => f.FilePath),
file => file =>
{ {
Assert.Equal("/Home.cshtml", file.Path); Assert.Equal("/Home.cshtml", file.FilePath);
Assert.Equal("/", file.BasePath); Assert.Equal("/", file.BasePath);
}, },
file => file =>
{ {
Assert.Equal("/Views/About/About.cshtml", file.Path); Assert.Equal("/Views/About/About.cshtml", file.FilePath);
Assert.Equal("/", file.BasePath); Assert.Equal("/", file.BasePath);
}, },
file => file =>
{ {
Assert.Equal("/Views/Home/Index.cshtml", file.Path); Assert.Equal("/Views/Home/Index.cshtml", file.FilePath);
Assert.Equal("/", file.BasePath); Assert.Equal("/", file.BasePath);
}); });
} }
@ -104,15 +104,15 @@ namespace Microsoft.AspNetCore.Razor.Language
var files = fileSystemProject.EnumerateItems("/Views"); var files = fileSystemProject.EnumerateItems("/Views");
// Assert // Assert
Assert.Collection(files.OrderBy(f => f.Path), Assert.Collection(files.OrderBy(f => f.FilePath),
file => file =>
{ {
Assert.Equal("/About/About.cshtml", file.Path); Assert.Equal("/About/About.cshtml", file.FilePath);
Assert.Equal("/Views", file.BasePath); Assert.Equal("/Views", file.BasePath);
}, },
file => file =>
{ {
Assert.Equal("/Home/Index.cshtml", file.Path); Assert.Equal("/Home/Index.cshtml", file.FilePath);
Assert.Equal("/Views", file.BasePath); Assert.Equal("/Views", file.BasePath);
}); });
} }
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.True(file.Exists); Assert.True(file.Exists);
Assert.Equal(path, file.Path); Assert.Equal(path, file.FilePath);
} }
[Fact] [Fact]

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
var templateEngine = new RazorTemplateEngine(razorEngine, project); var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act // Act
var resultcSharpDocument = templateEngine.GenerateCode(projectItem.Path); var resultcSharpDocument = templateEngine.GenerateCode(projectItem.FilePath);
// Assert // Assert
AssertCSharpDocumentMatchesBaseline(resultcSharpDocument); AssertCSharpDocumentMatchesBaseline(resultcSharpDocument);
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
var templateEngine = new RazorTemplateEngine(razorEngine, project); var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act // Act
var cSharpDocument = templateEngine.GenerateCode(projectItem.Path); var cSharpDocument = templateEngine.GenerateCode(projectItem.FilePath);
// Assert // Assert
AssertCSharpDocumentMatchesBaseline(cSharpDocument); AssertCSharpDocumentMatchesBaseline(cSharpDocument);
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{ {
engine.ConfigureClass((document, @class) => engine.ConfigureClass((document, @class) =>
{ {
@class.Name = "MyClass"; @class.ClassName = "MyClass";
@class.Modifiers.Clear(); @class.Modifiers.Clear();
@class.Modifiers.Add("protected"); @class.Modifiers.Add("protected");
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
var templateEngine = new RazorTemplateEngine(razorEngine, project); var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act // Act
var cSharpDocument = templateEngine.GenerateCode(projectItem.Path); var cSharpDocument = templateEngine.GenerateCode(projectItem.FilePath);
// Assert // Assert
AssertCSharpDocumentMatchesBaseline(cSharpDocument); AssertCSharpDocumentMatchesBaseline(cSharpDocument);
@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
var templateEngine = new RazorTemplateEngine(razorEngine, project); var templateEngine = new RazorTemplateEngine(razorEngine, project);
// Act // Act
var cSharpDocument = templateEngine.GenerateCode(projectItem.Path); var cSharpDocument = templateEngine.GenerateCode(projectItem.FilePath);
// Assert // Assert
AssertCSharpDocumentMatchesBaseline(cSharpDocument); AssertCSharpDocumentMatchesBaseline(cSharpDocument);

View File

@ -76,19 +76,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
var match1 = new DirectiveIntermediateNode() var match1 = new DirectiveIntermediateNode()
{ {
Descriptor = directive, Directive = directive,
}; };
builder.Add(match1); builder.Add(match1);
var nonMatch = new DirectiveIntermediateNode() var nonMatch = new DirectiveIntermediateNode()
{ {
Descriptor = directive2, Directive = directive2,
}; };
builder.Add(nonMatch); builder.Add(nonMatch);
var match2 = new DirectiveIntermediateNode() var match2 = new DirectiveIntermediateNode()
{ {
Descriptor = directive, Directive = directive,
}; };
builder.Add(match2); builder.Add(match2);

View File

@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var projectItem = new TestRazorProjectItem(path, basePath: "/"); var projectItem = new TestRazorProjectItem(path, basePath: "/");
// Act // Act
var fileName = projectItem.PathWithoutExtension; var fileName = projectItem.FilePathWithoutExtension;
// Assert // Assert
Assert.Equal(expected, fileName); Assert.Equal(expected, fileName);

View File

@ -86,9 +86,9 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.Collection( Assert.Collection(
result, result,
item => Assert.Equal($"/Views/Home/{fileName}", item.Path), item => Assert.Equal($"/Views/Home/{fileName}", item.FilePath),
item => Assert.Equal($"/Views/{fileName}", item.Path), item => Assert.Equal($"/Views/{fileName}", item.FilePath),
item => Assert.Equal($"/{fileName}", item.Path)); item => Assert.Equal($"/{fileName}", item.FilePath));
} }
[Fact] [Fact]
@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.Collection( Assert.Collection(
result, result,
item => Assert.Equal("/File.cshtml", item.Path)); item => Assert.Equal("/File.cshtml", item.FilePath));
} }
[Fact] [Fact]
@ -132,10 +132,10 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.Collection( Assert.Collection(
result, result,
item => Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.Path), item => Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.FilePath),
item => Assert.Equal("/Areas/MyArea/File.cshtml", item.Path), item => Assert.Equal("/Areas/MyArea/File.cshtml", item.FilePath),
item => Assert.Equal("/Areas/File.cshtml", item.Path), item => Assert.Equal("/Areas/File.cshtml", item.FilePath),
item => Assert.Equal("/File.cshtml", item.Path)); item => Assert.Equal("/File.cshtml", item.FilePath));
} }
[Fact] [Fact]
@ -176,27 +176,27 @@ namespace Microsoft.AspNetCore.Razor.Language
result, result,
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/MyArea/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/File.cshtml", item.FilePath);
Assert.True(item.Exists); Assert.True(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/File.cshtml", item.Path); Assert.Equal("/Areas/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/File.cshtml", item.Path); Assert.Equal("/File.cshtml", item.FilePath);
Assert.True(item.Exists); Assert.True(item.Exists);
}); });
} }
@ -223,22 +223,22 @@ namespace Microsoft.AspNetCore.Razor.Language
result, result,
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/MyArea/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/File.cshtml", item.FilePath);
Assert.True(item.Exists); Assert.True(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/File.cshtml", item.Path); Assert.Equal("/Areas/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}); });
} }
@ -265,12 +265,12 @@ namespace Microsoft.AspNetCore.Razor.Language
result, result,
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}, },
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}); });
} }
@ -297,7 +297,7 @@ namespace Microsoft.AspNetCore.Razor.Language
result, result,
item => item =>
{ {
Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.Path); Assert.Equal("/Areas/MyArea/Views/Home/File.cshtml", item.FilePath);
Assert.False(item.Exists); Assert.False(item.Exists);
}); });
} }
@ -325,7 +325,7 @@ namespace Microsoft.AspNetCore.Razor.Language
private RazorProjectItem CreateProjectItem(string path) private RazorProjectItem CreateProjectItem(string path)
{ {
var projectItem = new Mock<RazorProjectItem>(); var projectItem = new Mock<RazorProjectItem>();
projectItem.SetupGet(f => f.Path).Returns(path); projectItem.SetupGet(f => f.FilePath).Returns(path);
projectItem.SetupGet(f => f.Exists).Returns(true); projectItem.SetupGet(f => f.Exists).Returns(true);
return projectItem.Object; return projectItem.Object;
} }

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var document = RazorSourceDocument.ReadFrom(projectItem); var document = RazorSourceDocument.ReadFrom(projectItem);
// Assert // Assert
Assert.Equal(projectItem.Path, document.FilePath); Assert.Equal(projectItem.FilePath, document.FilePath);
Assert.Equal(projectItem.Content, ReadContent(document)); Assert.Equal(projectItem.Content, ReadContent(document));
} }

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
var import = Assert.Single(imports); var import = Assert.Single(imports);
Assert.Equal(projectItem.Path, import.FilePath); Assert.Equal(projectItem.FilePath, import.FilePath);
} }
[Fact] [Fact]
@ -283,7 +283,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var imports = templateEngine.GetImportItems("/Views/Home/Index.cshtml"); var imports = templateEngine.GetImportItems("/Views/Home/Index.cshtml");
// Assert // Assert
var paths = imports.Select(i => i.Path); var paths = imports.Select(i => i.FilePath);
Assert.Equal(expected, paths); Assert.Equal(expected, paths);
} }
@ -307,7 +307,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var imports = templateEngine.GetImportItems(projectItem); var imports = templateEngine.GetImportItems(projectItem);
// Assert // Assert
var paths = imports.Select(i => i.Path); var paths = imports.Select(i => i.FilePath);
Assert.Equal(expected, paths); Assert.Equal(expected, paths);
} }
} }

View File

@ -240,7 +240,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{ {
public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
{ {
node.Name = FileName.Replace('/', '_'); node.ClassName = FileName.Replace('/', '_');
node.Modifiers.Clear(); node.Modifiers.Clear();
node.Modifiers.Add("public"); node.Modifiers.Add("public");
@ -260,7 +260,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
node.Modifiers.Clear(); node.Modifiers.Clear();
node.Modifiers.Add("public"); node.Modifiers.Add("public");
node.Modifiers.Add("async"); node.Modifiers.Add("async");
node.Name = "ExecuteAsync"; node.MethodName = "ExecuteAsync";
node.ReturnType = typeof(Task).FullName; node.ReturnType = typeof(Task).FullName;
VisitDefault(node); VisitDefault(node);

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
{ {
WriteContentNode(node, string.Join(" ", node.Modifiers), node.Name, node.BaseType, string.Join(", ", node.Interfaces ?? new List<string>())); WriteContentNode(node, string.Join(" ", node.Modifiers), node.ClassName, node.BaseType, string.Join(", ", node.Interfaces ?? new List<string>()));
} }
public override void VisitCSharpExpressionAttributeValue(CSharpExpressionAttributeValueIntermediateNode node) public override void VisitCSharpExpressionAttributeValue(CSharpExpressionAttributeValueIntermediateNode node)
@ -52,12 +52,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node)
{ {
WriteContentNode(node, node.Name); WriteContentNode(node, node.DirectiveName);
} }
public override void VisitDirective(DirectiveIntermediateNode node) public override void VisitDirective(DirectiveIntermediateNode node)
{ {
WriteContentNode(node, node.Name); WriteContentNode(node, node.DirectiveName);
} }
public override void VisitDirectiveToken(DirectiveTokenIntermediateNode node) public override void VisitDirectiveToken(DirectiveTokenIntermediateNode node)
@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node) public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node)
{ {
WriteContentNode(node, string.Join(" ", node.Modifiers), node.Type, node.Name); WriteContentNode(node, string.Join(" ", node.Modifiers), node.FieldType, node.FieldName);
} }
public override void VisitHtmlAttribute(HtmlAttributeIntermediateNode node) public override void VisitHtmlAttribute(HtmlAttributeIntermediateNode node)
@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node) public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node)
{ {
WriteContentNode(node, string.Join(" ", node.Modifiers), node.ReturnType, node.Name); WriteContentNode(node, string.Join(" ", node.Modifiers), node.ReturnType, node.MethodName);
} }
public override void VisitUsingDirective(UsingDirectiveIntermediateNode node) public override void VisitUsingDirective(UsingDirectiveIntermediateNode node)

View File

@ -140,7 +140,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
try try
{ {
var directive = Assert.IsType<DirectiveIntermediateNode>(node); var directive = Assert.IsType<DirectiveIntermediateNode>(node);
Assert.Equal(expectedName, directive.Name); Assert.Equal(expectedName, directive.DirectiveName);
} }
catch (XunitException e) catch (XunitException e)
{ {
@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
try try
{ {
var token = Assert.IsType<DirectiveTokenIntermediateNode>(node); var token = Assert.IsType<DirectiveTokenIntermediateNode>(node);
Assert.Equal(expectedKind, token.Descriptor.Kind); Assert.Equal(expectedKind, token.DirectiveToken.Kind);
Assert.Equal(expectedContent, token.Content); Assert.Equal(expectedContent, token.Content);
} }
catch (XunitException e) catch (XunitException e)
@ -314,7 +314,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
try try
{ {
var fieldNode = Assert.IsType<FieldDeclarationIntermediateNode>(node); var fieldNode = Assert.IsType<FieldDeclarationIntermediateNode>(node);
Assert.Equal(typeFullName, fieldNode.Type); Assert.Equal(typeFullName, fieldNode.FieldType);
} }
catch (XunitException e) catch (XunitException e)
{ {

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public TestRazorProject(IList<RazorProjectItem> items) public TestRazorProject(IList<RazorProjectItem> items)
{ {
_lookup = items.ToDictionary(item => item.Path); _lookup = items.ToDictionary(item => item.FilePath);
} }
public override IEnumerable<RazorProjectItem> EnumerateItems(string basePath) public override IEnumerable<RazorProjectItem> EnumerateItems(string basePath)

View File

@ -13,14 +13,14 @@ namespace Microsoft.AspNetCore.Razor.Language
string physicalPath = null, string physicalPath = null,
string basePath = "/") string basePath = "/")
{ {
Path = path; FilePath = path;
PhysicalPath = physicalPath; PhysicalPath = physicalPath;
BasePath = basePath; BasePath = basePath;
} }
public override string BasePath { get; } public override string BasePath { get; }
public override string Path { get; } public override string FilePath { get; }
public override string PhysicalPath { get; } public override string PhysicalPath { get; }