- This involved also adding a TagHelperTypeResolver and TagHelperDescriptorFactory.
- The TagHelperTypeResolver is responsible for determining the format of lookup text's used throughout the tag helper system. By default it handles the following formats:
"assemblyName"
"specificType, assemblyName"
- It also restricts what types are considered TagHelpers. In this implementation we only accept public, non-nested, non-abstract, non-generic TagHelpers.
- The TagHelperDescriptorFactory is responsible for converting a Type to a TagHelperDescriptor.
- Added tests to validate TagHelperDescriptorResolver, TagHelperTypeResolver and TagHelperDescriptorFactory.
#99#158
- Also added some infrastructure pieces for it such as the ITagHelperDescriptorResolver and the default implementation TagHelperDescriptorResolver which will be filled out in a later commit.
- Reworked some extensibility points to allow accessibility of the descriptor resolvers per offline discussions.
#111
- Tested that we can successfully plugin our own TagHelperAttributeValueCodeRenderer.
- Moved some existing TagHelper test logic into its own base type to enhance code reusability.
#119
- Enabled the CSharpCodeBuilder to create the CSharpCodeVisitor which exposes a CSharpTagHelperCodeRenderer which is indirectly used to render attribute values.
- Fixed up some existing classes that just new'd up the CSharpCodeVisitor class to instead take in the decorated version.
#119
- Added TagHelperChunk generation.
- Added CSharp visitors to understand TagHelperChunks and render corresponding C# code.
- Refactored some code in the CSharpCodeVisitor so it could be utilized in other classes.
- Added a CSharpFieldDeclarationVisitor to render declaration pieces for TagHelper's
- Added metadata to represent specific TagHelper code generation constructs.
#72
- Added understanding to the ParserTestBase for TagHelperBlock's
- Added a helper class MarkupTagHelperBlock to make building test TagHelpers easier.
- Fixed some existing tests that "new"d up the RazorParser and didn't obide by the new contract (to provide optimizers).
#71
- The visitor looks for TagBlock's that match registered TagHelpers and rebuilds them into TagHelperBlock's.
- Added the code generator and corresponding chunk for a TagHelperBlock.
- Added syntax tree specific objects & helper methods to create accurate tag helper structures.
#71
This is a perf improvement of about 500ms for our razor code generation
benchmark on my dev box. That's about .8% of the overall execution time of
this benchmark.
This change will remove a bunch of unnessary allocations from the
parsing/code-generation path, and should improve responsiveness.
For reference Enum.HasFlags performs boxing of the enum value, and then
does a type comparison to see if the types are the same. This is
significantly more costly than a normal bitwise and comparison, and it
results in allocations.
These types are allocated for every state transition in the parser (State)
or every character that's read (character reference) and are fairly
compact. Turning them into structs will remove a significant number of unnecessary
allocations in the parser.
For our razor code generation benchmark, making these changes yields about
500-750ms of speedup (out of 40000ms) or about 1%.
- This registration system accepts tag descriptors that it then uses to feed requests for tag helpers.
- Added some infrastructure pieces that are used to build up valid tag helper descriptors.
#70
- These are the fixes to the tests that could not be fixed by altering the core parsing code base.
- Most involve adding TagBlock's, breaking out existing markup blocks and altering some AcceptedCharacter formats.
- Was able to loosen the restrictions on AcceptedCharacter's to allow the body of html tags to accept any character.
#75
GetSourceLocation is frequently called to determine the location mappings
between the original document and the generated code.
The old implementation did a number of ToString and replace operations to
simplify the math on tracking the position - which put it front and center
in our performance measurements - about 25% of all execution time in a
sampling profile of our perf test.
The new code tracks position as code is written, and avoids allocations.
After these changes GetSourceLocation doesn't show up in the profile.
This extensibility point needs to be an override and not a pure visitor due to how the class declaration is created (only 1 right way to write the class).
#76