-
Notifications
You must be signed in to change notification settings - Fork 222
Conversation
66ec4b7
to
eea6044
Compare
This is now ready for review |
edbb012
to
88cca81
Compare
f6d1798
to
93ce3f1
Compare
5148739
to
9a862c6
Compare
64b594f
to
85c71b2
Compare
85c71b2
to
2467e0f
Compare
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Outdated
Show resolved
Hide resolved
} | ||
else | ||
else if (context.ChunkGenerator is DirectiveTokenChunkGenerator tokenChunkGenerator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Intermediate phase is still dependent on ChunkGenerator
s because the old code was heavily dependent on it. I plan to remove it in the future. #ByDesign
{ | ||
if (node.Value != null && node.Value.ChildNodes().All(c => c is MarkupLiteralAttributeValueSyntax)) | ||
{ | ||
// We need to do what ConditionalAttributeCollapser used to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we got rid of ConditionalAttributeCollapser, I need this logic to merge contiguous MarkupLiterals so we generate a single Intermediate node for all of it. I'll change the above comment to explain this. #ByDesign
@@ -14,23 +14,6 @@ public AddImportChunkGenerator(string ns) | |||
|
|||
public string Namespace { get; } | |||
|
|||
public override void Accept(ParserVisitor visitor, Span span) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChunkGenerator
s don't really do anything anymore other than be a marker. #ByDesign
} | ||
|
||
private static void ConfigureNonStringAttribute(SpanBuilder builder, bool isDuplicateAttribute) | ||
private class AttributeValueRewriter : SyntaxRewriter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever is in it is probably ugly. TagHelperBlockRewriter used to do a whole bunch of "special" rewriting of attribute values. Keeping the same behavior while operating on the new tree makes it really ugly. I plan to clean this up as much as possible as part of attribute value syntax improvements. #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesomeness!
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax | ||
{ | ||
internal readonly struct ChildSyntaxList : IEquatable<ChildSyntaxList>, IReadOnlyList<SyntaxNode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Roslyn #ByDesign
{ | ||
private static readonly string TagHelperAttributeInfoKey = typeof(TagHelperAttributeInfo).Name; | ||
|
||
public TagHelperAttributeInfo TagHelperAttributeInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added Metadata about the node as first class properties instead on an annotation. #ByDesign
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax | ||
{ | ||
internal abstract partial class SyntaxNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Roslyn #ByDesign
return content; | ||
} | ||
|
||
public static string GetTagName(this MarkupTagBlockSyntax tagBlock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are currently extension methods. But these will go away once the structure of a Tag Block is improved. #ByDesign
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax | ||
{ | ||
internal static class SyntaxReplacer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Roslyn #ByDesign
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax | ||
{ | ||
internal abstract partial class SyntaxRewriter : SyntaxVisitor<SyntaxNode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Roslyn #ByDesign
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax | ||
{ | ||
internal class SyntaxListPool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Roslyn #ByDesign
src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/IParentChunkGenerator.cs
Outdated
Show resolved
Hide resolved
|
||
namespace Microsoft.AspNetCore.Razor.Language.Legacy | ||
{ | ||
internal class SpanContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpanContext [](start = 19, length = 11)
I see that this is in the .Leygacy namespace which is OK. I'm hoping that this is somewhat of a temporary bridge between old code and new code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but they won't go away anytime soon because we don't have a plan for getting rid of EditHandlers
In reply to: 233617210 [](ancestors = 233617210)
src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperAttributeInfo.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Syntax/LegacySyntaxNodeExtensions.cs
Outdated
Show resolved
Hide resolved
|
||
namespace Microsoft.AspNetCore.Razor.Language.Syntax | ||
{ | ||
internal static class MarkupElementRewriter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MarkupElementRewriter [](start = 26, length = 21)
I'm assuming that this is also temporary (this is the code that groups elements/tags).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but I didn't put it in Legacy because this operates completely on the new infrastructure and doesn't use any of our legacy components.
In reply to: 233619189 [](ancestors = 233619189)
if (source.Length == 0) | ||
{ | ||
// Just a marker symbol | ||
return new SourceLocation(source.FilePath, 0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really correct? Don't marker symbols still have a location? #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The answer is yes for both questions. This is the case when the document is empty and the only thing we generate is a marker symbol.
In reply to: 233620145 [](ancestors = 233620145)
src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs
Outdated
Show resolved
Hide resolved
return WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupBlock); | ||
} | ||
|
||
public override SyntaxNode VisitGenericBlock(GenericBlockSyntax node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already regret having a GenericBlock
. This is currently only use in attribute values. I'm hoping I can get rid of this when I clean that up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah there shouldn't be anything generic. Everything should be specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still poking through, just publishing the comments I have so far.
src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments, still looking. Finished tokenizerbackedparser and csharp code parser O_O, they were masssssivveee. It took almost all day, but I was able to finish
src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments, starting to look at TagHelper goods. Loving all of the deletions.
src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs
Outdated
Show resolved
Hide resolved
@@ -19,10 +19,6 @@ internal class HtmlMarkupParser : TokenizerBackedParser<HtmlTokenizer> | |||
SyntaxFactory.Token(SyntaxKind.Bang, "!"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking the PR on this but this class definitely need to be refactored in ways like CSharpCodeParser was. CSharpCodeParser is beaaautiful in terms of its factorings and this could benefit from similar treatment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that is the goal 🏁
🆙 📅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not many comments in regards to the TagHelper pieces, pushing through more.
src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockRewriter.cs
Show resolved
Hide resolved
} | ||
|
||
private static void ConfigureNonStringAttribute(SpanBuilder builder, bool isDuplicateAttribute) | ||
private class AttributeValueRewriter : SyntaxRewriter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesomeness!
src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperInfo.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperParseTreeRewriter.cs
Show resolved
Hide resolved
I Did it! That was super dope, nothing blocking |
🆙 📅 |
- Rewrite CSharp parser - Basic rewrite of HTML parser (More improvements to follow) - Define and generate syntax nodes and boilerplate - Rewrite ClassifiedSpan and TagHelperSpan generation logic - Rewrite TagHelper phase - Rewrite Intermediate phase - Rewrite other miscellaneous features and bug fixes - Rewrite partial parsing - Added some syntax manipulation APIs - Removed unused legacy types
- Update parser test infrastructure - Update tests - Regenerated baselines - Removed unused legacy types
abc201b
to
62fe3d4
Compare
Thanks for the review @NTaylorMullen and @rynowak |
#2579, #2580, #2581, #2584, #2582, #2587, #2585, #2700, #2689